This week's book giveaway is in the JavaFX forum.
We're giving away four copies of Introducing JavaFX 8 Programming and have Herbert Schildt on-line!
See this thread for details.
The moose likes Struts and the fly likes Capturing a list of details from the UI to ActionForm Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Introducing JavaFX 8 Programming this week in the JavaFX forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Capturing a list of details from the UI to ActionForm" Watch "Capturing a list of details from the UI to ActionForm" New topic

Capturing a list of details from the UI to ActionForm

Natalie Ap
Ranch Hand

Joined: Jan 09, 2009
Posts: 49
On my UI, I am displaying a list of objects:

  • Employee id: 1
    Employee Name: xyz
    Age : 28
    Phone: 235325

  • Employee id: 2
    Employee Name: abc
    Age : 30

  • Employee id: 3
    Employee Name: pqr
    Age : 25
    Phone: 363433

  • The above fields are editable (except employee id) and have been loaded dynamically on basis of a search mechnism (to load employees with specific properties.) Since they have been loaded dynamically, the names of all fields are the same on the UI. They look like this.

    Similarly for phone. But phone may or may not exist on the UI depending on whether an employee has a phone or not.

    The entire form has one submit button, mapped to an updateAction to update the new details put in by the user.

    My Action form contains a String[] array txtname, String[] array txtage and and String[] array txtphone. When the details on the UI are captured in the above properties, in order to decipher which employee name, age or phone corresponds to which employee id, I have appended the employee id to the values of the textboxes.

    BUT I think there must be a way in which i could capture these details in a better manner (in objects). So, in the my ActionForm i could have a list of Employee objects, each of which would contain the details submitted from the UI. But i am not able to figure out how to go about this.

    First of all, can my ActionForm contain an Employee List which could be populated automatically with details from the UI??

    I am simply looking for a better way to do this. Please advise.


    I agree. Here's the link:
    subject: Capturing a list of details from the UI to ActionForm
    jQuery in Action, 3rd edition