Announcement Announcement Module
Collapse
No announcement yet.
Best practice design to pass an objet of a collection from a jsp to a controller Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Best practice design to pass an objet of a collection from a jsp to a controller

    Hello,
    I'm writing this post to get some advice on how to design my web app in the best way. I'm using spring 2.5 and hibernate 3.

    This is the simplified behaviour:
    The first controller gets a list of objects from the DB and it displays this list on the first JSP page. The only information shown for each object is a name and few others. At this point, a user can click on a link to see more details for that particular object.
    Here comes the doubt.
    For the moment I just pass a parameter in the request ( something like /showObjectDetails.htm?id=${object.id} )
    and this request arrives to an abstractController that looking at the id parameter fetches again the object from the DB and shows the object with all the details.
    I know that fetching from the db is fast, but I would like to avoid all this.
    Is it possible to pass the object from the first jsp to the second controller?

    Sorry for my poor english, I hope that I was able to explain myself properly.
    Many thanks in advance

  • #2
    I would recommend loading the objects from the database each time. This will prevent you from running into stale data due to caching objects in the session (or wherever).

    If performance really becomes an issue then I would recommend implementing an Aspect Oriented cache around Data Access Objects. This way the code you write is unaware of any caching that is occurring and you can add in caching, and alter the details of the caching, on the fly using your spring configuration file.

    Comment


    • #3
      many thanks for the answer. I think that this is the way than...

      Originally posted by elameno View Post
      I would recommend loading the objects from the database each time. This will prevent you from running into stale data due to caching objects in the session (or wherever).

      If performance really becomes an issue then I would recommend implementing an Aspect Oriented cache around Data Access Objects. This way the code you write is unaware of any caching that is occurring and you can add in caching, and alter the details of the caching, on the fly using your spring configuration file.

      Comment

      Working...
      X