I like the Spring's form tags. It just does what it what I wanted. Registered a custom date editor in the controller and used Spring's select tag for the date selection instead of input to a text box.
<form:select path="birthDate.date"> <c:foreach var="date" begin="1" end="31" step="1"> <form:option value="${date}"></form:option> </c:foreach> </form:select> <form:select path="birthDate.month"> <c:foreach var="month" begin="0" end="11" step="1"> <form:option value="${month}" label="${1+ month}"></form:option> </c:foreach> </form:select> <form:select path="birthDate.year"> <c:foreach var="year" begin="45" end="106" step="1"> <form:option value="${year}" label="${1900 + year}"></form:option> </c:foreach> </form:select> <spring:bind path="account.birthDate"> <span class="error">${status.errorMessage}</span> </spring:bind>Doing forms for date inputs used to be a pain with Struts.
No comments:
Post a Comment