Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Adding servlet's to web.xml?

843841Nov 3 2005 — edited Nov 3 2005
Hello,

Could anyone advise how to add further servlets to the web.xml file? I added this first servlet and run the code through tomcat using:

http://localhost:8080/First

Though when I added a second serlvet to web.xml using the same approach as the first serlvet, the startup of tomcat seems to through several exceptions.

Could anyone demonstrate how to add further serlvets?

Thank you
<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE web-app
    PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
    "http://java.sun.com/dtd/web-app_2_3.dtd">

<web-app>
  <display-name>Welcome to Tomcat</display-name>
  <description>
     Welcome to Tomcat
  </description>

  <servlet>
    <servlet-name>firstServlet</servlet-name>
    <servlet-class>mycode.PrintLine</servlet-class>
  </servlet>
  <servlet-mapping>
    <servlet-name>firstServlet</servlet-name>
    <url-pattern>/First</url-pattern>
  </servlet-mapping>

</web-app>
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 1 2005
Added on Nov 3 2005
3 comments
125 views