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"/>

If I turn the null to true I get nothing rendered-the ApplicationMessageResources file is in the proper location and moving it results in the message not being displayed (as a test). The HTML elements that are attempting to output the values are:
<logic:messagesPresent>
         <ul>
               <html:messages id="errmsgs">
                     <li><bean:message name="errmsgs"/></li>
               </html:messages>
          </ul>
</logic:messagesPresent>

And finally the loginForm java code that is doing this is at:
if (getUsername() == null || getUsername().length() < 1) {
errors.add( ActionMessages.GLOBAL_MESSAGE, new ActionMessage("global.required", "userid" ) );
}
if (getPassword() == null || getPassword().length() < 1) {
errors.add( ActionMessages.GLOBAL_MESSAGE, new ActionMessage("global.required", "password") );
 }

The properties file looks like this:
global.required={0} is a required value.

I am developing with Eclipse and using tomcat 5.5 with jdk 1.5. This is baffling to me as to why it is prepending the en_US to the value of the key after it looks it up. I actually get the message and the substitution but somehow the en_US gets put in and it flags an error that it cannot find the message (indicated by the ???).

On another note I have had quite a bit of difficulty using the bean:write tags with bean properties that do not return Strings...Some of my beans return integers and the bean:write tag just fails and causes the rest of the page after the failure to not even render....Not sure if it is something with this particular library or not..

Any help would be very appreciated. I looked through the release notes on the new struts 1.2.7 and did not see any fixes....

Thanks,
Tony


Reply via email to