You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by chamal desilva <ch...@yahoo.com> on 2006/07/07 13:08:54 UTC
Using properties files other than ApplicationProperties
Hi,
I want store all messages in a properties file called
MessageProperties.
I added this line to struts config file.
<message-resources key="messages"
parameter="arweb.resources.MessageResources"></message-resources>
How can I retireve values in properties file from my
action classes in order to display them using
</html:errors> tag.
Thanking You,
Chamal.
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Using properties files other than ApplicationProperties
Posted by Monkeyden <mo...@gmail.com>.
Assuming you meant that you want to add errors in the Action, rather than
the ActionForm, in your Action...
1. Create an empty ActionErrors object. Let's call it "errors".
2. Add messages to it as necessary (e.g. errors.add("propertyName"
,new ActionMessage("msg.key"));)
3. Then call the base class method saveErrors(request, errors);
On 7/11/06, Laurie Harper <la...@holoweb.net> wrote:
> chamal desilva wrote:
> > Hi,
> >
> > I want store all messages in a properties file called
> > MessageProperties.
> >
> > I added this line to struts config file.
> > <message-resources key="messages"
> > parameter="arweb.resources.MessageResources"></message-resources>
> >
> > How can I retireve values in properties file from my
> > action classes in order to display them using
> > </html:errors> tag.
>
> Use getResources(request, key), where 'key' is "messages", to match your
> struts-config entry.
>
>
> http://struts.apache.org/1.2.9/api/org/apache/struts/action/Action.html#getResources(javax.servlet.http.HttpServletRequest,%20java.lang.String)
>
> L.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
Re: Using properties files other than ApplicationProperties
Posted by Laurie Harper <la...@holoweb.net>.
chamal desilva wrote:
> Hi,
>
> I want store all messages in a properties file called
> MessageProperties.
>
> I added this line to struts config file.
> <message-resources key="messages"
> parameter="arweb.resources.MessageResources"></message-resources>
>
> How can I retireve values in properties file from my
> action classes in order to display them using
> </html:errors> tag.
Use getResources(request, key), where 'key' is "messages", to match your
struts-config entry.
http://struts.apache.org/1.2.9/api/org/apache/struts/action/Action.html#getResources(javax.servlet.http.HttpServletRequest,%20java.lang.String)
L.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org