Try the 2 classes: org.apache.struts.Globals org.apache.struts.action.ActionMessages
There shouldn't be any problem using your own name for an error key. This allows you to group messages as you see fit. Now, if you ARE going to save all of your messages under your own key, you should probably make it a public static variable in one of your classes so you don't have to worry about accidentally changing your key in all of your code should anything happen. You would simply need to update it in that one static class PLUS any affected JSP's (since I don't know of a way to use a static variable name in a JSP's html:messages tag. Maybe there is something in EL that would allow you to do that so you'd never have to write a text string in your JSPs either. Regards, David -----Original Message----- From: Nadia Kunkov [mailto:[EMAIL PROTECTED] Sent: Wednesday, October 13, 2004 12:17 PM To: Struts Users Mailing List Subject: RE: Newbie <html:errors/> never displays errors Thanks everyone for the replies. David, I think you are right. I just got an error that bean "error" doesn't exist in any scope. That raises another newbie question: I need to save all these errors under the same key. Can I use something like this: errors.add("countryErrors", new ActionError("errors.required","Country Name")); Or I need to use ActionErrors.GLOBAL_ERRORS? Where can I look up the available keys like GOBAL_ERRORS or GLOBAL_MESSAGES? -----Original Message----- From: David G. Friedman [mailto:[EMAIL PROTECTED] Sent: Wednesday, October 13, 2004 12:10 PM To: Struts Users Mailing List Subject: RE: Newbie <html:errors/> never displays errors Charles, Isn't Nadia saving the messages under the name key "countryCapital", not the global errors key, so shouldn't that html:messages line be: <html:messages id="error" name="countryCapital"> ... etc... </html:messages> Regards, David -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Wednesday, October 13, 2004 11:32 AM To: [EMAIL PROTECTED] Subject: RE: Newbie <html:errors/> never displays errors Hi Nadia, Use this to write your message : <logic:messagesPresent> <ul> <html:messages id="error"> <li><bean:write name="error"/></li> </html:messages> </ul> </logic:messagesPresent> <bean:write> will write error message who are call in your validate method and <logic:messagesPresent> will check if these message are present. Charles Gouin-Vallerand -----Original Message----- From: Nadia Kunkov [mailto:[EMAIL PROTECTED] Sent: October 13, 2004 11:16 AM To: Struts help (E-mail) Subject: Newbie <html:errors/> never displays errors Hi, I have gone through multiple postings and followed the suggestions about displaying the errors. I just need another pair of eyes to look at this, I'm probably missing something. I can't display errors on the page. I know that I go through the validate method and it finds errors because I'm not moving to the next page when I do a submit. If I have an error I want to stay on the same page and let the user resubmit. I do stay on the same page but under the form I want error messages to be displayed and they are never there. Please take a look below. I have this in my MyAppResources.properties which resides in /WEB-INF/classes directory errors.required={0} is required. in my struts-config.xml I have validate="true" and also <message-resources parameter="MyAppResources" null="false"/> In my ActionForm I have the following in the Validate method: public ActionErrors validate (ActionMapping actionMapping, HttpServletRequest httpServletRequest) { ActionErrors errors = new ActionErrors(); if (getCountryName() == null || getCountryName().length() < 1) { errors.add("countryName", new ActionError("errors.required","Country Name")); } if (getCountryCapital() == null || getCountryCapital().length() < 1) { errors.add("countryCapital", new ActionError("errors.required","Country Capital")); } return errors; } In my jsp file I have the following .....some stuff...... <form:submit property="method" value="Add"></form:submit> </form:form> <html:errors/> </body> </html:html> Thanks for your help. --------------------------------------------------------------------- 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]