I can get cookie in JSP like this:
Cookie[] cookies = request.getCookies();
if (cookies != null) {
for (Cookie cookie : cookies) {
//work with cookies
}
}
But I wonder if I can get it with jsp:useBean (or something else)?
May be like this:
<jsp:useBean id="myCookie" class="javax.servlet.http.Cookie" scope="request" beanName="cookieName"/>
...
<div class="${myCookie.value == "true" ? "class1" : "class2"}"></div>
Thx for your answers!
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…