RFC: Extension to ActionMessagesTool (Struts<->Velocity)

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

RFC: Extension to ActionMessagesTool (Struts<->Velocity)

Eric Fixler-4
Hello.  I have a need to retrieve the ActionMessage key when listing  
certain errors in Velocity templates.  The ActionMessagesTool (whose  
functionality the ErrorsTool relies upon) only returns the messages  
as strings, so there's no opportunity for me to access the key value  
inside templates.

If others have interest in this, I could make the changes in the  
ActionMessagesTool and submit a patch.  But I have some questions:

1) Here are the methods I was thinking of adding, please comment

List getMessages() -- return a list of all the ActionMessage objects
List getMessages(property) -- ditto, but for specific properties

String renderMessage(Message m) -- print the message, using the  
default ResourceBundle to look it up
String renderMessage(Message m, String bundleName) -- ditto, specify  
the resource bundle

2) What version should I patch against?

3) I'm a CVS user, have never used subversion, any tips/places to  
look for info on generating patches?

thanks!
eric

 

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: RFC: Extension to ActionMessagesTool (Struts<->Velocity)

Nathan Bubna
On 6/1/05, Eric Fixler <[hidden email]> wrote:
> Hello.  I have a need to retrieve the ActionMessage key when listing
> certain errors in Velocity templates.  The ActionMessagesTool (whose
> functionality the ErrorsTool relies upon) only returns the messages
> as strings, so there's no opportunity for me to access the key value
> inside templates.

hmm.  i'm not sure we want to encourage direct use of framework
objects like ActionMessage in the template.  that sort of thing might
be fine to do as an extension or customization for a specific
application, but would be inappropriate for distribution in
VelocityTools.  so, i'd probably be ok with adding these sort of
methods as protected, but not public.  also, if your need is to access
the keys, then why not just have a method that returns the keys?  or
at most, a message that returns a java.util.Map of keys to localized
messages.

something like  getKeys()  and getKeys(property)  and perhaps
something like getMap(), get(Map property), and getMap(property,
bundle)

> If others have interest in this, I could make the changes in the
> ActionMessagesTool and submit a patch.  But I have some questions:
>
> 1) Here are the methods I was thinking of adding, please comment
>
> List getMessages() -- return a list of all the ActionMessage objects
> List getMessages(property) -- ditto, but for specific properties

-1 unless it's protected

> String renderMessage(Message m) -- print the message, using the
> default ResourceBundle to look it up
> String renderMessage(Message m, String bundleName) -- ditto, specify
> the resource bundle

-1 ditto

> 2) What version should I patch against?

the head of 1.2-dev in subversion.
 
> 3) I'm a CVS user, have never used subversion, any tips/places to
> look for info on generating patches?

not sure offhand.  but most subversion things are just like CVS.
here's the manual:

http://svnbook.red-bean.com/en/1.0/svn-book.html

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]