• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How does struts handle dynamic forms that grow and its retrieval?

 
John Zwick
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a page where a user can create an account using a form. Inside the form there is a table where they can add form elements (both text boxes and drop downs) dynamically using javascript to add as many new rows of inputs as the user wants.
I understand that when the input properties are stored as an array in the form bean, struts will automatically handle the inputs and set then into the appropriate arrays. However, when the user wants to "edit" their account, I have to display those rows of inputs they entered when they created the account. How does struts handle the order , will they be in the same order as the user entered? How do I tell the jsp to generate the x amount of input rows and populate each row correctly with what the user intially entered?
 
Pavel Kazlou
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, you should specify which version of Struts you use. It seems like Struts 1 (you use "form bean"). For generating input boxes use logic tags
http://struts.apache.org/1.2.9/userGuide/struts-logic.html
in the scope of each iteration you can access the element and its value.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic