轻量级前端框架助力开发者提升项目效率与性能
745
2023-05-07
Eclipse添加servlet模板过程代码详解
1.先写好一个servlet模板
package com.exam.servlet;
import java.io.IOException;
import javax.servlet.SerRGVNQLbvletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
* datatime: 2020年7月15日 下午9:04:18
* Servlet implementation class dddd
*/
public class dddd extends HttpServlet {
private static final long serialVersionUID = 1L;
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
// TODO Auto-generated method stub
response.setContentType("text/html;charset=utf-8");
request.setCharacterEncoding("utf-8");
}
/**
* @see HttpServlet#doPost(HttpServletRhttp://equest request, HttpServletResponse response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
// TODO Auto-generated method stub
doGet(request, response);
}
}
2.添加到eclipse模板中
再点击ok
应用并关闭
再打开的类中输入servlet按alt+/
就会输出当前的模板
版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。
发表评论
暂时没有评论,来抢沙发吧~