Question

I have an existing servlet that has a form and takes in data and executes correctly. We've been given a new requirement to add a page that will allow the user to modify some of the values in the servlet properties file via a web form.

I've developed the package to do this. I'm looking for a way to add the page and package to the existing servlet. I would rather not create a separate servlet on Tomcat for this.

I know how to create new html pages in the existing servlet, but I'm unsure how to execute this class file without making it a standalone servlet.

Any help is appreciated.

Was it helpful?

Solution

I solved my problem. It seems I just needed to add the additional servlet to my web.xml. Resolved.

<servlet>
    <description></description>
    <display-name>Servlet1</display-name>
    <servlet-name>Servlet1</servlet-name>
    <servlet-class>com.mycompany.Servlet1</servlet-class>
  </servlet>
  <servlet-mapping>
    <servlet-name>ExporterServlet</servlet-name>
    <url-pattern>/ExporterServlet</url-pattern>
  </servlet-mapping>  
  <servlet>
    <description></description>
    <display-name>Servlet2</display-name>
    <servlet-name>Servlet2</servlet-name>
    <servlet-class>com.mycompany.Servlet2</servlet-class>
  </servlet>
  <servlet-mapping>
    <servlet-name>Servlet2</servlet-name>
    <url-pattern>/Servlet2</url-pattern>
  </servlet-mapping>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top