1.代码:
2.因为要使用到javaee的东西,所以要把servlet-aip.jar包添加到classpath:
向classpath添加:%CATALINA_HOME%/lib/servlet-api.jar
3.配置web.xml,设置url映射
<servlet>
<servlet-name>firstservlet</servlet-name>
<servlet-class>cn.qinsys.firstservlet.firstservlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>firstservlet</servlet-name>
<url-pattern>/firstservlet</url-pattern>
</servlet-mapping>
原创文章,作者:bd101bd101,如若转载,请注明出处:https://blog.ytso.com/276424.html