Use Choose/When/Otherwise to Check Form CheckBox Data : Form CheckBox « JSTL « Java Tutorial


<form method="post" action="checkbox.jsp">
  <P>Please check adjectives you would
  use to describe this web site's
  customer service:</p>

  <input type="checkbox" name="feedback" value="atrocious"/></p>

  <input type="checkbox" name="feedback" value="loathsome"/></p>

  <input type="checkbox" name="feedback" value="flagitious"/></p>

  <input type="checkbox" name="feedback" value="satisfactory"/></p>

  <P><input type="submit" value="Submit" /></p>


<%@ taglib prefix="c" uri="" %>

 <c:when test="${not empty}">
  You described our customer service as
  <c:forEach items="${}" var="adj">
      <c:when test="${adj == 'satisfactory'}">
         <font size="+2">
         <font size="-2">
    <li><c:out value="${adj}"/></li>
  You didn't choose any feedback checkboxes.
  Download: 940 k)

24.14.Form CheckBox
24.14.1.Use ForEach to Check Form CheckBox Data
24.14.2.Use Choose/When/Otherwise to Check Form CheckBox Data
24.14.3.Use Bean to Deal with CheckBox