[Logo]
Forums Register Login
jsp:forward page="/
<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).]
<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
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.
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

------------------
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".
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
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.
I suppose I could open a URLConnection. I think maybe thats what I'm looking for.

This thread has been viewed 1464 times.

All times above are in ranch (not your local) time.
The current ranch time is
Oct 18, 2018 05:03:10.