"View and then probably Edit " scenario

Hi,

I have a JSP page which displays attributes of an object in view-only mode. The user might click 'Edit' or click cancel and move on to some other page.

Currently I am storing the object id as hidden value in the view jsp and when the user clicks edit I make an explicit db call, retrieve the same object based on the hidden object id and show the page in editable mode . Is this a good approach? Or should I store the object in session and when the user clicks edit retrieve from session and show it in editable mode?

[i am using Struts Framework]

I would like to know how you guys handle this "View and then probably Edit" scenario.

Thanks

dini

[694 byte] By [diniakia] at [2007-10-2 21:54:09]
# 1

> Hi,

> I have a JSP page which displays attributes of an

> object in view-only mode. The user might click 'Edit'

> or click cancel and move on to some other page.

>

> Currently I am storing the object id as hidden value

> in the view jsp and when the user clicks edit I make

> an explicit db call, retrieve the same object based

> on the hidden object id and show the page in editable

> mode . Is this a good approach? Or should I store the

> object in session and when the user clicks edit

> retrieve from session and show it in editable mode?

>

I tend to go with the former, as you have to worry about stale date when you pull an object from session. Also you can lock the record (if your DB allows) when the user elects to edit, which could involve a trip to the DB anyway.

Good Luck

Lee

tsitha at 2007-7-14 1:10:05 > top of Java-index,Other Topics,Patterns & OO Design...
# 2
Thanks Lee for your opinion.
diniakia at 2007-7-14 1:10:05 > top of Java-index,Other Topics,Patterns & OO Design...