Hi Brandon,

I just posted something on a different topic that may solve your problem.
Basically it is like your Solution #2, except it doesn't use a "comma
delimited value" getter/setter.  Not sure why you need that.  Anyway, here's
the posting URL.

http://shorl.com/dutydapedroho

-Jerome

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

Reply via email to