Great.

Question:
I don't want to write an action-mapping class that has properties for my
event calendar action classes being used for my content management action
classes. That is the problem that I see. One ActionMapping class for all
your actions in the struts-config.xml. I like the idea of the hashmap so
that I can access dynamic/configurable properties from a common place in all
my action classes. But, at the same time I don't fill up my action mapping
class with a bunch of unneccessary getter/setters that don't apply to all my
action classes.

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


-----Original Message-----
From: Robert Taylor [mailto:[EMAIL PROTECTED]
Sent: Monday, February 24, 2003 10:51 AM
To: Struts Users Mailing List
Subject: RE: ActionMapping enhancement?


Brandon,

I have a similar situation and I ended up extending ActionMapping
and using the set-property in the action-mapping in the struts-config file.


robert

> -----Original Message-----
> From: Brandon Goodin [mailto:[EMAIL PROTECTED]
> Sent: Monday, February 24, 2003 12:35 PM
> To: Struts User List
> Subject: ActionMapping enhancement?
>
>
> Do any of you face this issue? and how do you deal with it?
>
> SCENARIO:
> I have a set of classes that handle event calendars.
>
> The same classes can be used within one site to maintain multiple event
> calendars.
>
> The event calendar contains multiple categories.
>
> I want to utilize the event calendar from various urls to display specific
> event calendars:
>
> /do/ec/city - shows event calendar for city events
> /do/ec/elksclub - shows event calendar for elks club
> etc...
>
> But I want to provide default parameters to each of the mappings
> so that the
> event calendar action knows which event calendar to display without having
> to pass it in through a query parameter.
>
> In other words I want to handle the default parameters in the
> struts-config.xml.
>
> The only solutions both include extending the ActionMapping class
> and using
> the set-property in the action-mapping of the struts-config.xml:
>
> SOLUTIONS
>
> 1) Create a new module (Event Calendar module). Provide a custom extended
> ActionMapping to handle properties that may be passed in for the classes
> used under the module.
>
> 2) Extend the ActionMapping class and provide a setter/getter
> that receives
> a comma delimited value ([0],[1];0=key 1=value) and stores it
> into a HashMap
> in the extended ActionMapping class. I could then provide an
> accessor method
> to retrieve a particular property in the hashmap (i.e. getValue(String
> key)). I could then retrieve the value from the action mapping reference
> within my action class to initialize default values based on the
> mapping of
> the url.
>
> Thoughts? Corrections?
>
> REASONS:
> Default parameters that are contained in a url querystring get
> difficult to
> handle. It is nice to be able to change them in one place when
> needed. This
> avoids having to pillage through every page that may contain a
> reference to
> a partical url/querystring combo and adjust the parameters rather
> that just
> one.
> Also, if the action mapping could contain a hashmap of properties... one
> could provide runtime configuration info to an Action class in order to
> affect it's behavior a certain way. This promotes reusability of code.
>
> Brandon Goodin
> Phase Web and Multimedia
> PO Box 85
> Whitefish MT 59937
> P (406) 862-2245
> F (406) 862-0354
> [EMAIL PROTECTED]
> http://www.phase.ws
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to