Announcement Announcement Module
Collapse
No announcement yet.
Should i18n happen in controller or view? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Should i18n happen in controller or view?

    What you think would be better approach, to get localized messages in controller and then put them into model or to put into model message keys and internationalize them in view? So far i used latter approach -- less code.
    Actually, I have more general question, what data you put into model, value objects or already HTML formatted strings(representing dates etc) which view only displays? How dumb should be view?

  • #2
    Re: Should i18n happen in controller or view?

    Originally posted by tv
    What you think would be better approach, to get localized messages in controller and then put them into model or to put into model message keys and internationalize them in view? So far i used latter approach -- less code.
    I'd use the latter approach as well.

    Originally posted by tv
    Actually, I have more general question, what data you put into model, value objects or already HTML formatted strings(representing dates etc) which view only displays? How dumb should be view?
    Definately objects (not "value" objects though, use real ones!). If you pass in html strings then you've effectively moved rendering into the model and out of the view.

    Comment


    • #3
      I agree with Edward, don't put any HTML stuff in the model. The model should be pure data.

      You can always use a JSP custom tag if you need to reuse a specific formatting of the data. (When the model is returned to the view, have the view call a JSP custom tag to handle all the formatting.)

      Comment

      Working...
      X