Hi Everybody
I am working on a struts 1.2.4.
I want to know how we can use ActionMessages and pull them by
<html:messages> tag.
This is what I tried but not working
Following is the code of a validate method of a formbean
public ActionErrors validate(ActionMapping mapping,
HttpServletRequest request)
{
ActionMessage msg = null;
ActionErrors errors = new ActionErrors();
ActionMessages messages=new ActionMessages();
if (getLoginID() == null || getLoginID().length() < 1)
{
msg = new ActionMessage("errors.loginID.required");
//errors.add(ActionMessages.GLOBAL_MESSAGE,msg );
messages.add(ActionMessages.GLOBAL_MESSAGE,msg );
}
if (getPassword() == null || getPassword().length() < 1)
{
msg = new ActionMessage("errors.password.required");
// errors.add(ActionMessages.GLOBAL_MESSAGE,msg );
messages.add(ActionMessages.GLOBAL_MESSAGE,msg );
}
return errors;
}
and my jsp is
<html:messages id="error" message="true">
<li><bean:write name="error"/></li>
</html:messages>