Last active
August 29, 2015 14:01
-
-
Save hotcoder/8f74d9b7050099cb3c4a to your computer and use it in GitHub Desktop.
cookie handling
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<% | |
Map<String,String> s = new HashMap<String,String>(); | |
Cookie cookie = null; | |
Cookie[] cookies = null; | |
// Get an array of Cookies associated with this domain | |
cookies = request.getCookies(); | |
if (cookies != null) { | |
out.println("<h2> Found Cookies Name and Value</h2>"); | |
for (int i = 0; i < cookies.length; i++) { | |
cookie = cookies[i]; | |
s.put(URLDecoder.decode(cookie.getName(),"UTF-8"),URLDecoder.decode(cookie.getValue(),"UTF-8")); | |
//out.print("Name : " + URLDecoder.decode(cookie.getName(),"UTF-8") + ", "); | |
//out.print("Value: " + URLDecoder.decode(cookie.getValue(),"UTF-8") + " <br/>"); | |
} | |
} else { | |
out.println("<h2>No cookies founds</h2>"); | |
} | |
session.setAttribute("comap", s); | |
%> | |
Babu : <c:out value="${comap['a bc']}"/> | |
<c:set var="comap" value="" scope="session"/> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment