我在为我的博客制作网站。当我在测试其他语言的编码时。
27 <%
28 String str = request.getParameter("stone");
29 out.println(new String(str.getBytes("ISO-8859-1"), "utf-8"));
30 %>我不知道为什么这段代码会产生以下错误:
HTTP状态500 -处理JSP页/index.jsp的异常发生在第29行。
发布于 2014-01-15 18:04:50
我会将我的代码包装在一个try/catch结构中。因此,
String str;
try {
str = request.getParameter("stone");
out.println(new String(str.getBytes("ISO-8859-1"), "utf-8"));
} catch (Exception e) {
out.print("<p>An unexpected exception occurred: " + e.getMessage() + "</p>");
}希望这能有所帮助。
https://stackoverflow.com/questions/21140784
复制相似问题