如何获取以下cookie的值并将其放入变量Cli?
<% Cookie cookies[] = request.getCookies();
for (int i = 0; i < cookies.length; i++) {
if (cookies[j].getName().equalsIgnoreCase("Jack")) {
<c:set var="Cli" value="cookies[j].getValue()"/>
}
}
%>
答案 0 :(得分:1)
基本上使用Retrieving cookie and array values in JSTL tags中的商品:
<c:forEach items="${cookie}" var="currentCookie">
<c:if test="${currentCookie.value.name == 'Jack'}">
<c:set var="Cli" value="currentCookie.value.value"/>
</c:if>
</c:forEach>