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
- Connect to MySQL database
- Get rows from the table based on parameters
- Design based on the HTML table step 2
- The first column of the table contains a checkbox
- The JSP page contains a Submit button
- Select the checkbox for some rows
- 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
Post a Comment