All,

I am having a similar problem to Binh
(
http://www.mail-archive.com/struts-user@jakarta.apache.org/msg18646.html

).
I was wondering if anyone has a solution as to why I cannot get the
<html:errors> tag to work. I did notice that Struts docs say:

"In order to use this tag successfully, you must have defined an
application scope MessageResources bean under the default attribute
name, with at least the following message keys: errors.header,
errors.footer "

Where is the MessageResources bean instantiated and what is the "default

name" mentioned?

The following is how my app is set up according to my web.xml,
ApplicationResources.properties, strtus-config.xml,  and my ActionForm
and jsp:
1) ApplicationResources.properties:

    errors.header=<ul>
    errors.footer=</ul>

2) web.xml
    ...
     <init-param>
      <param-name>application</param-name>
      <param-value>ApplicationResources</param-value>
    </init-param>
   ...

3)struts-config.xml

    <action path="/login" type="action.loginAction"
        input="/login.jsp"
        name="loginForm"
        scope="request"
        validate="true">
      <forward name="success" path="/index.jsp"/>
      <forward name="error" path="/login.jsp"/>
    </action>

4) LoginForm.java
     ....
     public ActionErrors validate(ActionMapping
mapping,HttpServletRequest request) {

        ActionErrors errors = new ActionErrors();
        if ((userID == null) || (userID.length() < 1))
             errors.add("login",  new
ActionError("error.userID.required"));
             return errors;
        }
   ...

5)  login.jsp
    ...
   <%@ taglib uri="/WEB-INF/taglibs/struts-html.tld" prefix="html" %>
    ...
   <html:errors/>
   ...


Im not getting the errors tag to print anything to the page, but the
validation is returning it to the form properly.




--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to