Ich habe eine JSTL-Schleife und ich möchte das Datum eines Formulars formatieren: Eingabe. Ich habe viele Permutationen einiger der Vorschläge, die ich online mag, ausprobiert, aber ich kann es einfach nicht zur Arbeit bringen. Kann jemand bitte einen Blick darauf werfen?Wie fmt: formatDate funktioniert für das Formular: Eingabe
Ich habe die volle Schleife für den Kontext enthalten, aber das Problem liegt im letzten <td></td>
Block.
<c:forEach items="${valueTransactionsModel.transactions}" var="transaction" varStatus="loopStatus">
<tr class="${loopStatus.index % 2 == 0 ? 'even' : 'odd'}">
<spring:message code="valueTransactions.transactionType" var="transactionTypeLbl" />
<tags:dropdown id="transactionTypeId${loopStatus.index}" path="transactions['${loopStatus.index}'].valueTransactionType.id"
fieldName="${transactionTypeLbl}" classStyle="mandatory" items="${transactionTypes}" itemLabel="value"/>
</tr>
<tr class="${loopStatus.index % 2 == 0 ? 'even' : 'odd'}">
<spring:message code="valueTransactions.transactionAmount" var="valueTransactionAmountLbl${loopStatus.index}" />
<tags:input id="transactionAmountId${loopStatus.index}"
path="transactions['${loopStatus.index}'].valueTransactionAmount"
fieldName="valueTransactionAmountLbl${loopStatus.index}"
maxlength="30" classStyle="mandatory" />
<spring:message code="valueTransactions.transactionDate"
var="valueTransactionDateLbl${loopStatus.index}" />
<td>
<form:input type="text" path="transactions['${loopStatus.index}'].valueTransactionDate" cssClass="mandatory" value="<fmt:formatDate value="transactions['${loopStatus.index}'].valueTransactionDate" type="date" pattern="yyyy-MM-dd"/>" />
</td>
</tr>
</c:forEach>
Mein letzter Punkt ist:
JSPG0055E: Kann ein XML-Attribut von Namen erstellen [Transaktionen [] Wert [$ {loopStatus.index}]
Danke! Das hat es ziemlich gut gemacht. Ich musste nur auf das Modell im Wertattribut value = "$ {valueTransactionsModel.transactions [loopStatus.index] .valueTransactionDate}" verweisen. – HellishHeat