When we are saving form bean ,What is the difference between session scope and request scope.

Showing Answers 1 - 19 of 19 Answers

sarvana kumar

  • Sep 27th, 2005
 

when the scope is request,

the values of form bean would be available for one the current request.

when the scope is session,

the values of form bean would be available throughout the session.

  Was this answer useful?  Yes

satyanarayana. jaddu

  • Sep 29th, 2005
 

if you are using request scope the ActionForm is available only until the end of the request/response cycle.one the response has been returned to the client the actionform and the data within it are no langer accessible.if u want to keep the form data around for langer than a sigle request your can fonfig an actonform to have session scope

  Was this answer useful?  Yes

Karthik

  • Oct 1st, 2005
 

The request scope retains the values in form bean until the request is completed.where as during the session scope the Form bean values are placed in session.and the session is maintained throughtout the action.

  Was this answer useful?  Yes

dilip iyer

  • Oct 23rd, 2005
 

sesion scope exists throutout the the session. i.e until the session expires(default 30 mins) or the users logs out. request scope dies once the page is loaded.

  Was this answer useful?  Yes

Manoj

  • Oct 26th, 2005
 

When a form bean is stored with request scope, the form bean will be available for this particular request only.But, if it is with in session scope, the form bean is availble to use till the user session is valid.

  Was this answer useful?  Yes

Shailesh

  • Nov 5th, 2005
 

Hi,

     If we specify scope="request" in the action entry of struts-config.xml then whenever the jsp page will be displayed its corresponsing formbeans' reset method will be called. If we specify scope="session"(or not specify b'coz default scope is session), then

formbeans' reset method will not be called.

  Was this answer useful?  Yes

Kumar Prabhakar

  • Nov 15th, 2005
 

Form Bean:  dedicated class for keeping all records after getting these from the corrosponding JSP Form.

Every JSP constitute One view in the application.

Difference between two actions( session and request). 

when we want to pass the attribute value from one view to another, we use request object to take care of this.

At the same time, to get some attribute value to be present throughtout the session, means from login till logout, we use session object to take care of this.

This is what, as i think, you want.

  Was this answer useful?  Yes

Girish

  • Nov 16th, 2005
 

session is for particular user where as request is for per hit

  Was this answer useful?  Yes

srk2027

  • Feb 28th, 2006
 

if you are using request scope the ActionForm is available only until the end of the request/response cycle.once the response has been returned to the client the actionform and the data within it are no longer accessible.if u want to keep the form data around for longer than a single request you can have actonform in session scopeby default the actionform is in session scope until unless u define scope as request the one practical scenario where i have come across is when we have checkbox or multibox in the view page then the actionform need to be set to request scope in order to get the correct values of the checkbox/multibox during multiple inserts.else i havn't come across any considerable difference, we can use session scope.

Rohit

  • Dec 11th, 2006
 

When you use a form with request scope...& if using struts validator the validation on form fails, then is the previously entered value are retained?

  Was this answer useful?  Yes

chandu

  • Aug 1st, 2007
 

Request scope is valid for one page to another page only.But Session scope valid for total application within period of a time.

  Was this answer useful?  Yes

When we want the action form to persist the values across the request, we set the action form to session scope.

For ex. When i submit the registration form with some errors in the form, then in the Action form fields validation throws errors in the JSP page and we want to retain the entered values so that the user feels less pain while resubmitting the page.

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions