struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Brandon Goodin" <m...@phase.ws>
Subject RE: Action Instantiation Question
Date Sun, 16 Feb 2003 20:08:17 GMT
Okay, a few more questions.

So an ActionMapping class is insantiated for each <action..> element in the
struts config?

If that is the case then why don't we allow the <set-property> to go into a
map in the ActionMapping class. This would reduce the work of having to
extend the ActionMapping class into a "custom" ActionMapping class for the
sake of a few getters and setters. Then we could provide accessor methods to
that map's keys and properties. These "properties" could be accessed at
runtime so we could define "consistent behaviour configuration info" to a
particular action depending on the the action path it is being accessed by.

Also, it does appear that I can only have one type attribute of the
<action-mappings> in the struts-config.xml for all of my nested <action..>
configs. In the process that I described above... the base Struts
ActionMapping class could provide custom properties to each particular
action without having to extend it.

Thoughts? Corrections?

Brandon Goodin
Phase Web and Multimedia
PO Box 85
Whitefish MT 59937
P (406) 862-2245
F (406) 862-0354
mail@phase.ws
http://www.phase.ws


-----Original Message-----
From: Ted Husted [mailto:ted@husted.com]
Sent: Sunday, February 16, 2003 12:23 PM
To: struts-user@jakarta.apache.org
Subject: Action Instantiation Question


Brandon writes:

 > Do all the Action Mappings share one action instance?

Yes.


 > What happens when I have a custom Action that uses property setters
 > from the struts-config.xml to set properties during use of that
 > action.

You wouldn't be setting the properties of the Action object here but the
*ActionMapping* bean. To get to your custom properties, you would refer
to the mapping instance that is passed to execute/perform. So, each
mapping would have their own set.

The ActionMapping bean is a decorator that the Action object can use to
affect its runtime behavior, but the Action objects are singletons.
Which ActionMapping first triggers the instantiation of the Action
doesn't matter.

HTH, Ted.

--
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



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


Mime
View raw message