I am assigning the formatted date to an <form:input> tag but instead of the formatted date, the jstl code is allocated to the textfield.

<form:input path="DOB" value="<fmt:formatDate pattern='dd/MM/yyyy' value='${editableUser.DOB}'/>" />
有帮助吗?

解决方案

Try this:

<fmt:formatDate pattern="dd/MM/yyyy" value="${editableUser.DOB}" var="myDateVar"/>
<form:input path="DOB" value="${myDateVar}"/>

Tested and Working.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top