• 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

problem: jsp:forword page="../../web/abc.jsp"

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I can only switch the pages within the same folder but the pages at another folder.
I tried to switch page to website such as "www.yahoo.com" it works. I panic now.
Do you know what could cause this situation? Please help me.
 
author
Posts: 3252
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by zystation:
I tried to switch page to website such as "www.yahoo.com" it works. I panic now.


Calm down now. Everything's fine
Please realise that a forward is an indication to the servlet engine that another servlet (jsp) should take over processing the request. You can only forward to different place within the same web-application! Forwarding to yahoo would mean that the browser sends its request to you and then gets its response from yahoo. That is simply impossible - TCP/IP doesn't work that way.
There is a solution, of course. The server can send a response to the browser which basically says "please look here for this information". This is a "temporary redirect" response, and you can generate it using <% response.sendRedirect("http://www.yahoo.com"); %>.
- Peter
 
zystation
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"login.jsp" is in 'login' folder, once user confirms the entry the page automatic switch to "loginValidate.jsp" in 'login' folder. if user info incorrect, it goes back to "login.jsp", it works fine. Whereas it should go to "abc.jsp" that in 'web' folder. However, it doesn't go through to "abc.jsp". WHY?
 
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
i'm not entirely clear on how it works with the jsp:forward tag, but when I program servlets I get a requestdispatcher object, and the path to the file always starts with "/". And this is the web root. So if your site is like
< webroot >/login
< webroot >/web

Then all you'd need is "/web/abc.jsp"

I think the key is not to use relative paths (no ..) but to use absolute paths from the web root.
[This message has been edited by Mike Curwen (edited May 04, 2001).]
 
zystation
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you, Peter and Mike, I use absolute paths and it works.
 
Ranch Hand
Posts: 149
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
zystation,
The javaranch has a naming policy and your login name does not meet the requirement.
Please signup again with a proper name.
Thanks..
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic