What does the scope attribute from the action tag of the struts-config file mean?

java, scope, struts, struts-1, struts-config

Solution

The attribute `scope` is used to define the scope (life of the object, the form) of the object action form that used in that action configuration.

There's also different scopes, `page`, `request`, `session`, `application`. That's all from servlet specs. If you specify the scope of request that you want the form object is available during servlet http request.

You can check this reference to determine how to use scopes.

There's also link to action mapping configuration.

Problem

I'm working on a Struts application. In order to edit the `struts-config.xml` file, I think I have to add an attribute - `scope`, in the action tag. I'm not sure about its meaning, or its usage. ``` <action path="/WetsVpnSwapTraffic" type="com.kpn.bop.web.action.vpn.wets.WetsVpnSwapTraffic" scope="request" name="WetsVpnSwapTrafficForm" roles="bop_wetsvpn_migrate" validate="false"> <forward name="success" path="/WetsVpnSwapTrafficValidate.do"/> <forward name="failure" path="/WetsVpnList.do"/> </action> ``` Can anyone explain me if I have to put this attribute?

Original source