Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

how to save data from vanishing during page navigation?  RSS feed

 
jacob deiter
Ranch Hand
Posts: 585
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a JSP(A),enter some data in the page A and navigate to another page B(JSP),here I enter some data and again navigate to page A. Now ,I want Page A to have the previously entered data and I take the from data from page B and put into page A

As per my understanding If navigate to page B then data in page A destroyed, as well if I come to page A from Page B then Data entered in page B also destroyed.

How I save my data from vanishing?.

Please suggest good idea .
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65830
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Use the value attributes on the form elements to pre-populate the data.
 
meehul Chopra
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
jacob deiter wrote:I have a JSP(A),enter some data in the page A and navigate to another page B(JSP),here I enter some data and again navigate to page A. Now ,I want Page A to have the previously entered data and I take the from data from page B and put into page A

As per my understanding If navigate to page B then data in page A destroyed, as well if I come to page A from Page B then Data entered in page B also destroyed.

How I save my data from vanishing?.

Please suggest good idea .

hi jacob,

Can you elaborate more on the word navigating....
do you mean a <jsp:forward..> or a simple hyperlink
 
jacob deiter
Ranch Hand
Posts: 585
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I meant jsp forward.But I can't get the difference between both.When clicked on hyperlink then a new URL is sent to server???.I hope JSP forward also do the same!!!
 
meehul Chopra
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
jacob deiter wrote:I meant jsp forward.But I can't get the difference between both.When clicked on hyperlink then a new URL is sent to server???.I hope JSP forward also do the same!!!

hi jacob,

<jsp:forward..> works in the same way as a RequestDispatcher does,,that is all the forwarding happens at the server side.
So in your example you can always make use of attributes to save data for that request.

A hyperlink always generates a Get request.
 
jacob deiter
Ranch Hand
Posts: 585
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI

Thanks for your reply.


do you mean a <jsp:forward..> or a simple hyperlink


Could you please explain the difference because I knew What it is but cant differentiate very clearly
 
Bageshwar Pratap Narain
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Could you please explain the difference because I knew What it is but cant differentiate very clearly


A hyperlink, sends a new request to the web server, but with a jsp:forward, the request is internally forwarded by the container. All the request parameters, and attributes remain intact during this process and ,and the page to which the jsp:forward is pointing can use these values.

With a plain hyperlink, only the session attributes, and form data is accessible, to the host jsp/servlet
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!