修改MyEclipse默认生成的Servlet以及JSP页面
1 #---------------------------------------------#
2 # <aw:description>Template for Servlet</aw:description>
3 # <aw:version>1.1</aw:version>
4 # <aw:date>04/05/2003</aw:date>
5 # <aw:author>Ferret Renaud</aw:author>
6 #---------------------------------------------#
7
8 <aw:import></aw:import>
9 <aw:import></aw:import>
10
11 <aw:import></aw:import>
12 <aw:import></aw:import>
13 <aw:import></aw:import>
14 <aw:import></aw:import>
15
16 <aw:parentClass></aw:parentClass>
17
18 <aw:constructor name="c1">
19 /**
20 * Constructor of the object.
21 */
22 public <aw:className/>() {
23 super();
24 }
25
26 </aw:constructor>
27
28 <aw:method name="doGet">
29 /**
30 * The doGet method of the servlet. <br>
31 *
32 * This method is called when a form has its tag value method equals to get.
33 *
34 * @param request the request send by the client to the server
35 * @param response the response send by the server to the client
36 * @throws ServletException if an error occurred
37 * @throws IOException if an error occurred
38 */
39 public void doGet(HttpServletRequest request, HttpServletResponse response)
40 throws ServletException, IOException {
41
42 ("text/html");
43 PrintWriter out = ();
44 (
45 "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">");
46 ("<HTML>");
47 (" <HEAD><TITLE>A Servlet</TITLE></HEAD>");
48 (" <BODY>");
49 (" This is ");
50 (this.getClass());
51 (", using the GET method");
52 (" </BODY>");
53 ("</HTML>");
54 ();
55 ();
56 }
57
58 </aw:method>
59
60 <aw:method name="doPost">
61 /**
62 * The doPost method of the servlet. <br>
63 *
64 * This method is called when a form has its tag value method equals to post.
65 *
66 * @param request the request send by the client to the server
67 * @param response the response send by the server to the client
68 * @throws ServletException if an error occurred
69 * @throws IOException if an error occurred
70 */
71 public void doPost(HttpServletRequest request, HttpServletResponse response)
72 throws ServletException, IOException {
73
74 ("text/html");
75 PrintWriter out = ();
76 (
77 "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">");
78 ("<HTML>");
79 (" <HEAD><TITLE>A Servlet</TITLE></HEAD>");
80 (" <BODY>");
81 (" This is ");
82 (this.getClass());
83 (", using the POST method");
84 (" </BODY>");
85 ("</HTML>");
86 ();
87 ();
88 }
89
90 </aw:method>
91
92 <aw:method name="doPut">
93 /**
94 * The doPut method of the servlet. <br>
95 *
96 * This method is called when a HTTP put request is received.
97 *
98 * @param request the request send by the client to the server
99 * @param response the response send by the server to the client
100 * @throws ServletException if an error occurred
101 * @throws IOException if an error occurred
102 */
103 public void doPut(HttpServletRequest request, HttpServletResponse response)
104 throws ServletException, IOException {
105
106 // Put your code here
107 }
108
109 </aw:method>
110
111 <aw:method name="doDelete">
112 /**
113 * The doDelete method of the servlet. <br>
114 *
115 * This method is called when a HTTP delete request is received.
116 *
117 * @param request the request send by the client to the server
118 * @param response the response send by the server to the client
119 * @throws ServletException if an error occurred
120 * @throws IOException if an error occurred
121 */
122 public void doDelete(HttpServletRequest request, HttpServletResponse response)
123 throws ServletException, IOException {
124
125 // Put your code here
126 }
127
128 </aw:method>
129
130 <aw:method name="init">
131 /**
132 * Initialization of the servlet. <br>
133 *
134 * @throws ServletException if an error occurs
135 */
136 public void init() throws ServletException {
137 // Put your code here
138 }
139
140 </aw:method>
141
142 <aw:method name="destroy">
143 /**
144 * Destruction of the servlet. <br>
145 */
146 public void destroy() {
147 super.destroy(); // Just puts "destroy" string in log
148 // Put your code here
149 }
150
151 </aw:method>
152
153 <aw:method name="getServletInfo">
154 /**
155 * Returns information about the servlet, such as
156 * author, version, and copyright.
157 *
158 * @return String information about this servlet
159 */
160 public String getServletInfo() {
161 return "This is my default servlet created by Eclipse";
162 }
163
164 </aw:method>