After adding a set of editable table rows to a showModalDialog, is there a way to pass the row(s) to a JSP?

StackOverflow https://stackoverflow.com/questions/10769668

  •  11-06-2021
  •  | 
  •  

سؤال

Here is what I have and what I need info on:

  1. I have an HTML table with checkboxes in one JSP.
  2. When the user selects a checkbox and then hits the submit button, I open a showModalDialog(IE-api-doc), (Firefox-api-doc) screen.
  3. 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.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top