Starting to use cookies to tie a login across multiple apps. Have read some tutorials but with no luck im afraid. Im using the latest stable tomcat 5.
Ive started simple by simpy trying to read all the cookies and their names on my system to get a basis of what i need:
<%@ page import="java.net.*"%>
<%
Cookie cookies [] = request.getCookies ();
Cookie redCookie = null;
if (cookies != null)
{
for (int i = 0; i < cookies.length; i++)
{
out.println(cookies.length + ":" + i + " - " + cookies .getName() + " = " + cookies .getValue());
}
}
%>
This code does not work and according to the numerous examples ive looked at it should.
The error tomcat throws is:
org.apache.jasper.JasperException: Unable to compile class for JSP
An error occurred at line: 2 in the jsp file: /jsp/cook.jsp
Generated servlet error:
Cannot invoke getName() on the array type Cookie[]
An error occurred at line: 2 in the jsp file: /jsp/cook.jsp
Generated servlet error:
Cannot invoke getValue() on the array type Cookie[]
Any help on this matter would be greatly appreciated.
Thanks
Ben