Did you put <html:errors /> in the JSP ? -----Original Message----- From: Satish Talim [mailto:[EMAIL PROTECTED] Sent: Friday, October 08, 2004 12:51 PM To: Struts Users Mailing List Subject: Unable to display Errors
Hello all, I am new to Struts and experimenting with a simple Login screen using Struts 1.2.4 with JBoss 4.0 and J2SDK 1.4.2. The problem I am facing is that I am unable to display any error messages on my Login screen (login.jsp), in case the user does not enter any data on the Login ID and/or password fields and clicks on the Submit button. In the validate() method of my Action Form (part-code), I have the code - ActionErrors errors = new ActionErrors(); ActionMessage msg = null; if (getLoginID() == null || getLoginID().length() < 1) { msg = new ActionMessage("errors.loginID.required"); errors.add(ActionMessages.GLOBAL_MESSAGE, msg); } if (getPassword() == null || getPassword().length() < 1) { msg = new ActionMessage("errors.password.required"); errors.add(ActionMessages.GLOBAL_MESSAGE, msg); } return errors; I try to display the error messages in login.jsp (part-code) as: <%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %> <html:messages id="msg" message="true"> <bean:write name="msg" /> </html:messages> My web.xml located in the WEB-INF folder of my application does not have any <taglib> tags. The struts-config.xml in the WEB-INF folder of my application has the line: <message-resources parameter="LoginMessageResources.properties" null="false" /> The contents of LoginMessageResources.properties located in the WEB-INF\classes folder of my application has: # Errors errors.loginID.required=LoginID cannot be blank errors.password.required=Password cannot be blank Could anyone point out the problem? Thanks in advance. Satish Confidentiality Notice The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain confidential or privileged information. If you are not the intended recipient, please notify the sender at Wipro or [EMAIL PROTECTED] immediately and destroy all copies of this message and any attachments. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]