Emmett_1981 0 Newbie Poster

Hi guys,

I am still building the same Struts 1 app and having serious issues with getting ActionMessages to appear on my Jsp, if anyone can help I would greatly appreciate as this is my final year project and its due in 2 weeks, the Jsp is picking up the error when I debug but is not printing to screen.

The following code is both the validate method within the actionForm and the Jsp code

public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) {
        ActionErrors errors = new ActionErrors();
        if (getFirstname() == null || getFirstname().length() < 3) {
            errors.add("name", new ActionMessage("errors.name.first"));
        } // TODO: add 'error.name.required' key to your resources
        else if (getLastname() == null || getLastname().length() < 1) {
            errors.add("lname", new ActionMessage("errors.name.last"));
        } else if (getEmail() == null || getEmail().length() < 1) {
            errors.add("email", new ActionMessage("errors.email"));
        } else if (getPassword() == null || getPassword().length() < 7) {
            errors.add("pass", new ActionMessage("errors.password"));
        } else if (getPasswordconfirm() == null || getPasswordconfirm().length() < 1) {
            errors.add("passcon", new ActionMessage("errors.pass.confirms"));
        } else if (passwordsMatch() == false) {
            errors.add("nonmatch", new ActionMessage("errors.pass.match"));
            password= "";
            passwordconfirm ="";
        }
        return errors;
    }

I have only added the <bean:write> to the first property to test and it is not printing

<html:form action="/registeruser">
                    <label>First Name</label>
                    <html:messages id="error_id" name="name">
                    <bean:write name="error_id"/><br></html:messages>
                    <html:text styleId="inputtext1" property="firstname"   />
                    <label>Surname</label>
                    <html:text styleId="inputtext2" property="lastname"  />
                    <label>Email Address</label>
                    <html:text styleId="inputtext1" property="email"  />
                    <label>Enter a password</label>
                    <html:password styleId="inputtext1" property="password"  />
                    <label>Confirm password</label>
                    <html:password styleId="inputtext1" property="passwordconfirm"  />
                    <html:submit  styleId="inputsubmit1" value="Submit" />
                </html:form>

the entries in the application.resources file are as follows and I have a copy of this file within the folder that holds the JSP as well as the src folder

errors.name.first = Please enter a valid first name, must be three characters or more.
errors.name.last = Please enter a valid surname, must be three characters or more.
errors.password= Password must be at least 7 characters long and a mixture of letters and numbers.
errors.pass.confirm=Please confirm the password
errors.pass.match=Passwords do not match, please re-enter

any help would be greatly appreciated... I have looked as so many examples my head is fried and I need to move on to another part of the app

Many thanks in advance