-2

I am learning Spring MVC, I am wondering how to delete multiple rows (similar to when you select rows from Yahoo or Gmail then delete them)?

1
  • @akram...you mean selecting the multiple items at a time and click delete? Commented Dec 20, 2012 at 3:19

1 Answer 1

4

Some homework for you:

  1. Create a form which displays your data in tabular format
  2. Each row contains a checkbox (checkbox name can be "foo"). Checkbox value can be IDs of your data
  3. Create a form object (java bean) which has list of strings List<String> foo. This list will store the ids of selected checkbox
  4. Create a controller which accepts form (see pt. 3) as model object.
  5. On submit of your form (the one on tabular format page > see pt 1) send the POST request to controller (see pt 4). In controller you'll have list of all IDs that user has selected. Now all you need is to delete those from database using some logic (<

Hope that'll get you started.

Extra exercise: Read more about Checkboxes, Spring MVC and Binding checkboxes in spring mvc

P.S. You get code examples only when you try yourself and post some :)

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.