After adding a set of editable table rows to a showModalDialog, is there a way to pass the row(s) to a JSP?
-
11-06-2021 - |
سؤال
Here is what I have and what I need info on:
- I have an HTML
table
withcheckbox
es in one JSP. - When the user selects a
checkbox
and then hits the submitbutton
, I open ashowModalDialog
(IE-api-doc), (Firefox-api-doc) screen. - I need to fetch the entire row and then display it on the
showModalDialog
as an editable field.
For example, I have a row with: name
, dob
, employee id
, office loc
and then a checkbox
. When I select one of the rows, I am able to store the rowid
as well as the row itself in a string.
How should I pass this to the JSP (where the showmodaldialog
points to) and then make it into a editable row and display it on the screen? If the user selects 3 rows, all three rows should display as editable fields on the showmodaldialog
screen.
المحلول
Use JavaScript to find the selected employees, and compose a URL with the IDs of all the selected rows (3, 54 and 867 for example):
/foo/editEmployees?ids=3&ids=54&ids=867
Invoke showModalDialog()
with this URL as argument.
In the servlet mapped to /editEmployees
, use request.getParameterValues("ids")
to get the IDs of the employees to edit. Get the information of these employees from the database and generate the HTML page containing the form to edit these employees.