Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Don't want full path displayed in browser's address bar

Status
Not open for further replies.

roopan27

Programmer
Feb 17, 2004
8
US
use a jsp:forward instead of a redirect. this will keep the current page's address in the browser URL, but send the login page. so you would appear to still be on the index page.

<marc> i wonder what will happen if i press this...[ul][li]please tell us if our suggestion has helped[/li][li]need some help? faq581-3339[/li][/ul]
 
I tried what you said but my login page is displayed without images and stylesheets.
My index.jsp is as follows:
<html>
<jsp:forward page="\jsp\pgms_login.jsp" />
</html>

My directory structure is:
PGMS
Inside PGMS there is:
jsp
WEB-INF
Inside jsp there is:
images
css
and all the jsp program files and I have used relative path for the images in my programs.
 
The easiest way is to not have your jsp pages in a "jsp" directory. Failing that, I think you can map JSP resource url patterns to resource directorys via web.xml in the same way that you map servlets to url patterns.

Read the documentation and web.xml dtd for hints as to do this ...
 
when you use jsp:forward, the forwarded page appears to all intents and purposes as the original page.
[ignore]
so if your initial page is: but that forwards to a login page on: your browser still thinks it's looking at: forums/chat/index.html.
[/ignore]
to fix: reference everything on the login page absoutely:
<link rel="stylesheet" href="/style.css" />
<img src="/images/pic.jpg" />

<marc> i wonder what will happen if i press this...[ul][li]please tell us if our suggestion has helped[/li][li]need some help? faq581-3339[/li][/ul]
 
Or use the html tag <base href="bla.bla.bla">
 
I tried the solutions u guys suggested and it is working.
Jsp:forward works fine.But when in the login page I have a form and in action I have to give full path of next page.So after that again it starts showing the full path.I could not use jsp:forward there.
Doesn't Tomcat have any way in which an alias could be set and only that is dispayed in address bar?(like in iplanet).
 
You could put apache in front of tomcat and use mod_jk to push queries back to it.

Then use apache rewrite to manage your urls.

Thats what I do. Let tomcat do what tomcat is good at and let apache do what apache is good at.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top