Following code shows how to read a cookie named myCookie from JSP.
Java Code:
<%
        Cookie[] cookies = request.getCookies();
    
        for(int loopIndex = 0; loopIndex < cookies.length; loopIndex++) { 
            if (cookies[loopIndex].getName().equals("myCookie")) {
                out.println("Cookie says: " + cookies[loopIndex].getValue());
            }
        }  
%>