This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
I am using Struts 1.1 and I have the following requirement. The scenario is, for example I have a customer page. In my application, based on the user selection, I have to allow the user to enter maximum of 10 customers. When the user finish with the page one and click on "continue", then I have to show the same page to ask for the next customer information. I don't want to create Customer1.jsp Customer2.jsp . . . Customer10.jsp.
In that case, I would like to index the pages by using one Customer.jsp file, to identify the different customer information.
Well obviously you have your action process the pages one at a time as they are submitted. By this I mean, you gather the information from the Action form, and save it into a variable somewhere. List of customer objects? Maybe in session scope? When the page gets submitted again, you just add the records onto the end of your existing list.
Do you have to go back and edit the customers already entered?
Joined: Jan 11, 2003
Thanks for your reply. Yes I have to go back and edit the customer details some times. For example, assume I have completed 7 customer pages, but I want to edit the the 3rd customer page. I would click on the "Customer 3" tab and directly go there and edit and save the information.
In that case, how do I tell the session, that I am editing the 3 customer ?
You can have the LoadAction take the customer number as parameter. On your jsp page, pass the customer number to your SaveAction. On success, the SaveAction should increment the customer number, and forward to the Load Action. The tabs on the top can call LoadAction and pass the correct customer number