Win a copy of Learning OpenStack Networking: Build a solid foundation in virtual networking technologies for OpenStack-based clouds this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

Empty URL redirection issue in jsp  RSS feed

 
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>
 
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.
 
Author and ninkuma
Marshal
Posts: 66797
168
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.
 
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 ]
 
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
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!