Hi,

I was intending to use <html:errors property="username"/>, specifying the property for 
display, but it still doesn't allow me to test for it's existence.

What I'd like to do is test if an error exists, then add a new HTML table row and cell 
into the output containing the error message, otherwise I do not want to create the 
HTML table row and cell at all.

Is there a way to do this ?

Thanks
Robin

-----Original Message-----
From: news [mailto:[EMAIL PROTECTED] Behalf Of Jeff Beal
Sent: 05 October 2004 13:40
To: [EMAIL PROTECTED]
Subject: Re: ActionError and JSP display


Robin Mannering wrote:
> Hi,
> 
> 
> Platorm is : Tomcat 5, Struts 1.1
> 
> Context: HTML Form submissions and validation.
> 
> 
> I'm trying to conditionally test for the existince of error messages by their keys.  
> And I'd then like to show the error with HTML formatting around it.
> 
> 
> Basically, using tags, I'd like to do the same as the following following pseudo 
> code.
> 
> 
> if (errorMessage named 'usernameError' exists) {
> 
>       showError('usernameError' + some html)
> 
> }
> 
> 
> The error message is set from within the Form class as:
> 
> 
>     errors.add("usernameError", new ActionError("errors.form.username.required"));
> 
> 
> I've been trawling around and have found lots of references to 
> <logic:messagesPresent> and then looping through each message using <html:messages> 
> but not a test for the existence of a particular message.
> 
> 
> I'm trying to display the error message next to each appropriate form element rather 
> than in a list.  I probably can't see the solution for looking.  Can anyone help?
> 
> 
> Many thanks
> 
> Robin

Read 
http://struts.apache.org/api/org/apache/struts/taglib/html/package-summary.html#doc.Other.errors,
paying attention to the property attribute of html:errors

-- Jeff


====================================================================
This e-mail and any attachments may be confidential and/or legally
privileged. If you have received this e-mail and you are not a named
addressee, please inform Landmark Information Group on 01491 413030
and then delete the e-mail from your system. If you are not a named
addressee you must not use, disclose, distribute, copy, print or rely 
on this e-mail. This email and any attachments have been scanned for
viruses and to the best of our knowledge are clean. To ensure 
regulatory compliance and for the protection of our clients and 
business, we may monitor and read e-mails sent to and from our 
servers.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to