Solved

Struts form tabs

Posted on 2007-03-24
2
3,016 Views
Last Modified: 2013-11-24
Hi ,
I am new to struts and i have to work in a project which have  a form which will  have 6 to 8 tabs. I would like to save the data when i move to another tab also could some one pls let me know how to design the project using struts???i also want to do some serverside validatons using validation frame work.
pls let me know all the steps in order  so that i can follow in my desgning and coding .
Thx and Regards
0
Comment
Question by:sreddy_k
2 Comments
 
LVL 30

Expert Comment

by:Mayank S
ID: 18786013
>> I would like to save the data when i move to another tab

You can hit a servlet through a Javascript method when the user clicks on another tab and the servlet can store the data in the HttpSession object. If you want to save to a DB later after all tabs are processed, you can retrieve the object from session and save it to a DB.

>> i also want to do some serverside validatons using validation frame work.

See the tutorial at: http://www.roseindia.net/struts/struts_validator_framework.shtml
0
 
LVL 9

Accepted Solution

by:
nimaig earned 500 total points
ID: 18917175
I would suggest you to have
1. Different ActionForm for different tabs : Reason being that each tab will differ in contents and it would be tough to handle and manage too much data in a single ActionForm.
2. You can have a single Action class to handle all the business logic / flow.
3. Have 2 buttons for each page 'Save' & 'Save & Exit'. 'Save' button can save the data and let the user be in the same tab. 'Save & Exit' will save the data and take the user to the main/master tab (may be the 1st tab).
4. Have a mechanism in the frontend (using JavaScript) to check if the user has modified any data in the screen (You can get free code in the net to do so). If the user has modified some data, while the user tries to change the tab, popup a javascript confirmation box asking something like this 'Data has been modified in this page. Do you want to save and proceed?'.
5. If the user opts for 'Saving', then save the data to the DB directly.
6. Load the data from the Data Source (say for ex. Database) each time the user visit the page/tab (i.e. clicks the tab).

Hope this helps.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.

749 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question