6.现在已经简化了好了,但是每次创建之后要继承还要手写注解,还是不够简单,所以我们配合模板开发
a.打开File->->->File and Code ->Other->Web->Java Code ->Class.java
b.将里面的内容更换成以下内容
#if (${PACKAGE_NAME} && ${PACKAGE_NAME} != "")package ${PACKAGE_NAME};#end#parse("File Header.java")@javax.servlet.annotation.WebServlet(urlPatterns = "/${Entity_Name}",name = "${Entity_Name}")public class ${Class_Name} extends javax.servlet.http.HttpServlet {protected void doPost(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws javax.servlet.ServletException, java.io.IOException {}protected void doGet(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws javax.servlet.ServletException, java.io.IOException {doPost(request,response);}}
c.创建模板开始写代码
d.创建好的样子
package com.sss.demo;import javax.servlet.ServletException;import javax.servlet.annotation.WebServlet;import javax.servlet.http.HttpServlet;import javax.servlet.http.HttpServletRequest;import javax.servlet.http.HttpServletResponse;import java.io.IOException;@WebServlet(urlPatterns = "/DemoServlet5", name = "DemoServlet5")public class DemoServlet5 extends HttpServlet {protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {}protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {doPost(request, response);}}
- 2030年人工智能会有多强大?
- Python实现分类算法
- 未来计算机能否可能统治人类世界,未来学家预测人工智能或将统治人类社会
- 人工智能未来会取代人类吗
- 实测5分钟在金山云大米上基于WordPress搭建一个博客
- yarn 设置镜像源
- 我想办一个养鸡场,大概2000只左右,要注意什么问题,还要办什么手续?
- 使用JavaScript建立一个语法高亮输入框
- React入门笔记:一个小表格组件的构建过程
- 创建 API 路由模块