aspose file tools*
The moose likes Servlets and the fly likes jsp:forward page= Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "jsp:forward page="/" Watch "jsp:forward page="/" New topic
Author

jsp:forward page="/

Randall Twede
Ranch Hand

Joined: Oct 21, 2000
Posts: 4347
    
    2

<jsp:forward page="/
how do I use that inside scriptlet?

with the posted code the page is not there when back is clicked in browser. will forward make it be in history?
hmm maybe like this?


[This message has been edited by Randall Twede (edited April 23, 2001).]


SCJP
Visit my download page
Phil Hanna
Ranch Hand

Joined: Apr 05, 2001
Posts: 118
<jsp:forward> and sendRedirect perform a similar task but they are fundamentally different in how they do it.
sendRedirect completes the current request by sending a 302 (moved temporarily) or 301 (moved permanently) response to the client, along with a Location: header that specifies the next page for the client to load. The servlet engine and web server have nothing further to do with the request - it's up to the client (browser) to respond, which it normally does without user intervention.
jsp:forward handles all of this internally without going back to the client. The output of the second page is what is sent back. Usually the client is not aware that a forward has happened.
------------------
Phil Hanna
Author of :
JSP: The Complete Reference
Instant Java Servlets


Phil Hanna<BR>Sun Certified Programmer for the Java 2 Platform<BR>Author of :<BR><A HREF="http://www.amazon.com/exec/obidos/ASIN/0072127686/electricporkchop/107-3548162-1137317" TARGET=_blank rel="nofollow">JSP: The Complete Reference</A><BR><A HREF="http://www.amazon.com/exec/obidos/ASIN/0072124253/electricporkchop/107-3548162-1137317" TARGET=_blank rel="nofollow">Instant Java Servlets</A>
Randall Twede
Ranch Hand

Joined: Oct 21, 2000
Posts: 4347
    
    2

So is the only way to have the JSP page be in history when back is clicked to use a form or link? I dont want the page displayed the first time but want it to be there if back is pressed.
Paul Ramsden
Greenhorn

Joined: Sep 22, 2000
Posts: 28
Phil,
Is it possible to suppress form information (?key=value&key=value) when using forword? I always seem to get this information apprearing in the URL field of the browser following a forward.
How should I choose whether to use redirect or forward?
Thanks

------------------
vaibhav punekar
Ranch Hand

Joined: Jan 20, 2001
Posts: 134
Hi,
Randall,
If you make all the fields of the form "hidden" then it will not be visible while in forward progress but when you click back you can use javascript to make it visible.I do not know how to do it.But javascript must be doing this.Is either of the sendredirect or jsp:forward not working for you?I think my friend has done similar stuff using "javascript".


VAIBHAV <BR>SCJP
Phil Hanna
Ranch Hand

Joined: Apr 05, 2001
Posts: 118
Paul, you get the form information (?key=value&key=value) because your form is using METHOD=GET, either explicitly, or more likely because it is the default. Change it to METHOD=POST and the key/value pairs will not appear in the URL.
------------------
Phil Hanna
Author of :
JSP: The Complete Reference
Instant Java Servlets
Randall Twede
Ranch Hand

Joined: Oct 21, 2000
Posts: 4347
    
    2

I originally tried using javascript in the page before this one. I couldnt get it to replace itself and call the servlet. There should be some way to do this. here is whole page.
Randall Twede
Ranch Hand

Joined: Oct 21, 2000
Posts: 4347
    
    2

I suppose I could open a URLConnection. I think maybe thats what I'm looking for.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: jsp:forward page="/