• Netbeans 注释模板配置


    工具-》模板-》展开Java

    选中Java类-》在编辑器中打开

    修改如下:

    <#if package?? && package != "">
    package ${package};
    
    </#if>
    /**
     * @author ${user}
     * @date ${date} ${time}
     */
    public class ${name} {
    
    }

     (1)Java类

    <#if package?? && package != "">
    package ${package};
    
    </#if>
    /**
     * @author  ${user}
     * @date    ${date} ${time}
     * @version V1.0
     * @desc    
     */
    public class ${name} {
    
    }

    (2)接口

    <#if package?? && package != "">
    package ${package};
    
    </#if>
    /**
     * @author  ${user}
     * @date    ${date} ${time}
     * @version V1.0
     * @desc    
     */
    public interface ${name} {
    
    }

    (3)枚举

    <#if package?? && package != "">
    package ${package};
    
    </#if>
    /**
     * @author  ${user}
     * @date    ${date} ${time}
     * @version V1.0
     * @desc    
     */
    public enum ${name} {
    
    }

    (4)Servlet

    <#if package?? && package != "">
    package ${package};
    </#if>
    
    import java.io.IOException;
    import java.io.PrintWriter;
    import javax.servlet.ServletException;
    <#if classAnnotation??>
    import javax.servlet.annotation.WebServlet;
    </#if>
    <#if includeInitParams??>
    import javax.servlet.annotation.WebInitParam;
    </#if>
    import javax.servlet.http.HttpServlet;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    
    /**
     * @author  ${user}
     * @date    ${date} ${time}
     * @version V1.0
     * @desc    
     */
    <#if classAnnotation??>
    ${classAnnotation}
    </#if>
    public class ${name} extends HttpServlet {
    
        protected void processRequest(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {
            response.setContentType("text/html;charset=UTF-8");
    <#if java17style?? && java17style>
            try (PrintWriter out = response.getWriter()) {
    <#else>
            PrintWriter out = response.getWriter();
            try {
    </#if>
                out.println("${doctype?j_string}");
                out.println("<html>");
                out.println("<head>");
                out.println("<title>Servlet ${name}</title>");  
                out.println("</head>");
                out.println("<body>");
                out.println("<h1>Servlet ${name} at " + request.getContextPath () + "</h1>");
                out.println("</body>");
                out.println("</html>");
    <#if !java17style?? || !java17style>
            } finally {
                out.close();
    </#if>
            }
        } 
    
    <#if java15style??>
        @Override
    </#if>
        protected void doGet(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {
            processRequest(request, response);
        } 
    
    <#if java15style??>
        @Override
    </#if>
        protected void doPost(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {
            processRequest(request, response);
        }
    }
  • 相关阅读:
    使用echarts插件做图表常见的几个问题(五)——图形的两种渲染方式
    数组对象如何根据对象中某个字段分组
    JS监听浏览器后退事件
    使用echarts插件做图表常见的几个问题(四)—— 柱状图中以虚线展示重合的柱子
    使用echarts插件做图表常见的几个问题(三)—— 图表标线的使用
    使用echarts插件做图表常见的几个问题(二)—— 实现多Y轴
    使用echarts插件做图表常见的几个问题(一)—— 折线图局部虚线
    如何判断touch事件滑动的方向?
    解决session共享方案
    设计模式总结
  • 原文地址:https://www.cnblogs.com/yshyee/p/4305271.html
Copyright © 2020-2023  润新知