• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Html form to form bean mapping, multiple checkboxes

 
Himanshu Kansal
Ranch Hand
Posts: 257
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I have an html form and need to map it to a form object to be sent to action. The html form is like:
  • There are multiple rows.
  • Each row has a checkbox in the first column.
  • Second column has a name
  • Third column has a list of checkboxes


  • It is like a normal form that lists a series of records and certain operations can be performed upon multiple records, depending upon which rows have been checked.

    A unique ID is associated to each row.

    Here is what I've thought:
    The value of checkbox in first column can be the ID and this can be mapped to an array in the form bean.
    The checkboxes in column 3 can have same name, say chkAttr for all rows, and value as "ID_1", "ID_2" etc.
    This can be mapped to a String [] chkAttr in form bean.

    In this way I'll have to write a logic to get the values pertaining to a particular ID from chkAttr[].

    This is one approach. Is there a better way?

    PS: I don't know Struts, just saw the application flow and applying logic.

    Regards

     
    Himanshu Kansal
    Ranch Hand
    Posts: 257
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Does anyone have any comments on this?

    I would like to know how forms of this type are mapped in struts. I know how to do it best in plain JSPs.
     
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic