Announcement Announcement Module
No announcement yet.
Command Object - Can I map names of form variables? Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Command Object - Can I map names of form variables?

    I have a form that's coming from a different system that I have no control over. It uses dashes in the names of it's form variables I have to accept with my Spring Controller. Since Java won't let me use dashes in the setter methods of my command object bean, I'm looking for a way to map/convert them to a name without dashes. My searching has turned up nothing useful. Thanks.

  • #2
    Hmm. Interesting problem.

    I would attack this in one of two ways, either create a filter which uses a HttpServletRequestWrapper and "translates" all the request parameters, or create your own ServletRequestDataBinder and override the creation of PropertyValues.

    I think I prefer the Filter because it is more discrete/transparent.



    • #3
      Good suggestions. Thank you very much.