I'm still having problems despite reading a bunch of materials on this
stuff.
I copied the related code snippet from various files I have.  I'm
guessing that I'm 
missing something obvious.  I'd really appreciate if someone can lend a
hand.
Here is what I have so far:

Web.xml---------------------------------------

  <servlet>
    <servlet-name>action</servlet-name>
 
<servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
    <init-param>
      <param-name>application</param-name>
      <param-value>ApplicationResources</param-value>
    </init-param>
    <init-param>
      <param-name>config</param-name>
      <param-value>/WEB-INF/struts-config.xml</param-value>
    </init-param>
    <init-param>
      <param-name>debug</param-name>
      <param-value>2</param-value>
    </init-param>
    <init-param>
      <param-name>detail</param-name>
      <param-value>2</param-value>
    </init-param>
    <init-param>
      <param-name>validate</param-name>
      <param-value>true</param-value>
    </init-param>
    <load-on-startup>2</load-on-startup>
  </servlet>
------------------------------------

ApplicationResources.properties-------------------

error.username.required=Required Username
errors.header=<h3><font color=red>Validation Error!</font></h3>
errors.footer=<br><br>
---------------------------------------------------

login.jsp----------------------

<form:errors/>
-------------------------------

LoginAction.java----------------------

  ActionErrors errors = new ActionErrors();

    if ((username.equals("test")) && (password.equals("test1")))
    {
      servlet.log("Successfully Logged in "+username);
      return mapping.findForward("success");
    }
    else
    {
      errors.add("username",new ActionError("error.username.required"));
      saveErrors(request, errors);
      servlet.log("Login failure for "+username);
      return (new ActionForward(mapping.getInput()));
    }
  }
----------------------------------------


Thanks,
Brett Procek

-----Original Message-----
From: Nigel Ainslie [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, May 08, 2001 5:24 PM
To: '[EMAIL PROTECTED]'
Subject: RE: displaying errors using struts 


Brett,
the doc in
jakarta-struts\src\share\org\apache\struts\taglib\html\package.html
gives an
overview and indicates where to find the struts supplied examples.
Just remember to add the message texts to your ApplicationResources
properties file.
Nige

-----Original Message-----
From: Procek, Brett [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, 9 May 2001 7:24
To: [EMAIL PROTECTED]
Subject: displaying errors using struts 


Can someone point me to a good reference for the mechanism 
of displaying errors using strut's custom tags?

Thanks,
Brett 

Reply via email to