zoukankan      html  css  js  c++  java
  • 在MyEclipse中怎么修改Servlet模板

    原Servlet模板实例

    package www.csdn.net.servlet;
    
    import java.io.IOException;
    import java.io.PrintWriter;
    
    import javax.servlet.ServletException;
    import javax.servlet.http.HttpServlet;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    
    public class First extends HttpServlet {
    
    	/**
    	 * Constructor of the object.
    	 */
    	public First() {
    		super();
    	}
    
    	/**
    	 * Destruction of the servlet. <br>
    	 */
    	public void destroy() {
    		super.destroy(); // Just puts "destroy" string in log
    		// Put your code here
    	}
    
    	/**
    	 * The doGet method of the servlet. <br>
    	 *
    	 * This method is called when a form has its tag value method equals to get.
    	 * 
    	 * @param request the request send by the client to the server
    	 * @param response the response send by the server to the client
    	 * @throws ServletException if an error occurred
    	 * @throws IOException if an error occurred
    	 */
    	public void doGet(HttpServletRequest request, HttpServletResponse response)
    			throws ServletException, IOException {
    
    		response.setContentType("text/html");
    		PrintWriter out = response.getWriter();
    		out.println("<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">");
    		out.println("<HTML>");
    		out.println("  <HEAD><TITLE>A Servlet</TITLE></HEAD>");
    		out.println("  <BODY>");
    		out.print("    This is ");
    		out.print(this.getClass());
    		out.println(", using the GET method");
    		out.println("  </BODY>");
    		out.println("</HTML>");
    		out.flush();
    		out.close();
    	}
    
    	/**
    	 * The doPost method of the servlet. <br>
    	 *
    	 * This method is called when a form has its tag value method equals to post.
    	 * 
    	 * @param request the request send by the client to the server
    	 * @param response the response send by the server to the client
    	 * @throws ServletException if an error occurred
    	 * @throws IOException if an error occurred
    	 */
    	public void doPost(HttpServletRequest request, HttpServletResponse response)
    			throws ServletException, IOException {
    
    		response.setContentType("text/html");
    		PrintWriter out = response.getWriter();
    		out.println("<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">");
    		out.println("<HTML>");
    		out.println("  <HEAD><TITLE>A Servlet</TITLE></HEAD>");
    		out.println("  <BODY>");
    		out.print("    This is ");
    		out.print(this.getClass());
    		out.println(", using the POST method");
    		out.println("  </BODY>");
    		out.println("</HTML>");
    		out.flush();
    		out.close();
    	}
    
    	/**
    	 * Initialization of the servlet. <br>
    	 *
    	 * @throws ServletException if an error occurs
    	 */
    	public void init() throws ServletException {
    		// Put your code here
    	}
    
    }
    


     

    怎样在建Servlet时去掉所有的注释:

    先找到MyEclipse安装到哪

    (1)右击MyEclipse

    (2)复制目标(T)的路径,然后粘在计算机路径下进行搜索

    (3)点击plugins文件

    (4)搜寻这个文件

    (5)打开文件找模版templates在template下再找servlet.java

    (6)打开servlet.java在里面删除所有的注解

    (7)在重新启动工具MyEclipse(注),在建一个新的servlet文件

  • 相关阅读:
    Visual C++6.0 调用Visual Basic 6.0写的Microsoft Communications Control(ActiveX)的使用疑难及解决办法
    Associating Icons with a Category 与 恶作剧软件 有关系吗?
    WPF/Silverlight Button Styles and Templates
    Notepad++ 备忘录一
    冥思苦想,木疙瘩也能崩出个豆:扯一下各大软件的用户体验
    生活小窍门。
    Bug验证:.Net 4 下,貌似发现一个bug。如果是真,.Net组的员工该打屁股。
    两台硬件和软件配置完全相同的机器A和B,现在要用系统自带的Copy功能把A上的一个文件,复制到B上。在哪台机器上执行程序,效率更高?
    WPF 遍历 DataGrid 每行的控件
    IE ActiveX Control 和RIA
  • 原文地址:https://www.cnblogs.com/riskyer/p/3398180.html
Copyright © 2011-2022 走看看