Announcement Announcement Module
Collapse
No announcement yet.
Spring Formatters inside data model, is this a violation of MVC? Alternative? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring Formatters inside data model, is this a violation of MVC? Alternative?

    Spring provides formatters (and converters) with the use of annotations. This means that a request parameter can be annotated on a controller to format user input and also a property of a data model class can be annotated to format data for a view.

    The latter seems to me as a clear violation of MVC's main purpose, that is the separation between model and view. Annotating a data model class with formatting specifics binds the model to the view. If the model hast to be used for some other view or for anything else, it can't, since its fields are formatted for a specific view.

    If I am wrong let me know. If not, is there a way to format fields from and to view format without violating MVC?
Working...
X