Announcement Announcement Module
Collapse
No announcement yet.
Data binding issue String -> Domain Object Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Data binding issue String -> Domain Object

    I am new to alot of the technologies employed behind the scene so I will begin with what I am trying to achieve.

    I want to supply a Form with a current setting from the form backing object, but have it be immutable. Upon submission of the form I want to reference the original object supplied to the update form.

    What is happening is that I can get the update form to display the object settings, but upon submission it is coming across as null with a BindingResults error with the error being String -> Object type conversion error. This will work if I bind the property to a form:select/option pair. I took that model from the autogenerated code from Roo.

    My research points to the potential need of a custom DataBinder but I am unsure of whether or not that is necessary or how to approach doing that within the generated code.

    Thanks,

    -Pete G

  • #2
    Just tell the existing binder to ignore that field, by adding this method to the controller:

    Code:
    @InitBinder
    public void canBeCalledAnything(WebDataBinder binder) {
        binder.setAllowedFields(...);  // leave out the immutable one
    }

    Comment

    Working...
    X