Solved

Struts form tabs

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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

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…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.

758 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

21 Experts available now in Live!

Get 1:1 Help Now