Results 1 to 3 of 3

Thread: Should i18n happen in controller or view?

Hybrid View

  1. #1
    Join Date
    Aug 2004
    Posts
    14

    Default 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. #2

    Default Re: Should i18n happen in controller or view?

    Quote 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.

    Quote 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.

  3. #3

    Default

    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.)

Similar Threads

  1. Replies: 5
    Last Post: Feb 3rd, 2011, 05:18 AM
  2. View to forward to another controller?
    By justinp in forum Web
    Replies: 6
    Last Post: Apr 2nd, 2010, 01:53 PM
  3. Replies: 9
    Last Post: Nov 1st, 2005, 10:36 PM
  4. Content Provider vs View Model
    By Martin Kersten in forum Swing
    Replies: 21
    Last Post: Mar 10th, 2005, 02:25 PM
  5. Replies: 5
    Last Post: Dec 16th, 2004, 01:50 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •