I have a form bean EmployeeFormBean which contains the information for a particular employee .
In my JSP there is a table with variable no of rows each row representing one employee details
Using an "Add Row " button users can add a new row in the table and fill in the details of the employee.
After entring data for n no of employees in the table the form is submitted
My question , how do i transfer this information of a collection of employee form beans.
I cant use nested beans since the no of rows in the table can be known only at run time and I need to create a new row each time the user presses "Add Row"
Currently I have only figured out how to dynamically create the table (using regular html elements not struts elements using functions like document.createElement ). But even then how do i transfer this info to action class
Will be really grateful for any sort of hints/tips/solutions
I used an IFRAME, when someone changed something I would change the src of the IFRAME to point to a new page, the same page actually, just with a query string appended with all the input variables. The browser will not refresh or jump to the top of the page. All the user will see is the load animation (which will not last long since the requested page will contain nothing)
Thanks you very much for giving me some possible solutions
However , i want a solution which can be done without going back to the server
Basically i dont want to go to server since the user has not committed the data until he creates all the table data and submits the form
posted 15 years ago
If I weren't going to use the IFRAME solution I would probably figure out a way to encrypt the data in a single field. As I think the hidden fields would probably be a lot messier.
I have found a much better approach using indexed properties of javabeans in struts.
Using this property it is possible to submit multiple instances of the same actionform (ie multiple rows of data )in a single submit.
Will you know once I get the right procedure
posted 15 years ago
I do not doubt that it is possible to accomplish this on the server side, what I am wondering is how it will work in the browser and be presented to the user. IMO, that is the most difficult part of the problem.
No it will not be on the server side . It will be on the client side itself
There will be a button on the page something like "Add Row" which the user can press to add another row of details .
Only thing i have to make sure is that the new text boxes created have the correct name corresponding to the indexed property of the java bean so that the data can be transferred once the submit button is pressed
Hey , and good news . Its working I need some time to consolidate the complete code I will then post it .
There will be plenty of time to discuss your objections when and if you return. The cargo is this tiny ad: