Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Servlet mapping

Reply
Thread Tools

Servlet mapping

 
 
francan00@yahoo.com
Guest
Posts: n/a
 
      12-12-2007
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>
 
Reply With Quote
 
 
 
 
Lew
Guest
Posts: n/a
 
      12-12-2007
http://www.velocityreviews.com/forums/(E-Mail Removed) wrote:
> 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>

--
Lew
 
Reply With Quote
 
 
 
 
Owen Jacobson
Guest
Posts: n/a
 
      12-12-2007
On Dec 11, 8:31 pm, Lew <(E-Mail Removed)> wrote:
> (E-Mail Removed) wrote:
> > 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.


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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Servlet question(Tomcat, web.xml, servlet-class, servlet-name) circuit_breaker Java 2 04-04-2004 03:26 AM
simple servlet-mapping question Troy Makaro Java 0 08-27-2003 07:20 PM
Servlet Mapping - What's the point? Fran Cotton Java 3 08-08-2003 08:28 AM
Servlet URL Mapping Evil! Fran Cotton Java 0 07-25-2003 03:41 PM
problems with servlet-mapping url-pattern lbrtchx Albretch Java 2 07-11-2003 08:19 PM



Advertisments