I want to move data from one page to another page. I have two ways..
1. Using session object
2. Using hidden form field
Tell me which one is more useful and best ?
------------------
suresh
Printable View
I want to move data from one page to another page. I have two ways..
1. Using session object
2. Using hidden form field
Tell me which one is more useful and best ?
------------------
suresh
there are four (and not two) techniques
1)hidden form
2)cookies
3)httpsession
4)urlrewriting
best is to use httpsession.
since hiddenform increases the complexity of code.
cookies are not secure and can b disabled by client
so go with sessions
Sessions r the best
To share the data in jsp from one page to another page,you can use any two technique from below-
(1) request object.
(2) session object.
both object have setAttribute(String name,Object value) and an Object getAttribute(String name) method.
Session r best.. it is secure.. and also no limits..
Depends on the amount of data you are transferring. If data is limited to couple of attributes than session would be perfect, but if amount of data is too much then session would create overhead and in that case hidden fields should be used.
hidden form servlet is used for small uesr interface with data ,internally at the last page all the fields are available so if u want to send any data from one servlet to any of the servlet session is the best choice i think.
if control is not redirecting from one jsp to another jsp storing to request attribute is useless, but if we store it into session variable it can be retrieved in any of the cases.