Hi,
>The HttpSession does what you say, associates a 'session' (some java object)
>with an id. The id is passed as the Cookie to the browser.
Yeah..this much I knew. I just wasn't sure if I didn't use cookies or URL
rewriting, if the HttpSession does it for you. I now know that you must use
one or the other to preserve the state of the session (or should I say, to
keep the client inline with the session on the server they belong to?).
>And yes URL re-writing does entail changing all of the URLs on a page
>dynamically so that each client sees a unique URL - you don't need to use
>JavaScript, you encode the URLs in the JSP page using a scriptlet (or
>equivalent),
Can anyone give an example? I can imagine it might be something like:
<jsp:useBean id="utilbean" scope="request" class="com.bm.ui.beans.UtilBean" />
<HTML><HEAD><TITLE></TITLE></HEAD>
<BODY>
<a href="<%= utilbean.encodeUrl("/somepath/somepage/mypage.jsp") %>">Click
here</a>
</BODY>
</HTML>
-----
utilbean
-----
public String encodeUrl(String value)
{
// do code to get session ID whether from cookie or URL Rewriting
String sessionid = // some code to figure it out
return value + "?sessionid=" + sessionid;
}
------------------
Ofcourse I didnt elaborate on the code to get the sessionid, since I dont
know how yet. But is this how it would be done? If not, please explain so I
can start doing that.
Also, is it recommended to do it this way? I hate to think on EVERY jsp
page wherever I have a link to anything, I have to call this method. It
kind of sucks to see it this complicated. Isnt there a way I can just set
some HttpHeader myself without having to set every single URL on the page,
so that I can "fake" as if a cookie was coming with the header? Maybe at
the top of the page, I can put the cookie right in the header myself?
Thanks.
Kevin Duffey
Software Engineer
[EMAIL PROTECTED]
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
FAQs on JSP can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html