hi all,
i do have a jsp file :
myJSP.jsp
---------------------------
<html>
<BODY>
<form name = "myForm" ACTION="GetCookie" METHOD="POST">
<%
Cookie info = null;
info = new Cookie ("MyCookie", "toto"
info.setPath("/"
info.setMaxAge(10*24*60*60);
response.addCookie(info);
%>
<INPUT name=valid type=submit value=Search>
</body></html>
and a servlet
GetCookie.java
---------------------------------
protected void doGet (javax.servlet.http.HttpServletRequest request,javax.servlet.http.HttpServletResponse response) throws ServletException, IOException {
String value="tata";
Cookie[] cookies = request.getCookies();
response.setContentType("text/html"
PrintWriter out = response.getWriter();
if (cookies != null) {
for (int i=0; i < cookies.length; i++) {
if (cookies.getName().equals("MyCookie") {
value = cookies.getValue();
break;
}
}
}
out.println("results : " + value);
}
-------------------------
when i click on the submit button it launches an empty web page with the url :
any idea og why it's emty ?
Best regards X-),
Elise
i do have a jsp file :
myJSP.jsp
---------------------------
<html>
<BODY>
<form name = "myForm" ACTION="GetCookie" METHOD="POST">
<%
Cookie info = null;
info = new Cookie ("MyCookie", "toto"
info.setPath("/"
info.setMaxAge(10*24*60*60);
response.addCookie(info);
%>
<INPUT name=valid type=submit value=Search>
</body></html>
and a servlet
GetCookie.java
---------------------------------
protected void doGet (javax.servlet.http.HttpServletRequest request,javax.servlet.http.HttpServletResponse response) throws ServletException, IOException {
String value="tata";
Cookie[] cookies = request.getCookies();
response.setContentType("text/html"
PrintWriter out = response.getWriter();
if (cookies != null) {
for (int i=0; i < cookies.length; i++) {
if (cookies.getName().equals("MyCookie") {
value = cookies.getValue();
break;
}
}
}
out.println("results : " + value);
}
-------------------------
when i click on the submit button it launches an empty web page with the url :
any idea og why it's emty ?
Best regards X-),
Elise