| |
24. 21. 2. 解析日期输入形式和格式 |
|
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
<form method="post" action="dateHandler.jsp">
Please enter your birthday:
<select name="month">
<option value="Jan">January</option>
<option value="Feb">February</option>
<option value="Mar">March</option>
<option value="Apr">April</option>
<option value="May">May</option>
<option value="Jun">June</option>
<option value="Jul">July</option>
<option value="Aug">August</option>
<option value="Sep">September</option>
<option value="Oct">October</option>
<option value="Nov">November</option>
<option value="Dec">December</option>
</select>
<select name="day">
<c:forEach begin="1" end="31" var="day">
<option><c:out value="${day}"/></option>
</c:forEach>
</select>
<select name="year">
<c:forEach begin="1930" end="2003" var="year">
<option><c:out value="${year}"/></option>
</c:forEach>
</select>
<input type="submit" value="Submit" />
</form>
|
|
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jstl/fmt" %>
<fmt:parseDate
var="date"
parseLocale="en_US"
value="${param.month} ${param.day}, ${param.year}"/>
You were born
<fmt:formatDate
value="${date}"
dateStyle="full"/>.
|
|
Download: JSTLParseDateFromFormAndFormat.zip( 939 k) |
24. 21. 解析日期 | | 24. 21. 1. | 输出所有时区 | | | | 24. 21. 2. | 解析日期输入形式和格式 | | | | 24. 21. 3. | 从表单解析日期 | | |
|