Results 1 to 4 of 4

Thread: A simple check for form errors in JSP page?

  1. #1
    Join Date
    Mar 2009
    Posts
    2

    Default A simple check for form errors in JSP page?

    Hello

    I need, what seem to me, a very simple check in a JSP-page to see if there are any errors at all that I have added, after submit. It could look something like this:

    <c:if test="${command.errors}">
    My html code...
    </c:if>

    (where "command" would be my form). I havn't been able to find an example of how to check this in a page. I'm looking for the same Java function as "errors.hasErrors()". I'm not looking to print them in the page, at this point, just determine if errors exist so I can write different HTML.

    Thanks

  2. #2

    Default

    i think that the tag you are looking for is:
    <spring:hasBindErrors name="${form}">
    </spring:hasBindErrors>

    it exposes the errors in the "errors" variable

  3. #3
    Join Date
    Mar 2009
    Posts
    2

    Default Almost!

    Thanks, this is almost what I want, it's just that I also need cases when there are no errors. Can this tab be written in its opposite as well?

  4. #4
    Join Date
    Nov 2009
    Posts
    1

    Default Hi

    Can anyone provide code for a window where i can check the errors of any jsp code.....i am in desperate need of it.....

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
  •