Servlet mapping

L

Lew

I have a page url like this:
http://servername:8080/test/Data?abc=2&cwe=n

Data is a servlet.

Anyway to map this in web.xml so I can change the name to:
http://servername:8080/test/mynewname

This didnt work:

<servlet>
<servlet-name>Data</servlet-name>
<servlet-class>Data</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>Data?abc=2&cwe=n</servlet-name>
<url-pattern>/mynewname</url-pattern>
</servlet-mapping>

You cannot put parameters in a servlet mapping.

You can say

<servlet-mapping>
<servlet-name>Data</servlet-name>
<url-pattern>/mynewname</url-pattern>
</servlet-mapping>
 
O

Owen Jacobson

You cannot put parameters in a servlet mapping.

But you might put either another servlet in front (to generate the
appropriate parameters), add a request filter (likewise), or put
apache in front and use mod_rewrite to change one URL to the other
before your servlet container sees it.

-o
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,481
Members
44,900
Latest member
Nell636132

Latest Threads

Top