eclipse 编辑jsp中文问题
我用的是eclipse 3.2+tomcat5.5.17+myeclipse 5.1GA,在调试jsp的时候,如果jsp中包含中文的时候,在工程目录下的work文件夹里对应的临时servlet文件中就中文显示为乱码,不知为何。把myeclipse中jsp的编码格式设置成GB18030也不行,在网上搜了很久都没解决问题,请高手帮忙下,谢谢!
jsp代码:
<%@ page language= "java " contentType= "text/html; charset=GB18030 "
pageEncoding= "GB18030 "%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN " "http://www.w3.org/TR/html4/loose.dtd ">
<html>
<head>
<meta http-equiv= "Content-Type " content= "text/html; charset=GB18030 ">
<title> Insert title here </title>
</head>
<body>
试验
</body>
</html>
eclipse中自动编译的相对应servlet代码:out.write( "璇曢獙\r\n ");出现乱码
package org.apache.jsp;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
public final class te_jsp extends org.apache.jasper.runtime.HttpJspBase
implements org.apache.jasper.runtime.JspSourceDependent {
private static java.util.List _jspx_dependants;
public Object getDependants() {
return _jspx_dependants;
}
public void _jspService(HttpServletRequest request, HttpServletResponse response)
throws java.io.IOException, ServletException {
JspFactory _jspxFactory = null;
PageContext pageContext = null;
HttpSession session = null;
ServletContext application = null;
ServletConfig config = null;
JspWriter out = null;
Object page = this;
JspWriter _jspx_out = null;
PageContext _jspx_page_context = null;
try {
_jspxFactory = JspFactory.getDefaultFactory();
response.setContentType( "text/html; charset=GB18030 ");
pageContext = _jspxFactory.getPageContext(this, request, response,
null, true, 8192, true);
_jspx_page_context = pageContext;
application = pageContext.getServletContext();
config = pageContext.getServletConfig();
session = pageContext.getSession();
out = pageContext.getOut();
_jspx_out = out;
out.write( "\r\n ");
out.write( " <!DOCTYPE html PUBLIC \ "-//W3C//DTD HTML 4.01 Transitional//EN\ " \ "http://www.w3.org/TR/html4/loose.dtd\ "> \r\n ");
out.write( " <html> \r\n ");
out.write( " <head> \r\n ");
out.write( " <meta http-equiv=\ "Content-Type\ " content=\ "text/html; charset=GB18030\ "> \r\n ");
out.write( " <title> Insert title here </title> \r\n ");
out.write( " </head> \r\n ");
out.write( " <body> \r\n ");
out.write( "璇曢獙\r\n ");
out.write( " </body> \r\n ");
out.write( " </html> ");
} catch (Throwable t) {
if (!(t instanceof SkipPageException)){
out = _jspx_out;
if (out != null && out.getBufferSize() != 0)
out.clearBuffer();
if (_jspx_page_context != null) _jspx_page_context.handlePageException(t);
}
} finally {
if (_jspxFactory != null) _jspxFactory.releasePageContext(_jspx_page_context);
}
}
}
[解决办法]
如果是从cvs上下的,就重新下一次,现更改编码,然后再打开文件。
[解决办法]
用UTF-8试试
[解决办法]
lz这个问题我也遇见过...用尽所有方法对不好使..最后只有遇见jsp中有中文的就在UE或者EditPlus中编辑....不要在eclipse中对jsp中中文进行修改.....和和..这也是没有办法的办法....