idea自定义servlet模板
Posted yanghaoyu0624
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了idea自定义servlet模板相关的知识,希望对你有一定的参考价值。
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 }
以上是关于idea自定义servlet模板的主要内容,如果未能解决你的问题,请参考以下文章