• Post Reply Bookmark Topic Watch Topic
  • New Topic

Capturing a list of details from the UI to ActionForm  RSS feed

Natalie Ap
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

    It is sorta covered in the JavaRanch Style Guide.
    • Post Reply Bookmark Topic Watch Topic
    • New Topic
    Boost this thread!