DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=20784>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=20784

[PATCH] Enhanced Error Handling & Style Control

           Summary: [PATCH] Enhanced Error Handling & Style Control
           Product: Struts
           Version: Nightly Build
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Enhancement
          Priority: Other
         Component: Custom Tags
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


This enhancement allows users to set up default styles (style, styleClass, 
styleId, errorStyle, errorStyleClass, errorStyleId) in a resource bundle (Ex: 
ApplicationResources.properties).

When an input element is rendered a check is made to see if any errors are 
associated with it.  If errors are associated the tag will use any error-styles 
assigned to it, otherwise it will use the non-error-styles.  (Ex: A developer 
can set an errorStyleClass that will highlight text inputs with errors in red.)

A new tag (LabelTag) is also included in this enhancement.  LabelTags are 
associated with input elements.  It will apply different styles to its body 
content in the same fashion as the input elements.  (Ex: A normal black label 
can turn red and bold if its input fails validation.)


Basic behavior for this enhancment:
* Styles/error-styles assigned in-line override their counterparts in the 
resource bundle.
* Non error-styles will be used regardless of errors if error-styles are not 
assigned. (Ex: If you set the styleClass and not the errorStyleClass it will 
use the styleClass regardless of errors.)
* Error-styles will only be used if errors are associated with the element. 
(Ex: If you set the errorStyleClass and not the styleClass it will only use the 
errorStyleClass when errors are associated.)
* Errors can be associated with specific input elements, groups of elements, or 
both.


EXAMPLE:
====== ApplicationResources.properties =====
...
label.errorStyleClass=bold
...
text.styleClass=normal
text.errorStyleClass=red_error
...
===== test.jsp =====
...
<html:label group="name">Name:</html:label>
<html:text property="firstName" group="name"/>
<html:text property="lastName" group="name"/>
...
<html:label group="ssn">SSN:</html:label>
<html:text property="ssn1" group="ssn" errorStyleClass="blue_error"/>
<html:text property="ssn2" group="ssn" errorStyleClass="blue_error"/>
<html:text property="ssn3" group="ssn" errorStyleClass="blue_error"/>
...
===== output with no errors =====
...
Name:
<input type="text" name="firstName" class="normal">
<input type="text" name="lastName" class="normal">
...
SSN:
<input type="text" name="ssn1" class="normal">
<input type="text" name="ssn2" class="normal">
<input type="text" name="ssn3" class="normal">
...
===== output with error on name and ssn ===
...
<span class="bold">Name:</span>
<input type="text" name="firstName" class="red_error">
<input type="text" name="lastName" class="red_error">
...
<span class="bold">SSN:</span>
<input type="text" name="ssn1" class="blue_error">
<input type="text" name="ssn2" class="blue_error">
<input type="text" name="ssn3" class="blue_error">
...
===== output with error on lastName =====
...
Name:
<input type="text" name="firstName" class="normal">
<input type="text" name="lastName" class="red_error">
...
SSN:
<input type="text" name="ssn1" class="normal">
<input type="text" name="ssn2" class="normal">
<input type="text" name="ssn3" class="normal">
...



This ticket is an enhancement of a previous ticket and replaces bug #20630
http://issues.apache.org/bugzilla/show_bug.cgi?id=20630

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

Reply via email to