jQuery in Action, 3rd edition
The moose likes Struts and the fly likes What is the purpose of scope attribute? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "What is the purpose of scope attribute?" Watch "What is the purpose of scope attribute?" New topic

What is the purpose of scope attribute?

S Thanigaivel
Ranch Hand

Joined: Oct 06, 2005
Posts: 60

what is the purpose of scope attribute of action tag?

when scope is assigned request then the scope of form bean object is for that particular request alone. (if i am right)

what would be the scope of the form bean object if scope is session or application?

what does session and application mean in this context?

Thanigaivel S.
vijay saraf
Ranch Hand

Joined: Jan 08, 2005
Posts: 141
The default scope is request,
when you set the scope as session then bean is available till session live.
if you you havn't set life time of session then untill you close your browser, bean is available.
while in case of application,bean is avaibale till application is running,irrespective of session it is avaible to all.

Vijay Saraf.
Brent Sterling
Ranch Hand

Joined: Feb 08, 2006
Posts: 948
  • I am pretty sure that the only two values that you can set on your action mapping are "request" and "session".
  • The default is "session"
  • You seem to understand "request" scope
  • With "session" scope an instance of the form will be created when needed and stored in the session. This same instance will be reused between actions that use the same form name.

  • - Brent
    I agree. Here's the link: http://aspose.com/file-tools
    subject: What is the purpose of scope attribute?
    It's not a secret anymore!