You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Christian Burger <Ch...@puma.com> on 2004/03/08 10:24:26 UTC

Re: [RMX:##] Own Action-Subclass: How to configure using "set-property"-elemen ts?

Extend the base Struts Action Class. Add a getter/setter method for the 
property named as an XML subelelement of the action mapping in the 
struts-config.xml.

E.g.
struts-config.xml
<action     path="/xyz"
             type="test.Xyz"
             className="MyActionMapping">
             <set-property property="myproperty" value="test value"/>
</action>



iIn your: MyActionMapping which extends ActionMapping

private  String myproperty = null;

public void setMyproperty(String value) {
        this.myproperty = value;
}

public String getMyproperty() {
        return this.myproperty;
}


Have fun



Tim.Adler@Bertelsmann.de 
08.03.2004 17:07

Please respond to
"Struts Users Mailing List" <st...@jakarta.apache.org>


To
struts-user@jakarta.apache.org
cc

Subject
[RMX:##] Own Action-Subclass: How to configure using "set-property"-elemen 
ts?






Hey everbody!
 
I derived my own Action-subclass for doing multiple stuff in my webapp on
every request. Part of the "multiple-stuff" is a method that checks if the
session got lost, but only if needed at that certain point in the
application (like when a formbean is used over multiple request for 
creating
an order or stuff).
Now, my current pratice is to call that method manually in every custom
action I write, which is somehow unsatisfying. I'd rather like to be able 
to
configure this session-safety directly through the struts-config.xml. I 
saw
that there are <set-property> elements, which seem like they could give me
such an ability based on every action-mapping. That'd be nice.
But HOW can I access those properties in my action?! I can't seem to find
any methods for that.
 
Thx for any help!!
_______________________________________
Tim Adler, Abt. SDA1
Adress Management Solutions
AZ | Direct
Carl-Bertelsmann Straße 161s
D-33311 Gütersloh

Tel.: 05241/ 80 - 89574
tim.adler@bertelsmann.de 
 

ForwardSourceID:NT0001A5CA 


_________________________________________________________________
Please be advised that the information contained herein is confidential and intended only for use by the individual stated above. If you are not the named recipient, you are hereby notified that any disclosure, distribution, dissemination, or copying is prohibited. If this information has been directed to you in error, please contact the sender immediately at the telephone number listed above.