| Author |
Servlet mapping
|
Ed Carrington
Ranch Hand
Joined: Oct 11, 2007
Posts: 77
|
|
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:
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56204
|
|
|
Ummm, why do you have a query string on the servlet name?
|
[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
|
 |
Raghu ram
Ranch Hand
Joined: Oct 19, 2007
Posts: 34
|
|
This didnt work: code: -------------------------------------------------------------------------------- <servlet> <servlet-name>DataMatch</servlet-name> <-- 1 <servlet-class>Data</servlet-class> </servlet> <servlet-mapping> <servlet-name>DataMatch</servlet-name> <-- 2 <url-pattern>/mynewname</url-pattern> </servlet-mapping> Name of servlet class not be same as name of servlet name and the lines 1 and 2 should be same.
|
 |
Ed Carrington
Ranch Hand
Joined: Oct 11, 2007
Posts: 77
|
|
Ummm, why do you have a query string on the servlet name?
The Data servlet actually has a request dispatcher that forwards the info with parameters from the servlet to a JSP. The url though shows as a servlet even though I am presenting the info on a JSP. I assume the request dispatcher is doing that where it keeps the servlet name in the url even though I am forwarding and showing a JSP? [ December 12, 2007: Message edited by: Ed Carrington ]
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56204
|
|
|
Yes, but why do you have a query string on the servlet name?
|
 |
Ed Carrington
Ranch Hand
Joined: Oct 11, 2007
Posts: 77
|
|
I assumed my Servlet took the query parameters that was stored in the Servlet and passed them as a query string into the JSP url and I thought that was normal. Be back tomorrow to give you more details when I get access to it in the morning. [ December 12, 2007: Message edited by: Ed Carrington ]
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56204
|
|
No, you cannot specify a query string in the mapping. The way that you pass data from a servlet to a forwarded JSP is via scoped variables, usually placed on the request.
|
 |
 |
|
|
subject: Servlet mapping
|
|
|