add another
[nobr]Hi,
please help with my program,
I have this login, that asks the user for a username, in a html called "1.html",
then in a "2.jsp", it prints the cookie entered.
What I want to do is: that when another user goes to the "1.html", and enters a username, in the "2.jsp" that new username will be added to another cookie.
how can i do this?
thanks for any response...
the code:
"1.html"
<HTML>
<HEAD>
<TITLE>Login</TITLE>
</HEAD>
<BODY>
<form action="2.jsp" method="post" >
username:
<br>
<input type="text" name="value">
<br>
<input type="submit" value="Send">
%>
</form>
</BODY>
</HTML>
"2.jsp"
<html>
<head>
<title>2 </title>
</head>
<body>
<%
Cookie cookie1 =null;
if(request.getParameter("value") !=null){
String rt = request.getParameter("value");
cookie1 =new Cookie("message", rt);
cookie1.setMaxAge(24 * 60 * 60);
response.addCookie(cookie1);
}
Cookie[] cookies = request.getCookies();
for(int i = 0; i < cookies.length; i++)
{
if (cookies[i].getName().equals("message")){
out.println("The user is: " + cookies[i].getValue());
}
}
%>
</body>
</html>
[/nobr]

