scope refers to the scope of the form bean not the action. Actions are Singletons and live as long as your app is running.

David



From: "Chai Ang" <[EMAIL PROTECTED]>
Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Subject: Scope and Action objects (struts 1.1)
Date: Thu, 27 Mar 2003 14:40:45 +1100

Hi there all,
I looked through the numerous queries in the archives
but couldnt find anything that answered my question.

If I have an action class, with a class member "count"
eg
public class QueryAction extends Action {
    private int count = 0;
    etc...
}

and in the execute() function I increment count by 1;

in my struts-config.xml

<action  path="/query"
         parameter="/WEB-INF/jsp/myform.jsp"
         type="web.QueryAction"
         scope="request"
         validate="false"
         name="queryForm">
   <forward name="success" path="/WEB-INF/jsp/myform.jsp"/>
   <forward name="failure" path="/WEB-INF/jsp/myform.jsp"/>
</action>

On requests to http://localhost:8080/query, on printing
out "count" in the execute() function in the Action,
I get the value 0 and 1, 2, 3 etc.. on subsequent request.

I thought by having scope="request" the value of
count would be 0?
Is this right?

Would there be some other source code location where one
needs specify the scope?

My jsp form header looks like this
<html:form action="query">
etc..
</html:form>

I noticed the scope attribute had been deprecated in the API.

Thanks in advance,
Chai
######################################################################
Attention:

The information in this electronic mail is privileged and
confidential, intended only for use of the individual or entity named.
If you are not the intended recipient, any dissemination, copying or
use of the information is strictly prohibited.  If you have received
this transmission in error, please delete it immediately from your
system and inform us via mailto [EMAIL PROTECTED]

This e-mail has been scanned and cleared by MailMarshal
######################################################################

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



_________________________________________________________________
The new MSN 8: advanced junk mail protection and 2 months FREE* http://join.msn.com/?page=features/junkmail



--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to