Solved

Struts form tabs

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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Securing Jmx Console and web console 2 64
Error trying to install RTMT Win7 5 40
Apps blocked by Java 9 59
even odd program using while loop 3 25
INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
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…
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
This video teaches viewers about errors in exception handling.

914 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now