You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by Martin D Bayly <ba...@jpmorgan.com> on 2001/08/15 15:59:55 UTC

Enhanced errors tag

A useful enhancement to the <html:errors/> tag would be to have a single message
 header/footer as well as an error block header and footer.
This enables you to keep your message strings free of html markup such as the
<li> shown in the examples.

eg.
errors.header=<h3><font color="red">Validation Error</font></h3>You must correct
 the following error(s) before proceeding:<ul>
errors.footer=</ul><hr>

with the extension of:

error.header=<li>
error.footer=</li>


The attached is a version of our ErrorsTag (copied from the struts errorstag)
incorporating this change

(See attached file: ErrorsTag.java)

Martin

RE: Enhanced errors tag

Posted by David Winterfeldt <dw...@yahoo.com>.
There is an html:messages tag that is basically the
same as html:errors except it iterates over messages
and errors so you can remove the html from the message
resources.  There are the classes ActionMessages and
ActionMessage for general messages like "Record has
been deleted.".  ActionErrors is a subclass of
ActionMessages and ActionError is a subclass of
ActionMessage.  I'm working on adding some
documentation with code examples for this.

  <h3><font color="red"><bean:message
key="errors.header"/></font></h3>

  <ul>
  <html:messages id="message">
     <li><bean:write name="message"/></li>
  </html:messages>
  </ul>

  errors.header=Validation Error

or

  <html:messages id="message" header="errors.header"
footer="errors.footer">
     <li><bean:write name="message"/></li>
  </html:messages>

  errors.header=<h3><font color="red">Validation
Error</font></h3>
    You must correct the following error(s) before
proceeding:<UL>
  errors.footer=</ul><hr>

The header and footer attributes are optional.

David

--- "Deadman, Hal" <ha...@tallan.com> wrote:
> I think a new tag that allows you to not put HTML in
> your resource file
> already exists in post 1.0 Struts in the form of the
> <html:messsage(s)> tag.
> It can be used in place of <html:errors>. The errors
> class is now a subclass
> of a message class.
> 
> -----Original Message-----
> From: Martin D Bayly
> [mailto:bayly_martin@jpmorgan.com]
> Sent: Wednesday, August 15, 2001 10:00 AM
> To: struts-dev@jakarta.apache.org
> Subject: Enhanced errors tag
> 
> 
> 
> A useful enhancement to the <html:errors/> tag would
> be to have a single
> message
>  header/footer as well as an error block header and
> footer.
> This enables you to keep your message strings free
> of html markup such as
> the
> <li> shown in the examples.
> 
> eg.
> errors.header=<h3><font color="red">Validation
> Error</font></h3>You must
> correct
>  the following error(s) before proceeding:<ul>
> errors.footer=</ul><hr>
> 
> with the extension of:
> 
> error.header=<li>
> error.footer=</li>
> 
> 
> The attached is a version of our ErrorsTag (copied
> from the struts
> errorstag)
> incorporating this change
> 
> (See attached file: ErrorsTag.java)
> 
> Martin
> 


__________________________________________________
Do You Yahoo!?
Make international calls for as low as $.04/minute with Yahoo! Messenger
http://phonecard.yahoo.com/

RE: Enhanced errors tag

Posted by "Deadman, Hal" <ha...@tallan.com>.
I think a new tag that allows you to not put HTML in your resource file
already exists in post 1.0 Struts in the form of the <html:messsage(s)> tag.
It can be used in place of <html:errors>. The errors class is now a subclass
of a message class.

-----Original Message-----
From: Martin D Bayly [mailto:bayly_martin@jpmorgan.com]
Sent: Wednesday, August 15, 2001 10:00 AM
To: struts-dev@jakarta.apache.org
Subject: Enhanced errors tag



A useful enhancement to the <html:errors/> tag would be to have a single
message
 header/footer as well as an error block header and footer.
This enables you to keep your message strings free of html markup such as
the
<li> shown in the examples.

eg.
errors.header=<h3><font color="red">Validation Error</font></h3>You must
correct
 the following error(s) before proceeding:<ul>
errors.footer=</ul><hr>

with the extension of:

error.header=<li>
error.footer=</li>


The attached is a version of our ErrorsTag (copied from the struts
errorstag)
incorporating this change

(See attached file: ErrorsTag.java)

Martin