此问题已在此处有答案:
Use EL ${XY} directly in scriptlet <% XY %>(1个答案)
4天前关闭。
我在从servlet到jsp传递Localdatetime中格式化时间时遇到问题。下面是我的代码:
<c:forEach items="${listDeviceType}" var="deviceType">
<tbody>
<tr>
<td>${deviceType.ID}</td>
<td>${deviceType.name}</td>
<td>
<%
LocalDateTime stopTime = deviceType.getStopTime();
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("HH:mm");
String formattedStopTime = stopTime.format(formatter);
%>
</td>
<td>${deviceType.startTime}</td>
<td>${deviceType.resetTime}</td>
<td>
<a href="admin-devicetypeedit?dTID=${deviceType.ID}" class="badge rounded-pill bg-primary">
<i class="fa fa-edit"></i>
Edit
</a>
<form action="admin-devicetypedelete" method="POST" onsubmit="return confirm('Are you sure you want to delete this item?');">
<input type="hidden" name="dTID" value="${deviceType.ID}">
<button type="submit" class="badge rounded-pill bg-danger">
<i class="fa fa-trash-o">Delete</i>
</button>
</form>
</td>
</tr>
</tbody>
</c:forEach>
但我显示“deviceType无法解析”
你能帮我吗/谢谢你
1条答案
按热度按时间jv4diomz1#
您可以从
pageContext
中获取变量。