You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Jeremy Gillick <jg...@Promptu.com> on 2001/06/14 01:59:52 UTC

Cannot select property from html:error

When I try to view errors in my jsp page individually (by property), it just
repeats the entire error array as if I called the html:error without a
property attribute.  My code is below.


form.Validate()
------------------
public ActionErrors validate(ActionMapping mapping,
                                 HttpServletRequest request) {
								 
		ActionErrors errors = new ActionErrors();
		
		String loginID = getLoginID();
		String password = getPassword();
		
		if(null == loginID || "".equals(loginID)){
			errors.add("loginID", new
ActionError("error.loginID"));
		}
		
		if(null == password || "".equals(password)){
			errors.add("password", new
ActionError("error.password"));
		}
		
		return errors;

    }
------------------


JSP:
------------------
<html:form action="LoginForm.do">

      <html:errors property="loginID" />
      <br>
      <html:text property="loginID" maxlength="40" />
      <p>

      <html:errors property="password" />
      <br>
      <html:password property="password" />

</html:form>
------------------


Result HTML:
------------------
Validation Error
You must correct the following error(s) before proceeding: 
*	Password is required 
*	Username is required 
<input type="text" name="loginID" maxlength="40" value="">

Validation Error
You must correct the following error(s) before proceeding: 
*	Password is required 
*	Username is required 

<input type="text" name="password" maxlength="40" value="">
------------------

So it's repeating the entire error array for each html:error tag, and
ignoring the property attribute.

Any ideas?

Thanks,
Jeremy