servlet的有关问题,,会的请答,,
package Conn;import java.io.IOException;import java.io.PrintWriter;import javax.servlet.ServletException;import javax.servlet.http.HttpServlet;import javax.servlet.http.HttpServletRequest;import javax.servlet.http.HttpServletResponse;public class Test extends HttpServlet {/*** The doPost method of the servlet. <br>16:14 2012/7/31* This method is called when a form has its tag value method equals to post.* * @param request the request send by the client to the server* @param response the response send by the server to the client* @throws ServletException if an error occurred* @throws IOException if an error occurred*/public void service(HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException { //处理中文问题 request.setCharacterEncoding("utf-8"); response.setContentType("text/html;charset=utf-8"); System.out.println("start............"); String username=request.getParameter("username"); String content=request.getParameter("content"); //username=new String(username.getBytes("gb2312"),"utf-8"); PrintWriter out = response.getWriter(); out.write(username); System.out.println("username>>=="+username); out.write(content); out.flush(); out.close(); System.out.println("end");}}