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:

  1. it's time rename "etudinat" class "etudiant", before gets referenced everywhere.
  2. 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.
  3. 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

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -