print value
Hi, I have two jsps: "1.jsp" and "2.jsp".
I am entering some data in the "1.jsp" using a
<input type="text"
then the "2.jsp" receives that data and adds it to a Cookie,
but the problem i am having is that the "2.jsp" displays the data only when I visit that page for the second time.
What I want is that the first time the page gets visited the data is displayed.
what can i do?
thanks for any response...
the code(snippet of 2.jsp):
><%
if(request.getParameter("value") !=null){
String rt = request.getParameter("value");
Cookie cookie1 =new Cookie("message", rt);
cookie1.setMaxAge(24 * 60 * 60);
response.addCookie(cookie1);
}
Cookie[] cookies = request.getCookies();
for(int loopIndex = 0; loopIndex < cookies.length; loopIndex++)
{
if (cookies[loopIndex].getName().equals("message")){
out.println("The user is: " +
cookies[loopIndex].getValue());
}
}
%>

