html - How to Send a list of checkbox value? -
in jsp pageii print users in table , , admin can select many users delete
i print them
while (iter.hasnext()){ element =(etudinat) iter.next(); %> <tr> <th scope="row"><%=element.getusername() %></th> <td><%=element.getnom() %></td> <td><%=element.getprenom() %></td> <td><%=element.getsexe() %></td> <td><%=element.getemail() %></td> <td><%=element.getidfilliere() %></td> <td><input type="checkbox" name="supp" value="<%=element.getusername() %>"> <br></td> </tr> <% } %>
how can send values of inputs supp ??
i want send them form & javabean if thats possible, how can regroupe them on list !!
enclose checkboxes inside form, , add submit button in form:
<form method="post" action="the/path/to/your/action"> existing code containing chackboxes <input type="submit" value="delete checked users"/> </form>
besides:
- it's time rename "etudinat" class "etudiant", before gets referenced everywhere.
- using scriptlets in jsps bad practice years. use mvc framework stripes or spring mvc, use jsp el, jstl , tags. mvc framework take care of mapping form inputs javabean properties, , precisely want do.
- always escape strings when you're not absolutely sure can't contain html special chars. if student fills email address field
<script>while (true) {alert("you're asshole");}</script
>, boss won't happy.
Comments
Post a Comment