Hi , I have have read that you are not allowed to write cookies in a
JSP and JSTL does not allow you to write cookies but it does allow you to read them.
Now suppose a user goes directly to a page say "page1.jsp" now page 1 will always redirect to another page.
My question is how can i set a particular cookie at the address of page1.jsp (since the container is calling Page1.jsp directly) so that when ever a user gets to page1.jsp the browser sends the cookie of page1.jsp to it.
The only way i see this to be possible is to create a
servlet which sets a cookie and forwards it to page1.jsp. something like this
Container->Servlet->(forward with cookie)->page1.jsp
But i need something like this
Container->page1.jsp(i need to place a cookie here)
a scriptlet could do the task at hand easily like this
<%
Cookie cookie = new Cookie("name","John");
response.addCookie(cookie);
%>
but i dont want to use a scriptlet. What would be the best way to accomplish this task ?? any suggestions ??