Reputation: 845
I have date type Java object. I want to display that in textbox, allow the user to change it, submit that along with the form. I am attaching the datepicker using class date with the textbox to take the input from user. But I want to set some initial value in the texbox from datevar in specified format. How can specify the format ?
<td><p>Date: <input type="text" class= "date" name = "date" value = "${dateVar}"/></p></td>
I have used the format for label as following:
<td><fmt:formatDate value="${dateVar}" pattern="MM-dd-yyyy" /></td>
Can I do something like that for my textbox as well ?
Upvotes: 0
Views: 11368
Reputation: 11579
Just combine them:
<input type="text" class= "date" name = "date" value = "<fmt:formatDate value="${dateVar}" pattern="MM-dd-yyyy" />"/>
Upvotes: 2