struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <tn...@bellsouth.net>
Subject Re: [STRUTS] Form error handling
Date Thu, 01 Jan 1970 00:00:00 GMT
Kiuma,

You can use one of the following:
    <html:error/> tag:
    
        If placed at the top of a page, this will cause the errors to be displayed there.
 You should also ensure that errors.header and errors.footer messages are defined in your
application resources file.  This will help in the formatting of the resulting error messages.
 Something like:
     error.header=<ul>
     error.footer=</ul>

You could also use the validator tag which comes with the Struts Validation extension.  It
works similar except it acts as an iterator over all error messages.
     <validator:errorsExist>
         <ul>
             <validator:errors id="error">
                 <li><bean:write name="error"/></li>
             </validator:errors>
         </ul>
     </validator:errorsExist>

There is a good write up on this provide by Ted Husted, Struts Tip #17.  You can obtain a
copy by joining the mvc-programmers forum hosted by BaseBeans.com.

Hope that helps.

Regards,

Todd G. Nist



> 
> From: kiuma <kiuma@usa.net>
> Date: 2002/09/17 Tue AM 07:00:28 EDT
> To: Struts Users Mailing List <struts-user@jakarta.apache.org>
> Subject: [STRUTS] Form  error handling
> 
> Hello,
> mine is a newbie question:
> 
> When validate fails i put some code like this:
> 
> newError = new ActionError("myform.error", "")
> errors.add( ActionErrors.GLOBAL_ERROR, newError );
> 
> in my properties file I put the key relative to myform.error.
> 
> in struts-config.xml
> 
>         <action name="listedUserForm" input="/secure/userlist.jsp" 
> path="/listedUser" type="com.wingstech.webappointments.ListedUserAction" 
>                 parameter="action" validate="true">
>             <forward name="Success" path="/secure/userlist.jsp" 
> redirect="true" />
>         </action>      
> 
> When validate() returns error, struts should dirve me to input page.
> 
> How can I parse errors in my jsp page, then?
> 
> thanks,
> kiuma
> 
> 
> 
> --
> To unsubscribe, e-mail:   <mailto:struts-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: <mailto:struts-user-help@jakarta.apache.org>
> 
> 


--
To unsubscribe, e-mail:   <mailto:struts-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:struts-user-help@jakarta.apache.org>


Mime
View raw message