Announcement Announcement Module
No announcement yet.
Command Object binding question Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Command Object binding question

    I am new to Spring MVC, and I have come accross a problem to which I cannot see an easy solution, hopefully someone here can help.

    I have a domain object which I would like to use as a command object in my controller.

    However some fields in this class are 'translatable' in that the getters/setters for these fields look something like this (as an example)

        public String getName(Locale aLocale) {
            return getMessageValue(getNameMessageCode(), aLocale);
        public void setName(String aName, Locale aLocale) {
            setMessageValue(getNameMessageCode(), aName, aLocale);
    Somehow I would like to bind these fields using the spring form tags and binding/validation mechanism, but its not obvious to me how to do it because of the additional Locale paramater.

    There is some scope to add other accessor methods on the domain objects if required, but I would rather not create additional Form classes as proxies for the domain objects if I can help it.

    If anyone has any ideas I would be very interested to hear them