How many values available for "scope" attribute in "action" element of
struts-config.xml
file other than "request" and "session"?
<action name="loginform" path="/bkplogin" scope="?" type="org.springframework.web.struts.DelegatingActionProxy">
There are only two possible values for the scope attribute: request and session as stated in the struts-config’s DTD:
<!--
The name of a JSP bean scope within which such a form bean may be accessed.
-->
<!ENTITY % RequestScope "(request|session)">
...
...
<!ATTLIST action scope %RequestScope; #IMPLIED>
See the DTD here:
http://struts.apache.org/dtds/struts-config_1_3.dtd
or a more human readable documentation of the DTD here:
http://struts.apache.org/1.x/struts-core/dtddoc/struts-config_1_3.dtd#action
What about the "Application" and "page" ?
Well, the scope of an object across JSP pages can be:
Now, the scope in struts-config refers to where to create/find ActionForm objects. An ActionForm represents the server object representation of a client HTML form.
It does not make any sense to have the form with application scope because it will be one form for everybody which which I can't even think at what that will be useful. So no application value for that field.
Now imagine you have page scope. How will that work? Struts does a RequestDispatcher.forward/redirect to go to the JSP files, how is it going to save the ActionForm in the page scope of the page that still does not have a page scope since it does not yet have control?! Is just like sending values to a method but instead of sending method arguments you are trying to directly create local variables in the code of the method from outside the method.
So there are only two values that make sense: request and session. If you want something extra you have to manage it yourself.
Struts is a generic framework, it does not cover every imaginable or unimaginable case, it covers most of normal use case scenarios for which request and session is all you will ever need.