Announcement Announcement Module
Collapse
No announcement yet.
case sensitive request parameters Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • case sensitive request parameters

    I hope there's a simple answer out there! I have some legacy systems I'm integrating with, and they pass a request parameter 'Name' for example, as opposed to 'name'. The problem is that the binding to the command bean fails. The command bean has a 'getName()/setName()' bean pair, but BeanWrapperImpl has a cache with 'name', but not 'Name'. Since request parameters are case sensitive, how do I make Spring or the bean wrappers handle this?

    Thanks

  • #2
    BTW, the error also comes from the spring input tag.. that ultimately calls the BeanWrapper as well.

    Comment


    • #3
      Hi,

      Can you post the source code? So that its easy for us which is need to be debug?

      Thanks,

      Comment


      • #4
        Certainly!

        Here's the snippet of jsp:

        <spring:form method="POST" commandName="userInfo">

        ...

        <spring:input path="Name"/>

        The command bean (UserInfo) has getName() and setName() methods. When the input tag renders, however..

        Code:
        org.springframework.beans.NotReadablePropertyException: Invalid property 'Name' of bean class [com.xxx.web.examples.user.UserInfo]: Bean property 'Name' 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.getPropertyValue(BeanWrapperImpl.java:534)
        	at org.springframework.beans.BeanWrapperImpl.getPropertyValue(BeanWrapperImpl.java:526)
        	at org.springframework.validation.AbstractPropertyBindingResult.getActualFieldValue(AbstractPropertyBindingResult.java:77)
        	at org.springframework.validation.AbstractBindingResult.getFieldValue(AbstractBindingResult.java:337)
        	at org.springframework.web.servlet.support.BindStatus.<init>(BindStatus.java:117)
        	at org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.getBindStatus(AbstractDataBoundFormElementTag.java:179)
        	at org.springframework.web.servlet.tags.form.AbstractHtmlElementTag.resolveCssClass(AbstractHtmlElementTag.java:404)
        	at org.springframework.web.servlet.tags.form.AbstractHtmlElementTag.writeDefaultAttributes(AbstractHtmlElementTag.java:380)
        	at org.springframework.web.servlet.tags.form.AbstractHtmlInputElementTag.writeDefaultAttributes(AbstractHtmlInputElementTag.java:177)
        	at org.springframework.web.servlet.tags.form.InputTag.writeTagContent(InputTag.java:139)
        	at org.springframework.web.servlet.tags.form.AbstractFormTag.doStartTagInternal(AbstractFormTag.java:93)
        	at org.springframework.web.servlet.tags.RequestContextAwareTag.doStartTag(RequestContextAwareTag.java:77)

        Comment


        • #5
          Sorry, I am missing something here. You say:
          I have some legacy systems I'm integrating with
          And yet you are talking about handling this type of property with both a form and server-side code. How/where does the legacy system fit in?

          Comment


          • #6
            legacy system

            Originally posted by pmularien View Post
            Sorry, I am missing something here. You say:

            And yet you are talking about handling this type of property with both a form and server-side code. How/where does the legacy system fit in?
            The legacy system is generating the URL.. otherwise I'd just have them lowercase the request parameter!

            Comment


            • #7
              onBind()

              Also.. btw, I know I can override the onBind() in the controller to handle this manually. I was just wondering whether there was some easy way to keep using the reflection based approach but handle these parameters that start with a capital letter.

              Comment


              • #8
                I have an enhancement request in for this: http://jira.springframework.org/browse/SPR-4517

                Comment


                • #9
                  If you go the onBind() route I'd love to see the code. I couldn't figure out how to do it.

                  Comment


                  • #10
                    Anyone solved this type of problem yet?

                    Comment

                    Working...
                    X