1 #if (${PACKAGE_NAME} && ${PACKAGE_NAME} != "")package ${PACKAGE_NAME};#end 2 #parse("File Header.java") 3 /** 4 * @Description TODO 5 * @ClassName ${Class_Name} 6 * @Author ${USER} 7 * @Date ${DATE} ${TIME} 8 */ 9 @javax.servlet.annotation.WebServlet(value="/${Entity_Name}") 10 public class ${Class_Name} extends javax.servlet.http.HttpServlet { 11 @Override 12 protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 13 /* 处理响应乱码问题:字节流需getBytes("UTF-8") */ 14 response.setContentType("text/html;charset=UTF-8"); 15 /* 处理post请求乱码问题 */ 16 request.setCharacterEncoding("UTF-8"); 17 } 18 19 @Override 20 protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 21 doGet(request, response); 22 } 23 }
原文地址:https://www.cnblogs.com/yanghaoyu0624/p/11833875.html
时间: 2024-11-23 20:28:59