aspose file tools
The moose likes JSP and the fly likes Empty URL redirection issue in jsp Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Java » JSP
Reply Bookmark "Empty URL redirection issue in jsp" Watch "Empty URL redirection issue in jsp" New topic
Author

Empty URL redirection issue in jsp

Ratheesh Kamoor
Greenhorn

Joined: Nov 27, 2008
Posts: 4
I need to redirect http://mywebsite.com/?bannerId=12332 to a specific jsp

For that I created a url pattern as
<servlet>
<servlet-name>lostdocsJSP</servlet-name>
<jsp-file>/index.jsp</jsp-file>
</servlet>
<servlet-mapping>
<servlet-name>lostdocsJSP</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>

It is redirecting above URL to index.jsp , but all other requests for images, swf, xml also getting redirected to this JSP , How can I avoid this issue in WAS 6.1
I know that in Tomcat I can define a default URL pattern to bypass any unwanted requests, but it is not working in Webshpere.

Tomacat :
<servlet-mapping>
<servlet-name>default</servlet-name>
<url-pattern>.jpg</url-pattern>
</servlet-mapping>
Arun Kumar
Ranch Hand

Joined: Oct 10, 2007
Posts: 30
you need to change url-pattern.
<url-pattern>/*</url-pattern> will forward all requests to jsp, change it accordingly.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 56529
    
  14

Of course if you tell it to send all requests to that JSP, it will!

What are you really trying to accomplish?


[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
Ratheesh Kamoor
Greenhorn

Joined: Nov 27, 2008
Posts: 4
If any one typed as http://mysite.com/?bannerId=1234 , then this request should go to index.jsp. I dont want any other request to go to index.jsp
How can I achieve that.
Duc Vo
Ranch Hand

Joined: Nov 20, 2008
Posts: 254
Originally posted by Ratheesh Kamoor:
If any one typed as http://mysite.com/?bannerId=1234 , then this request should go to index.jsp. I dont want any other request to go to index.jsp
How can I achieve that.


Just set the welcome page to index.jsp. It should work. Something likes


[ November 27, 2008: Message edited by: Duc Vo ]
[ November 27, 2008: Message edited by: Duc Vo ]

“Everything should be as simple as it is, but not simpler.” Albert Einstein
Ratheesh Kamoor
Greenhorn

Joined: Nov 27, 2008
Posts: 4
Thanks Duc Vo, I know that I can use welcome file . But when I use this option I am loosing query strings (Eg: bannerId = 123) when i read it from index.jsp.. What should I do to retain all query strings as it is ?
Duc Vo
Ranch Hand

Joined: Nov 20, 2008
Posts: 254
Originally posted by Ratheesh Kamoor:
Thanks Duc Vo, I know that I can use welcome file . But when I use this option I am loosing query strings (Eg: bannerId = 123) when i read it from index.jsp.. What should I do to retain all query strings as it is ?


Ah, you shouldn't use query string. Should use request.getParameter(). I.e.

String bannerId = request.getParameter("bannerId");

Then it should work.
[ November 27, 2008: Message edited by: Duc Vo ]
Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

Originally posted by Ratheesh Kamoor:
But when I use this option I am loosing query strings (Eg: bannerId = 123) when i read it from index.jsp.. What should I do to retain all query strings as it is ?


can you give some more details?

i guess , before index.jsp, you want to do some logic in servlet and then you want to pass the parameter to the index.jsp right? if yes,

then choose some particular servlet instead of /* .
Ratheesh Kamoor
Greenhorn

Joined: Nov 27, 2008
Posts: 4
Thanks, getProperty is working as expected
Thanks again
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Empty URL redirection issue in jsp
 
Similar Threads
need help: .jsp to .jspf mapping
Aliasing in tomcat for a jsp
welcome-file-list... A BUG?
Cannot find file..? Help
why no config in jspInit() method?