Announcement Announcement Module
Collapse
No announcement yet.
Best place to put data for the jsp? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Best place to put data for the jsp?

    Hello, I am curious as to what you all think about this. I am having trouble deciding where to put read-only data that the jsp needs. Let me explain:

    - When we are creating a form with fields that change we can bind to a command.
    - When we want to show reference data (like a list of US states that will never change) we can put that in the referenceData map.
    - What about when I want to show a representation of something read-only from my domain, like a list of images which all have a name, description, and other attributes. Should I create a field in command holding an array of MyImage objects or just put that array into referenceData?

    I know you can get to it either way from the jsp, I guess I am just looking for a best practice here. I tend to use both in a liberal manner and I want to get away from that. Should I keep everything which is not bound to a command in referenceData?

    thanks,
    Ryan

  • #2
    In our application we put dictionaries in session. There are not so many of them - countries, states, salutations. Maybe some more ... There is an interceptor to each request, which assures, that these dictionaries are in session. I think, we can put them in application scope, and to apply this solution we will need to change only interceptor class.
    As for read-only data - i prefer to have it in referenceData, and my Command class consists only of those items, which i want edit

    Comment

    Working...
    X