struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Don Brown" <donald.br...@gmail.com>
Subject Re: Struts Equiv to RoR's controller, action, id
Date Tue, 25 Apr 2006 18:33:11 GMT
There is a quick note on set-property in the user guide [1], but I agree, it
isn't very clear.

Here is how <set-property> works, using an ActionMapping as the example:
  - <set-property property="foo" value="bar" />  will have Struts call
setFoo("bar") on the action mapping at startup, used when you have a custom
ActionMapping class
  - <set-property key="foo" value="bar"/> will have Struts call
actionMapping.setProperty("foo", "bar) at startup (although the wildcard
capability still does the replacement at request time).  You can then
retrieve this value in your action by calling actionMapping.getProperty
("foo")

Hope that helps,

Don

[1]
http://struts.apache.org/struts-action/userGuide/building_controller.html#action_mapping_wildcards

On 4/25/06, ben.christenson <ben.christenson@kineticdata.com> wrote:
>
>
> OK, I have your first example working, and as you said it has gottem me
> almost there.  However, I have a few things that I am getting caught on
> for
> the second example.  First, you mention that the ability to use wildcards
> in
> a set-property element is new to Struts 1.3, however I can't find any
> information or source for that version (outside of the version notes on
> the
> main struts sight).  Can you let me know where to find this?  Second, I
> don't think I have a very firm grasp of how "properties" are used in
> Struts.
> I have done some web searches, but most are just setting properties for
> already existing classes.  Can you explain a bit more about how properties
> are typically used and specifically how to access them from within a
> DispatchAction?
>
> Thanks,
> Ben
> --
> View this message in context:
> http://www.nabble.com/Struts-Equiv-to-RoR%27s-controller%2C-action%2C-id-t1489136.html#a4087573
> Sent from the Struts - User forum at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message