Hello,

I am using Struts 1.2.4 on JBoss 3.2.5.

In my ActionForm validate method, I have the following code -
    ActionErrors errors = new ActionErrors();
    ActionMessages messages = new ActionMessages();
    ActionMessage msg = null;
    if (getLoginID() == null || getLoginID().length() < 1)
    {
      msg = new ActionMessage("errors.loginID.required");
      messages.add(ActionMessages.GLOBAL_MESSAGE, msg);
      errors.add(ActionMessages.GLOBAL_MESSAGE, msg);
    }
    request.setAttribute("messages", messages);
    return errors;

I did this, since I don't want to use ActionErrors and ActionError (as these are 
deprecated). Now in my JSP view I want to display the message, but am not clear what I 
need to do. I tried the following, but it does not work ie. no messages are displayed 
on the screen.
<%@ taglib uri="http://struts.apache.org/tags-html-el"; prefix="html" %>
<%@ taglib uri="http://struts.apache.org/tags-bean-el"; prefix="bean" %>
    <html:messages id="messages" message="true">
      <li><bean:message name="messages"/></li>
    </html:messages>

What am I doing wrong and what's the right solution?

All help most appreciated.

Regards,

Satish Talim

Reply via email to