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

  • Spring 2.5rc1 errors tag

    After rolling to Spring 2.5rc1, the form:errors tag is throwing an exception when I try to display the global error message. Here is how I have used this tag successfully in the past to display the form's global error message.

    <form:errors cssClass="error" />

    Now when I use this, I get the following exception.

    ERROR [web.servlet.tags.form.ErrorsTag] Invalid property '' of bean class [org.myproject.bean.SomeFormBean]:
    Bean property '' is not readable or has an invalid getter method:
    Does the return type of the getter match the parameter type of the setter?
    org.springframework.beans.NotReadablePropertyExcep tion:
    Invalid property '' of bean class [org.myproject.bean.SomeFormBean]:
    Bean property '' is not readable or has an invalid getter method:
    Does the return type of the getter match the parameter type of the setter?
    at org.springframework.beans.BeanWrapperImpl.getPrope rtyValue(BeanWrapperImpl.java:544)
    at org.springframework.beans.BeanWrapperImpl.getPrope rtyValue(BeanWrapperImpl.java:536)
    at org.springframework.validation.AbstractPropertyBin dingResult.getActualFieldValue(AbstractPropertyBin dingResult.java:78)
    at org.springframework.validation.AbstractBindingResu lt.getFieldValue(AbstractBindingResult.java:337)
    at org.springframework.web.servlet.support.BindStatus .<init>(BindStatus.java:118)
    at org.springframework.web.servlet.tags.form.Abstract DataBoundFormElementTag.getBindStatus(AbstractData BoundFormElementTag.java:171)
    at org.springframework.web.servlet.tags.form.ErrorsTa g.shouldRender(ErrorsTag.java:131)

    The only way I can get it to not throw an exception is by displaying all error messages including the field level messages this way.

    <form:errors path="*" cssClass="error" htmlEscape="false" />

    This ends up showing field level messages as well which is not desired. Is there a new path I should use for the global error message display?

  • #2
    Global Error or Is it ?

    When u say global error, how did u manage it ?

    The Errors interface comes with methods reject() & rejectValue(). What did u use ?

    I use reject() for such errors and it works like charm with <form:errors cssClass="error" />

    Regards,
    Smruti..

    Comment


    • #3
      Global Error Setting

      This would be a message that I would display at the top of the form using the following syntax.

      Code:
      errors.reject(null, "Please correct the form values.");
      This results in a global error message that is not tied to a specific field being added to the errors. With previous versions of Spring, I was able to display this global message at the top if my form by not including a path on the form:errors tag, and then field specific error messages on each field by adding the path on the form:errors tags on each field. On 2.5rc1, if I do not include the path on the errors tag, an exception is thrown. This did work in version 2.0.6.

      Comment


      • #4
        Originally posted by fuzzbient View Post
        This would be a message that I would display at the top of the form using the following syntax.

        Code:
        errors.reject(null, "Please correct the form values.");
        This results in a global error message that is not tied to a specific field being added to the errors. With previous versions of Spring, I was able to display this global message at the top if my form by not including a path on the form:errors tag, and then field specific error messages on each field by adding the path on the form:errors tags on each field. On 2.5rc1, if I do not include the path on the errors tag, an exception is thrown. This did work in version 2.0.6.
        Try this instead - errors.reject("Please correct the form values.");

        Lemme know what happens.

        Regards,
        Smruti..

        Comment


        • #5
          Originally posted by smrutimo View Post
          Try this instead - errors.reject("Please correct the form values.");

          Lemme know what happens.

          Regards,
          Smruti..

          Just noticed the Spring version u mentioned... Hmm.. Yeah I also use 2.0.6.. My bad !! Guess I need a break from this desk.. Lemme know if this one works though...

          Thanks & Regards,
          Smruti..

          Comment


          • #6
            That would work in 2.0.6 but this is strictly an issue with the form:errors tag in 2.5rc1. Is it a bug or an "enhancement?"

            Comment


            • #7
              It looks like a potential bug. The JavaDoc for the <form:errors> tag states that it should be possible to display object-level errors only by omitting the "path" attribute:

              http://static.springframework.org/sp...ErrorsTag.html

              I've opened a JIRA issue for further investigation:

              http://opensource.atlassian.com/proj...rowse/SPR-4005

              Comment


              • #8
                Thank you for logging the issue in Jira. I'll monitor it and test the update if it becomes available.

                Comment


                • #9
                  Try this...
                  <form:errors>
                  <form:errors cssClass="errorText"/>
                  </form:errors>

                  it should work fine

                  Comment

                  Working...
                  X