You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by James Mitchell <jm...@telocity.com> on 2002/08/31 17:48:33 UTC

RE: [MessageResources] URGENT!!! Dynamic parameters in App Resources for error handling

> -----Original Message-----
> From: Tarun Sainanee [mailto:taruns@delhi.tcs.co.in]
> Sent: Saturday, August 31, 2002 11:05 AM
>
> Hi all,
> I have been pretty happy using struts 1.0.2 for some time now. But now i
> have a problem. Please help.
>
> I know that we can use parameterized messages in the App Resources file
> for error messages. Depending on the no of parameters i can have an
> errors.add() method pass the parameters.
> But the problem is that i do not know in advance how many
> parameters i may
> need to pass? Any workaround guys?

Instead of using getMessage(key, arg0, arg1, etc, etc....

use getMessage(key, args[])


>
> Also is there a way that i can access the message in App Resources File
> and modify it at runtime???

<my-best-guess>
The default implementation of MessageResources (PropertyMessageResources)
does not provide for any way to manipulate the underlying HashMap at
runtime.

However, I guess you could hack around this with your own implementation
(not recommended).  Myself and a few others are looking at creating a
JDBCMessageResources that will probably provide a reload method.  So, I
guess, in a way that would allow someone to modify at runtime.
</my-best-guess>

>
> Pointers to a working code would be excellent.....
>
>
> Regards,
> Tarun Sainanee
> TCS Delhi


Hope that helps

James Mitchell
Software Engineer\Struts Evangelist
Struts-Atlanta, the "Open Minded Developer Network"
http://www.open-tools.org/struts-atlanta


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>