JSTL Form Select and CheckBox Group : Form Select « JSTL « Java Tutorial






<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>

<html>
<head>
<title>EL Implicit Object Example</title>
</head>
<body>
<h1>EL Implicit Object Examples</h1>
<form action="formproc.jsp" method="post">
<table>
<tr>
 <td colspan="2"><h3>Design a Cake</h3></td>
</tr>
<tr>
<td>Cake shape:</td>
<td>
  <select name="shape">
     <option>round</option>
     <option>square</option>
     <option>heart</option>
   </select>
</td>
</tr>
<tr>
<td valign="top">Toppings</td>
<td>
  <input type="checkbox" name="topping" value="choc">Chocolate</input><br/>
  <input type="checkbox" name="topping" value="cane">Candy Cane</input><br/>
  <input type="checkbox" name="topping" value="flower">Flower</input><br/>
</td>

</tr>

<tr>
<td colspan="2">
  <center><input type="submit" value="Send"/></center>
</td>
</tr>
</table>
</form>
</body>
</html>
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>

<html>
<head>
<title>EL Implicit Object Example Form Processor</title>
</head>
<body>
<h1>EL Implicit Object Example Form processor</h1>

<b>Shape of cake selected:</b>
<c:out value="${param.shape}"/>
 
 <br/>
<b>Toppings selected:</b> 

<c:forEach var="aTopping" items="${paramValues.topping}">
 <c:out value="${aTopping}"/>
</c:forEach>
<br/>


<small><a href="index.jsp">back to form</a></small>
</body>
</html>
  Download:  JSTLFormSelectAndCheckBoxGroup.zip( 1,022 k)








24.16.Form Select
24.16.1.JSTL Form Select and CheckBox Group
24.16.2.Use JSTL to Check Selected Value From Form Select Option
24.16.3.Add/Remove Form Select Option Item