h-rai
h-rai

Reputation: 3964

JSTL fmt formatDate tag is passed as it is instead of the desired value

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}'/>" />

Upvotes: 5

Views: 2753

Answers (1)

venki
venki

Reputation: 1131

Try this:

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

Tested and Working.

Upvotes: 6

Related Questions