Four, query-ajax

Four, query-ajax

1. The index.jsp page directly sends an ajax request to query the employee paging data

2. The server returns the detected data to the browser in the form of a json string

3. The browser receives the js string. You can use js to parse json, and use js to change the page through dom.

4. Return json. Realize the independence of the client.

Five, add

Insert picture description here
New logic:

  1. Click "Add" on the index.jsp page
  2. Pop up the new dialog
  3. Go to the database to query the department list and display it in the dialog box
  4. The user enters data and performs verification: jquery front-end verification, ajax user name repeated verification, important data (back-end verification (JSR303), unique constraint);
  5. Finish saving
  6. Close modal
  7. Jump to the last page

HATE:

  • /emp/{id}GET query employees
  • /emp POST save employee
  • /emp/{empId} PUT modify employee
  • /emp/{ids} DELETE delete employee

Six, modification

Insert picture description here
Modify logic:

  1. Click to edit
  2. Pop up a modal box modified by the user (display user information)
  3. Click update to complete user modification
  4. Close modal
  5. Jump to the current page

Seven, delete

Insert picture description here
Single/batch delete logic:

  1. Click the corresponding delete
  2. Prompt to confirm whether to delete
  3. Delete after confirmation
  4. Jump back to the current page

Guess you like

Origin blog.csdn.net/Lu1048728731/article/details/115209848