jsp添加新的servlet处理代码

来源:互联网 发布:人工智能的危害 编辑:程序博客网 时间:2024/06/15 21:49

   今天为了添加新的功能,修改了以前的jsp代码,添加了序列标注的功能,在前台处理中添加了lable.jsp文件,后台相应的处理程序为lableServlet.java,但是添加完后运行总是无法通过。找了很长时间的原因。后来请教同学才发现,新添加这种servlet的处理程序,需要修改web.xml配置文件。

   具体的修改方式为:在WebContent\WEB-INF路径下的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>LableServlet</servlet-name>    <servlet-class>myPackage.LableServlet</servlet-class>  </servlet><servlet-mapping>    <servlet-name>LableServlet</servlet-name>    <url-pattern>/LableServlet</url-pattern>  </servlet-mapping>

添加后刷新就可以解决问题


原创粉丝点击