You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Nagendra Kumar O V S <na...@ikigo.com> on 2003/05/26 14:00:49 UTC
A Basic Q on action mapping
HI,
when exactly we use this set-property in the action mapping and can anyone
give a live example
<set-property property="" value=""/>
TIA
Re: A Basic Q on action mapping
Posted by Ted Husted <hu...@apache.org>.
Struts allows pluggable objects just about everywhere (maybe even
everywhere). When you extend an Action, ActionForward, and so forth, you
need a way to set the properties you've added. Plugging in a new DTD
would be a real headache. Alternatively, you can use <set-property> to
set any arbitrary public property on the underlying object.
The Validator and Tiles PlugIn both use <set-property> to populate
public fields regarding their configuration paths.
<
http://cvs.apache.org/viewcvs/jakarta-struts/src/share/org/apache/struts/validator/ValidatorPlugIn.java?rev=1.17&content-type=text/vnd.viewcvs-markup
>
<
http://cvs.apache.org/viewcvs/jakarta-struts/src/share/org/apache/struts/tiles/TilesPlugin.java?rev=1.20&content-type=text/vnd.viewcvs-markup
>
-Ted.
Nagendra Kumar O V S wrote:
>
> HI,
> when exactly we use this set-property in the action mapping and can
> anyone give a live example
> <set-property property="" value=""/>
> TIA
>
> ____________________________________________________
> <http://www.incredimail.com/redir.asp?ad_id=309&lang=9> IncrediMail -
> Email has finally evolved - Click Here
> <http://www.incredimail.com/redir.asp?ad_id=309&lang=9>
--
Ted Husted,
Struts in Action <http://husted.com/struts/book.html>
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org
Re: A Basic Q on action mapping
Posted by Nicolas De Loof <ni...@cgey.com>.
Lots of struts-config elements can use this "classname" attribute and <set-property> child elements. It allow you to use
an alternative class for configuration objects.
To give you a concrete example, if you want a mapping to have a "userAllowed" property, that will be a list of user that
are allowed to execute this action (in real lifge you shoul use "role" attribute for this).
You can extend ActionMapping to add a "userAllowed" javabean property and set your struts-config like this :
<action classname="MyActionMapping" path="...">
<set-porperty name="userAllowed" value="admin, manager"/>
</action>
Hope it will help you.
Nico.
HI,
when exactly we use this set-property in the action mapping and can anyone give a live example
<set-property property="" value=""/>
TIA
____________________________________________________
IncrediMail - Email has finally evolved - Click Here
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org