EL Implicit Object cookie


Cookie

                                                          
We can use this implicit object to retrieve cookies associated with the request.
Example :${cookie.JSESSIONID}
                 ${cookie.JSESSIONID.name}
                 ${cooke.JSESSIONID.value}
test.jsp

<%@ page isELIgnored="false" %>
<%
Cookie cookie = new Cookie ("username","chamu");
cookie.setMaxAge(60 * 60);
response.addCookie(cookie);
%>
<table border= 2>
<tr><td><h2>${cookie.username.name}</h2></td> <td><h2>${cookie.username.value}</h2></td></tr>
<tr><td><h2>${cookie.JSESSIONID.name}</h2></td> <td><h2>${cookie.JSESSIONID.value}</h2></td></tr>
</table>

First Request:

 Second Request: 



      
Thanks For Making This Possible! Kindly Bookmark and Share it.

Technorati Digg This Stumble Stumble Facebook Twitter

No comments:

Post a Comment