How can I get the value of the following cookie and put it into variable 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()"/>
}
}
%>
Essentially using the goods from 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>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.