java - How to get cell data of specific row from the dynamically created HTML table? -


How to obtain a specific line of cell data from a dynamically-generated HTML table in JSP?

I am creating JSP page in the following manner

  1. Connect to MySQL database
  2. Get rows from the table based on parameters
  3. Design based on the HTML table step 2
  4. The first column of the table contains a checkbox
  5. The JSP page contains a Submit button
  6. Select the checkbox for some rows
  7. Click on the submit button, which check check I can choose Oks?

Give all checkboxes the same name, but a different value, e.g. Line ID

  & lt; Table & gt; & Lt; C: forEach item = "$ {list}" var = "line" & gt; & Lt; TR & gt; & Lt; Td> & Lt; Input type = "checkbox" name = "queued" value = "$ {row.id}" & gt; & Lt; / Td> & Lt; TD & gt; $ {Row.name} & lt; / TD & gt; & Lt; TD & gt; $ {Row.value} & lt; / TD & gt; ... & lt; / Tr & gt; & Lt; / C: foreach & gt; & Lt; / Table & gt;  

Then you can get the checks in the server side used from the following:

  string [] rowids = request.getParameterValues ​​( "Rowid"); // ...  

Comments