• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

fowarded from servlet to jsp but in the browser it shows the servlet name???

 
Ranch Hand
Posts: 120
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
for example I have as my index page in the browser
http://rsmilgius/FortKnox/index.jsp
but when I hit the servlet I foward
getServletContext().getRequestDispatcher("/success.jsp").forward(req,res);
It reveals the success.jsp but with the package.servletname in the browser not the jsp file
I get http://rsmilgius/FortKnox/servlet/IRA_Servlets.pleasework
I need to show
http://rsmilgius/FortKnox/index.jsp
dont want to redirect because I need to pass parameters on to the success.jsp
I understand that when you foward the original address stays in the browser not in my case.
Thanks in advance Ray

------------------
Sun Certified Java Programmer
Sun Certified Java Developer
I-Net Certified
A+ Certified
Network+ Certified
MCP
[This message has been edited by Ray Smilgius (edited November 30, 2001).]
 
Ranch Hand
Posts: 3695
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Redirect is the only way to get the browser's address bar to change.

Why not send the parameters into the redirect?


If your parameters are not static, just build up the re-direct string.
[This message has been edited by Mike Curwen (edited November 29, 2001).]
 
author
Posts: 3892
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please note -- it's often a lot faster to do a forward() than a redirect -- a redirect involves crossing the network one additional time.
Why in particular do you want the URL to change?
Kyle
------------------
Kyle Brown,
Author of Enterprise Java (tm) Programming with IBM Websphere
See my homepage at http://members.aol.com/kgb1001001 for other WebSphere information.
 
Ray Smilgius
Ranch Hand
Posts: 120
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
One of the problems is that when I go back to my index page which is the login page in the event the user inputs a wrong password etc...I foward back to the login page then it cant display the graphics nor the java script objects are not intialized. Also, when I am at index.jsp and I foward back to index.jsp I see not the original http://..../index.jsp, but I see

http://.../servlets/package.pleasework in the browser I understood a foward to keep the original position in the browser.
such as http://..../index.jsp this is where I start and if I foward back to the page I get a new browser address and also my gifs and javascript objects are not initialized.
The reason to wanting to change the address because the current way this is working is exposing my servlet in the browser not the index.jsp. Any page I foward too, I see the changed address in my browser which reveals package.servletname always.

Thaks
Thanks Ray Smilgius
------------------
Sun Certified Java Programmer
Sun Certified Java Developer
I-Net Certified
A+ Certified
Network+ Certified
MCP
[This message has been edited by Ray Smilgius (edited November 30, 2001).]
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic