且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何使fmt:formatDate适用于form:input

更新时间:2023-11-22 13:33:16

您不能在另一个JSP标记的属性中使用JSP标记.将日期格式的结果存储在page属性中,并使用此page属性(就像对Java中的变量所做的那样):

You can't use a JSP tag in an attribute of another JSP tag. STore the result of the date formatting in a page attribute, and use this page attribute (as you would do with a variable in Java):

<fmt:formatDate value="transactions['${loopStatus.index}'].valueTransactionDate"  
                type="date" 
                pattern="yyyy-MM-dd"
                var="theFormattedDate" />
<form:input type="text" path="..." value="${theFormattedDate}"/>