| |
24. 16. 1. JSTL格式选择和复选框组 |
|
<%@ 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) |
|