You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by dave sag <da...@portablewhole.com> on 2002/07/29 09:02:37 UTC

html:errors tag behaves strangely.

hi people

using struts1.1beta

i want to display my errors such that i get any major errors at the 
top of the page and then any form specific validation errors down 
with my form.  doing this simply was in fact my main motivation for 
migrating to struts.

so i have set up my page and it all works fine.  a simple login form.

My main problem is that the headers are repeated all the way down the 
form, for each error i get a full errors.header and errors.footer 
surely this is a bug. i can't find anything but trivial examples 
online where the errors are all clumped together at the top - not 
what I want.

in my situation there are 3 possible errors, 2 relate to form 
validation and one to business logic.  this is pretty typical 
actually, i recon.

if there are any errors, i want the page to display a generic error 
header, then the overall error (ie error.login.failed) then with my 
form fields any particular errors.

trying this with

<html:errors property="Login"/> up the top (Login populated by my 
LoginAction) and then

inline in my form <html:errors property="username"/> etc

doesn't work. i get too many headers.  if i take the headers out then 
i get no headers anywhere.  i just want the headers at the top 
(obviously) and the footer below the form

something like

<html:errors>

	<html:error property="..."/>

	...

	my form

	<html:error property="..."/>

</html:errors>

would seem to make the most sense to me.

i saw a cryptic reference to using <html:message ...> or some such 
tag to do this but the remark seemed kinda off the cuff in the list 
archive/autofaq i was reading, and had no detail.

what is the standard pattern for this style of error handling.  i 
can't be the only one to hit this problem.

is there a URL somewhere that gives a single page view of the struts 
tags and their attributes / example uses?

cheers and thanks in advance

dave


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