码迷,mamicode.com
首页 > 其他好文 > 详细

idea自定义servlet模板

时间:2019-11-11 12:36:38      阅读:98      评论:0      收藏:0      [点我收藏+]

标签:throw   head   throws   value   request   protected   rri   pac   content   

技术图片

 

 

 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模板

标签:throw   head   throws   value   request   protected   rri   pac   content   

原文地址:https://www.cnblogs.com/yanghaoyu0624/p/11833875.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!