Solved

Struts form tabs

Posted on 2007-03-24
2
3,014 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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Suggested Solutions

After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
I had a project requirement for a displaying a user workbench .This workbench would consist multiple data grids .In each grid the user will be able to see a large number of data. These data grids should allow the user to 1. Sort 2. Export the …
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…

777 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