Eclipse基本操作(一)设置Servlet模板、设置Java项目自动进入Tomcat中webap

2019-04-13 21:05发布

一、设置模板操作步骤:

1.点击Windows 2.选择Preference 3.搜索template 4.选择Java -> Editor -> templates 5.点击New进行新建

servlet模板: package ${enclosing_package}; import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; public class ${primary_type_name} extends HttpServlet { public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.getWriter().write("hello haohao..."); } public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doGet(request, response); } }
二、进行设置让项目发布时会自动进入Tomcat中webapps下

Life is a pure flame, and we live by an invisible sun within us.  生命如纯洁的火焰,而维系这火焰的是我们内心的太阳。