1.在myeclipse新建一个webproject.项目名称为MyServlet
2.在项目点击右键,新建一个servlet.根据向导,servlet名字为HelloServlet.
3.则向导在web.xml中生成
<servlet>
<description>This is the description of my J2EE component</description>
<display-name>This is the display name of my J2EE component</display-name>
<servlet-name>HelloServlet</servlet-name>
<servlet-class>com.dist.test.HelloServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>HelloServlet</servlet-name>
<url-pattern>/servlet/HelloServlet</url-pattern>
</servlet-mapping>
4.在myeclipse中的service的tab页面,debug启动myEclipsetomcat.
5.在浏览器输入http://localhost:8080/MyServlet/servlet/HelloServlet则出现This is class com.dist.test.HelloServlet, using the GETmethod
注意http://localhost:8080在myEclipsetomcat.中是空白页面.和单独启动tomcat是不同的
2.在项目点击右键,新建一个servlet.根据向导,servlet名字为HelloServlet.
3.则向导在web.xml中生成
<servlet>
<description>This is the description of my J2EE component</description>
<display-name>This is the display name of my J2EE component</display-name>
<servlet-name>HelloServlet</servlet-name>
<servlet-class>com.dist.test.HelloServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>HelloServlet</servlet-name>
<url-pattern>/servlet/HelloServlet</url-pattern>
</servlet-mapping>
4.在myeclipse中的service的tab页面,debug启动myEclipsetomcat.
5.在浏览器输入http://localhost:8080/MyServlet/servlet/HelloServlet则出现This is class com.dist.test.HelloServlet, using the GETmethod
注意http://localhost:8080在myEclipsetomcat.中是空白页面.和单独启动tomcat是不同的