Tony-
This is ok if you dont want to use locale-specific resource strings (you just want to display the non-locale specific string) If you do want to use locale-specific resource strings (from your resource bundle) I would not use <bean:display but <bean:message key="PutFullyQualfiedNameOfKeyHere" />
All the same I'm glad the former solution worked for you,
Martin-
----- Original Message ----- From: "Tony Dahbura" <[EMAIL PROTECTED]>
To: "Martin Gainty" <[EMAIL PROTECTED]>
Cc: "Struts Users Mailing List" <user@struts.apache.org>; "Aman A" <[EMAIL PROTECTED]>
Sent: Sunday, June 05, 2005 3:22 PM
Subject: Re: help with messages using bean on jsp


All:
Figured out the problem....:
My JSP page was trying to display the messages using the following code:
<ul>
   <html:messages id="errmsgs">
           <li><bean:message name="errmsgs"/></li>
    </html:messages>
</ul>

I should have used a <bean:write name="errmsgs"/> tag instead. I think the <bean:mesage> tag was trying to lookup the message as the key to a message rather than just displaying the message?

Thanks,
Tony


Martin Gainty wrote:

Tony-
to allow access by your Struts app's bean tag set the struts-config.xml
<message-resources parameter=test.ApplicationResources"/>
(ApplicationResources.properties is located in test folder off root)
Now you can have multiple <message-resources with key="PropertyKey" to identify the particular ApplicationResources implementation

You can use bean:message to pull the parameter and substitute your parameters in
<bean:message key="label.welcome" arg0="Ralph" arg1="Nader"/>

But JSTL is better suited for internationalisation and message formatting so entering the bundle identifier in web.xml
<context-param>
 <param-name>javax.servlet.jsp.jstl.fmt.localizationContext</param-name>
 <param-value>ApplicationResources</param-value>
</context-param>

later on in your jsp
<%@ taglib uri=http://java.sun.com/jstl/fmt prefix="fmt"%>
and now do your substitution..
<fmt:message key="buttonsubmit" bundle="${bundleToUse}"/> where bundleToUse is ApplicationResources.properties In this way all of your strings will be assigned to locale specific properties file

HTH,
Martin-
----- Original Message ----- From: "Tony Dahbura" <[EMAIL PROTECTED]>
To: "Martin Gainty" <[EMAIL PROTECTED]>
Cc: "Struts Users Mailing List" <user@struts.apache.org>
Sent: Thursday, June 02, 2005 9:59 PM
Subject: Re: help with messages using bean on jsp


I do not have a ApplicationMessageResources_en_US.properties but I do have a ApplicationMessageResources.properties file with the following properties:
global.required={0} is a required value.

As can be seen the actual substitution is taking place. I pass "userid" and it replaces the string with "userid is a required value"
so the substitution is working but the message is prepended with en_US

Any help would be appreciated it!

Tony


Martin Gainty wrote:

Tony-
More specifically you will need a
ApplicationMessageResources_en_US.property which would be located in web-inf\classes\tonyapp folder
where the property key value would display something like
userid=some_username
password=some_password
HTH,
Martin-
----- Original Message ----- From: "Michael Jouravlev" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" <user@struts.apache.org>
Sent: Wednesday, June 01, 2005 9:28 PM
Subject: Re: help with messages using bean on jsp


Do you have ApplicationMessageResources.properties property file,
which is located in WEB-INF\classes\tonyapp ?

On 6/1/05, Tony Dahbura <[EMAIL PROTECTED]> wrote:

I have a peculiar problem cropping up with Struts 1.2.7...

When I add an actionError to using my form bean and then go to display
it in the html jsp page I get the following:

    * ???en_US.userid is a required value.???
    * ???en_US.password is a required value.???

My struts-config.xml file looks like this for the message resources:
<message-resources null="false"
parameter="tonyapp.ApplicationMessageResources"/>



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



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

Reply via email to