0

I have a page http://domain.com/servlets/projecta?action=cust_active

but need to provide a link to the same place with an extension (like .jsp or something).

Is there a way to add an extension to this, but have it still load the same way?

Sandeep Chatterjee
  • 3,220
  • 9
  • 31
  • 47
NCoder
  • 325
  • 3
  • 10
  • 25

1 Answers1

2

You would need multiple URL mappings for your servlet in web.xml. Assuming that your existing servlet is mapped to projecta like this:

  <servlet-mapping>
    <servlet-name>servlet</servlet-name>
    <url-pattern>/projecta</url-pattern>
  </servlet-mapping>

You might need:

  <servlet-mapping>
    <servlet-name>servlet</servlet-name>
    <url-pattern>/projecta</url-pattern>
    <url-pattern>/projecta.ext</url-pattern>
  </servlet-mapping>

Also see this in case your servlet version is different: many url-pattern for the same servlet

Community
  • 1
  • 1
Akber Choudhry
  • 1,755
  • 16
  • 24