You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Manfred Wolff <wo...@manfred-wolff.de> on 2006/01/06 17:43:27 UTC

Struts 1.3: Arbitary key/value pair

Hi everybody.

Since Struts 1.3 it is possible to set an arbitary key/value pair to
retrieve at runtime such as:

<action path="/EditSubscription"
        extends="Editor">
        <set-property key="foo" value="bar" />
</action>

In a document from the struts university (author Ted Husted) is an example to retrieve such pair:


public ActionForward execute(
        ActionMapping mapping,
        ActionForm form,
        HttpServletRequest request,
        HttpServletResponse response)
        throws Exception {

        string foo = getProperty("foo"); 

        // ...

In the nightly builds and in the newest subversion branch (366511) there is no getProperty() method 
in the Action class. So does anybody know, how to retrieve such a pair von set-properties.

Thanks a log
Manfred

-- 
===========================================
Dipl.-Inf. Manfred Wolff
Software Engineer
Fon  : +49 421 534522
Fax  : +49 421 4314578
Mobil: +49 173 2494181
-------------------------------------------
http://www.manfred-wolff.de
http://www.struts-it.org
-------------------------------------------


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Struts 1.3: Arbitary key/value pair

Posted by Joe Germuska <Jo...@Germuska.com>.
At 5:43 PM +0100 1/6/06, Manfred Wolff wrote:
>Hi everybody.
>
>Since Struts 1.3 it is possible to set an arbitary key/value pair to
>retrieve at runtime such as:
>
><action path="/EditSubscription"
>         extends="Editor">
>         <set-property key="foo" value="bar" />
></action>
>
>In a document from the struts university (author Ted Husted) is an 
>example to retrieve such pair:
>
>
>public ActionForward execute(
>         ActionMapping mapping,
>         ActionForm form,
>         HttpServletRequest request,
>         HttpServletResponse response)
>         throws Exception {
>
>         string foo = getProperty("foo");
>
>         // ...
>
>In the nightly builds and in the newest subversion branch (366511) 
>there is no getProperty() method
>in the Action class. So does anybody know, how to retrieve such a 
>pair von set-properties.

The properties are set on the ActionMapping, not the Action class.

So in this case you'd use

String foo = mapping.getProperty("foo");

Hope this helps
	Joe

-- 
Joe Germuska            
Joe@Germuska.com  
http://blog.germuska.com    
"Narrow minds are weapons made for mass destruction"  -The Ex

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Struts 1.3: Arbitary key/value pair

Posted by Manfred Wolff <wo...@manfred-wolff.de>.
Thanks - works fine.

Niall Pemberton schrieb:

>The properties get set in the ActionMapping - not the Action, so you can do
>mapping.getProperty("foo") to get the values.
>
>This feature works the same throughout - its available in the
>"configuration" objects, not the object itself - so ActionMapping which is
>the config for Action or FormBeanConfig rather than the ActionForm.
>
>Niall
>
>
>----- Original Message ----- 
>From: "Manfred Wolff" <wo...@manfred-wolff.de>
>Sent: Friday, January 06, 2006 4:43 PM
>
>
>  
>
>>Hi everybody.
>>
>>Since Struts 1.3 it is possible to set an arbitary key/value pair to
>>retrieve at runtime such as:
>>
>><action path="/EditSubscription"
>>        extends="Editor">
>>        <set-property key="foo" value="bar" />
>></action>
>>
>>In a document from the struts university (author Ted Husted) is an example
>>    
>>
>to retrieve such pair:
>  
>
>>public ActionForward execute(
>>        ActionMapping mapping,
>>        ActionForm form,
>>        HttpServletRequest request,
>>        HttpServletResponse response)
>>        throws Exception {
>>
>>        string foo = getProperty("foo");
>>
>>        // ...
>>
>>In the nightly builds and in the newest subversion branch (366511) there
>>    
>>
>is no getProperty() method
>  
>
>>in the Action class. So does anybody know, how to retrieve such a pair von
>>    
>>
>set-properties.
>  
>
>>Thanks a log
>>Manfred
>>    
>>
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>For additional 
>


-- 
===========================================
Dipl.-Inf. Manfred Wolff
Software Engineer
Fon  : +49 421 534522
Fax  : +49 421 4314578
Mobil: +49 173 2494181
-------------------------------------------
http://www.manfred-wolff.de
http://www.struts-it.org
-------------------------------------------


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Struts 1.3: Arbitary key/value pair

Posted by Niall Pemberton <ni...@blueyonder.co.uk>.
The properties get set in the ActionMapping - not the Action, so you can do
mapping.getProperty("foo") to get the values.

This feature works the same throughout - its available in the
"configuration" objects, not the object itself - so ActionMapping which is
the config for Action or FormBeanConfig rather than the ActionForm.

Niall


----- Original Message ----- 
From: "Manfred Wolff" <wo...@manfred-wolff.de>
Sent: Friday, January 06, 2006 4:43 PM


> Hi everybody.
>
> Since Struts 1.3 it is possible to set an arbitary key/value pair to
> retrieve at runtime such as:
>
> <action path="/EditSubscription"
>         extends="Editor">
>         <set-property key="foo" value="bar" />
> </action>
>
> In a document from the struts university (author Ted Husted) is an example
to retrieve such pair:
>
>
> public ActionForward execute(
>         ActionMapping mapping,
>         ActionForm form,
>         HttpServletRequest request,
>         HttpServletResponse response)
>         throws Exception {
>
>         string foo = getProperty("foo");
>
>         // ...
>
> In the nightly builds and in the newest subversion branch (366511) there
is no getProperty() method
> in the Action class. So does anybody know, how to retrieve such a pair von
set-properties.
>
> Thanks a log
> Manfred



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org