You need to put the count var in your actionForm, and increment it in your
action class. But if you put the actionform in request, the increment has no
effect.

The action instance itself  is cached by struts.

-D
----- Original Message -----
From: "Chai Ang" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, March 26, 2003 7:40 PM
Subject: Scope and Action objects (struts 1.1)


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]


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

Reply via email to