Announcement Announcement Module
Collapse
No announcement yet.
how to diaplay all errors using the spring tag lib Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • how to diaplay all errors using the spring tag lib

    Normally one includes the following in a JSP to diplay all binding error for a given command bean.

    Code:
         <spring&#58;bind path="command.*"> 
            <c&#58;forEach var="error" items="$&#123;status.errorMessages&#125;"> 
            <p><font color="red"><c&#58;out value="$&#123;error&#125;"/></font><p> 
            </c&#58;forEach > 
         </spring&#58;bind>
    However I'd like to move this out of each JSP into a Sitemesh template so I was wondering if there was a way to display all binding errors, without knowing the "command" name that was used in each JSP.

    Although the snippet below where I specify path="*.*" does not work with Spring, I would like to get the equivalent results.

    Code:
         <spring&#58;bind path="*.*"> 
            <c&#58;forEach var="error" items="$&#123;status.errorMessages&#125;"> 
            <p><font color="red"><c&#58;out value="$&#123;error&#125;"/></font><p> 
            </c&#58;forEach > 
         </spring&#58;bind>

    I could use scriptlets and manually search for request attributes starting with "org.springframework.validation.BindException. " but was wondering it there was a more elegant way.

    Thanks,
    Sanjiv
Working...
X