Topic: servlet输出中文问题; |
Print this page |
1.servlet输出中文问题; | Copy to clipboard |
Posted by: cmslovehxh Posted on: 2003-04-21 17:35 package usingjsp; import javax.servlet.*; import java.io.*; import java.util.*; public class HelloWorldServlet extends GenericServlet { public void service(ServletRequest request, ServletResponse response)throws IOException { response.setContentType("text/html"); PrintWriter out=response.getWriter(); out.println("<html>"); out.println("<body>"); out.println("我为何是乱码?"); out.println("<h1>Hello World!</h1>"); out.println("</body>"); out.println("</html>"); } } 输出是乱码,怎么解决呢? |
2.Re:servlet输出中文问题; [Re: cmslovehxh] | Copy to clipboard |
Posted by: cmslovehxh Posted on: 2003-04-21 17:47 我已经搞定了! response.setContentType("text/html;charset=gb2312"); |
3.Re:servlet输出中文问题; [Re: cmslovehxh] | Copy to clipboard |
Posted by: supermy Posted on: 2003-04-23 15:22 不一定吧。你说的只能解决输出问题,输入最好使用filter 编码。 |
Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1 客服电话 18559299278 客服信箱 714923@qq.com 客服QQ 714923 |