File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes fowarded from servlet to jsp but in the browser it shows the servlet name??? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "fowarded from servlet to jsp but in the browser it shows the servlet name???" Watch "fowarded from servlet to jsp but in the browser it shows the servlet name???" New topic
Author

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

Ray Smilgius
Ranch Hand

Joined: Jan 29, 2001
Posts: 120
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).]


SCJO, SCJD, SCWCD, I-Net+, A+, Network+, MCSD, MCDBA, MCP, MCT
Mike Curwen
Ranch Hand

Joined: Feb 20, 2001
Posts: 3695

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).]
Kyle Brown
author
Ranch Hand

Joined: Aug 10, 2001
Posts: 3892
    
    5
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.


Kyle Brown, Author of Persistence in the Enterprise and Enterprise Java Programming with IBM Websphere, 2nd Edition
See my homepage at http://www.kyle-brown.com/ for other WebSphere information.
Ray Smilgius
Ranch Hand

Joined: Jan 29, 2001
Posts: 120
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).]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: fowarded from servlet to jsp but in the browser it shows the servlet name???