Results 1 to 3 of 3

Thread: Spring error tag problem

  1. #1
    Join Date
    May 2012
    Posts
    1

    Default Spring error tag problem

    I have a JSP with spring:error tag.
    Please refer below

    Code:
    <c:if test="XXXX">
         <p class="error" >
    	  <form:errors path="emailAddress" />
          </p>
    </c:if>
    What should be in <c:if test="XXXX"> tag so that <p> emailAddress tag get displayed only when there is an error for emailAddress field.

    Please help!!

  2. #2
    Join Date
    Oct 2004
    Posts
    151

    Default

    Hi!

    You might try
    Code:
    <form:errors path="userName" cssClass="error" element="div" />
    which renders as
    Code:
    <div id="username.errors" class="error">username is required!</div>
    See http://www.mkyong.com/spring-mvc/spr...s-tag-example/


    -Kaj

  3. #3
    Join Date
    Aug 2011
    Posts
    24

    Default add default text to each error element

    @kaj..

    Is there any way I can add a default text to each Error element?

    Lets say, I want to add text "Error:" in front of the actual message. So far I have been adding that text to each error message manually. Is there any way we can do that programmatically from Spring

Tags for this Thread

Posting Permissions

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