File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes Session or DB Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Session or DB" Watch "Session or DB" New topic

Session or DB

Sahil Sharma
Ranch Hand

Joined: Aug 27, 2003
Posts: 152

I have a requirement wherein I am taking the user input in 7 steps. Each step is a JSP.
I am wondering what is the best approach with respect to saving the data.

a) Should I save the data in session as the user moves from step1 to step7 and then save it in the database. This approach will put huge data in the session. Though the user base of this application is only 5-6 users.

b) Save it everytime in the database as the user moves from step1 to step7. The problem with this approach is what if user decides not to complete all the steps and leave after step4 then I will have to rollback the data for Step1 to Step4.

Secondly, currently we have given Next button on each JSP page to move to next Step. Can this also be implemented in tabs wherein each tab will be a seperate JSP page?

I am using Struts framework to develop the application.

Please advise.
Shailesh Narkhede
Ranch Hand

Joined: Jul 10, 2008
Posts: 368
Better to put data in session,
because after you given data in 4 steps as you said you can rollback how would be do that?
Is that 7 steps having 7 different DB tables?
If that is so we need so have column in that tables which is reffering to main table PK of user.
On that basis we can delete that data after 4th step. but that not sounds good.

So I thing better to hold data in session till 7 step.

I agree. Here's the link:
subject: Session or DB
It's not a secret anymore!