86. How can I set a cookie in JSP?- response. setHeader(”Set-Cookie”, “cookie
string”); To give the response-object to a bean, write a method setResponse
(HttpServletResponse response) - to the bean, and in jsp-file:<% bean. setResponse
(response); %>
87. How can I delete a cookie with JSP?- Say that I have a cookie called “foo,
” that I set a while ago & I want it to go away. I simply: <% Cookie killCookie =
new Cookie(”foo”, null); KillCookie. setPath(”/”); killCookie. setMaxAge(0);
response. addCookie(killCookie); %>>
88. How are Servlets and JSP Pages related?- JSP pages are focused around HTML
(or XML) with Java codes and JSP tags inside them. When a web server that has JSP
support is asked for a JSP page, it checks to see if it has already compiled the
page into a servlet. Thus, JSP pages become servlets and are transformed into pure
Java and then compiled, loaded into the server and executed.
Friday, May 23, 2008
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment