You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Mirabito, Massimo" <mc...@cdc.gov> on 2002/02/11 18:43:04 UTC

Using the Strut errors tag in a JSP

Hi there: 

 

I am very new to struts and I have what I hope is a simple question. 

When using the errors tag all errors display at the top of the form page
(this seams to be the behavior in looking at various examples
<html:errors/>) 

Is there a way to grab the error collection within the JSP page iterate
through it and display the errors beside each field in the JSP instead of
showing all the errors in one area?  

The forms that I have to develop are extremely long and would require the
users to scroll back and forth to identify errors. The users do not want to
do this.

Any help is greatly appreciated 

Thanks 

Max

 


Re: Using the Strut errors tag in a JSP

Posted by James Carman <ja...@carmanconsulting.com>.
Yes, there is a way to do it.  You can access the ActionErrors object by
asking for it from the request object...

final ActionErrors errors = request.getAttribute( Action.ERROR_KEY );

Then, you can obtain an Iterator of the property-specific ActionError
objects by...

for( Iterator i = errors.get( "propertyName" ); i.hasNext(); )
{
  //Blah blah blah
}

Of course, I would suggest using a combination of the bean and logic tags to
perform this logic, but that's where the information (by default) is
located.

----- Original Message -----
From: "Mirabito, Massimo" <mc...@cdc.gov>
To: <st...@jakarta.apache.org>
Sent: Monday, February 11, 2002 12:43 PM
Subject: Using the Strut errors tag in a JSP


> Hi there:
>
>
>
> I am very new to struts and I have what I hope is a simple question.
>
> When using the errors tag all errors display at the top of the form page
> (this seams to be the behavior in looking at various examples
> <html:errors/>)
>
> Is there a way to grab the error collection within the JSP page iterate
> through it and display the errors beside each field in the JSP instead of
> showing all the errors in one area?
>
> The forms that I have to develop are extremely long and would require the
> users to scroll back and forth to identify errors. The users do not want
to
> do this.
>
> Any help is greatly appreciated
>
> Thanks
>
> Max
>
>
>
>




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Using the Strut errors tag in a JSP

Posted by Keith Bacon <ke...@yahoo.com>.
Welcome to struts,
http://jakarta.apache.org/struts/struts-html.html#errors
look at the 'property' attribute.
Ask again if that's not enough.
K.

--- "Mirabito, Massimo" <mc...@cdc.gov> wrote:
> Hi there: 
> 
>  
> 
> I am very new to struts and I have what I hope is a simple question. 
> 
> When using the errors tag all errors display at the top of the form page
> (this seams to be the behavior in looking at various examples
> <html:errors/>) 
> 
> Is there a way to grab the error collection within the JSP page iterate
> through it and display the errors beside each field in the JSP instead of
> showing all the errors in one area?  
> 
> The forms that I have to develop are extremely long and would require the
> users to scroll back and forth to identify errors. The users do not want to
> do this.
> 
> Any help is greatly appreciated 
> 
> Thanks 
> 
> Max
> 
>  
> 
> 


__________________________________________________
Do You Yahoo!?
Send FREE Valentine eCards with Yahoo! Greetings!
http://greetings.yahoo.com

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>