This week's book giveaway is in the Jython/Python forum.
We're giving away four copies of Murach's Python Programming and have Michael Urban and Joel Murach on-line!
See this thread for details.
Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Empty URL redirection issue in jsp  RSS feed

 
Ratheesh Kamoor
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 65830
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Of course if you tell it to send all requests to that JSP, it will!

What are you really trying to accomplish?
 
Ratheesh Kamoor
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 254
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
Ratheesh Kamoor
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 254
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks, getProperty is working as expected
Thanks again
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!