<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %><%@ taglib uri="http://java.sun.com/jstl/fmt" prefix="fmt" %> <html> <head> <title>Parse Date</title> </head> <body> <form method="POST"> <table> <tr> <td width="100%" colspan="2"> Date Formatting </td> </tr> <tr> <td width="47%">Enter a date to be parsed:</td> <td width="53%"> <input type="text" name="num" size="20" /> </td> </tr> <tr> <td width="100%" colspan="2"> <p align="center"> <input type="submit" value="Submit" name="submit" /> <input type="reset" value="Reset" name="reset" /> </p> </td> </tr> </table> <P> </p> </form> <c:if test="${pageContext.request.method=='POST'}"> <table> <tr> <td width="100%" colspan="2"> Formatting: <c:out value="${param.num}" escapeXml="false" /> </td> </tr> <tr> <td width="51%">type="date" dateStyle="short"</td> <td width="49%"> <c:catch var="e"> <fmt:parseDate var="i" type="date" dateStyle="short" value="${param.num}" /> <c:out value="${i}" escapeXml="false" /> </c:catch> <c:out value="${e}" escapeXml="false" /> </td> </tr> <tr> <td width="51%">type="date" dateStyle="medium"</td> <td width="49%"> <c:catch var="e"> <fmt:parseDate var="i" type="date" dateStyle="medium" value="${param.num}" /> <c:out value="${i}" escapeXml="false" /> </c:catch> <c:out value="${e}" escapeXml="false" /> </td> </tr> <tr> <td width="51%">type="date" dateStyle="long"</td> <td width="49%"> <c:catch var="e"> <fmt:parseDate var="i" type="date" dateStyle="long" value="${param.num}" /> <c:out value="${i}" escapeXml="false" /> </c:catch> <c:out value="${e}" escapeXml="false" /> </td> </tr> <tr> <td width="51%">type="date" dateStyle="full"</td> <td width="49%"> <c:catch var="e"> <fmt:parseDate var="i" type="date" dateStyle="full" value="${param.num}" /> <c:out value="${i}" escapeXml="false" /> </c:catch> <c:out value="${e}" escapeXml="false" /> </td> </tr> </table> </c:if> </body> </html>