Announcement Announcement Module
Collapse
No announcement yet.
Spring error tag problem Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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
    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

    Comment


    • #3
      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

      Comment

      Working...
      X