Results 1 to 2 of 2

Thread: displaying multiple errors with spring:bind

  1. #1

    Default displaying multiple errors with spring:bind

    When using the spring:bind tag, ${status.errorMessage} seems to displaying only one error message even if there happen to be multiple errors, at least when I use the tag in this way:
    Code:
    			<spring&#58;bind path="priceIncrease.percentage">        
    				<td width="20%">          
    					<input type="text" name="percentage" value="<c&#58;out value="$&#123;status.value&#125;"/>">   
    				</td>        
    				<td width="60%">          
    					<font color="red"><c&#58;out value="$&#123;status.errorMessage&#125;"/></font>        
    				</td>      
    			</spring&#58;bind>
    That behavior is fine in some instances. (It's probably enough to print out only one error for an object property.) But there are times when I'd like to be able to display all errors. In fact, I think I'd almost always want to print out all object-level errors-- that is, errors based on an interaction of object properties, as in "A comment is required when price increase is > 30" and "Price reductions require management approval."

    So how does one display multiple errors?

  2. #2
    Join Date
    Aug 2005
    Location
    San Francisco, CA
    Posts
    43

    Default

    Code:
    #macro&#40; ferr &#41;
    	#springBind&#40;$path&#41;
    #if&#40; $status.error &#41;
    <div id="ferr-$&#123;status.expression&#125;" class="fldErrBlk"><ul
    	#foreach&#40;$error in $status.errorMessages&#41;
    ><li>$&#123;error&#125;#if&#40; $velocityCount < $status.errors.getFieldErrorCount&#40;"*"&#41; &#41;<span class="divider"></span>#end</li
    	#end
    ></ul></div>
    #end
    #end

Similar Threads

  1. Validation and displaying errors in jsp
    By jkookie in forum Web
    Replies: 3
    Last Post: Jun 5th, 2008, 03:28 PM
  2. ideas on displaying validation errors
    By lindbird in forum Web
    Replies: 1
    Last Post: Aug 26th, 2005, 01:03 PM
  3. Replies: 8
    Last Post: Jul 13th, 2005, 11:20 AM
  4. Replies: 4
    Last Post: Jan 21st, 2005, 08:43 AM
  5. Replies: 1
    Last Post: Jan 6th, 2005, 11:17 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •