Thanh,

I can answer some of you questions at least! My answers are in red in the
body of your message

Cheers!

Alessandro Dias

Ted Turner <http://www.brainyquote.com/quotes/authors/t/ted_turner.html>  -
"Sports is like a war without the killing."

On Sun, Nov 8, 2009 at 08:38, Thanh Nguyen <ngay01032...@yahoo.com.vn>wrote:

> Hi all,
>
> I have a question regarding the "session tracking" topic. Below is what I
> did:
>
> 1) I write 2 servlet: ServletOne and ServletTwo. In ServletOne I set an
> attribute like this:
> session.setAttribute("myAttribute", "myAttribute's value"); In ServletTwo I
> try to get this attribute by request.getAttribute("myAttribute");
>
You can only get an attribute from the session by using
session.getAtrribute("myAttribute"); request is another thing, you mainly
use request and response to interact with HTML (forms and page creation).


> 2) I disable cookies in both FireFox and IE, and I do not apply any session
> tracking method (URL rewriting, hidden form ...)
>
> 3) I execute ServletOne in FireFox
>
> 4) I execute ServletTwo in IE (to make sure that no cookie is used)
>
> 5) As far as I know, if I do not apply any session tracking method, in
> ServletTwo I can NOT get the attribute that I set for this session. But in
> ServletTwo I get exactly the value that I set in ServletOne (that means:
> "myAttribute's value"). In fact, in ServletOne and ServletTwo, I print out
> the sessionid value with request.getSession().getId() , and I get two
> different sessionID.
>

 You will never get the same value stored in a session variable from two
different browsers, because every one of them starts a new session.

>
> Can anyone tell me why I can get the attribute I set in ServletOne from
> ServletTwo although no session tracking method is used?
>

   By using session.setAttribute in ServletOne  and
session.getAttribute in ServletTwo
, in the same browser.


> Thank you very much.
>
>


> ------------------------------
>  Kết nối để chat trên blog hoặc bất kỳ trang web cá nhân nào!
> <http://sg.rd.yahoo.com/vn/messenger/pingbox/mailtagline/*http://vn.messenger.yahoo.com/pingbox/>
> Yahoo! cho phép bạn có thể chat ngay với Pingbox. Thử xem
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Java EE (J2EE) Programming with Passion!" group.
To post to this group, send email to
java-ee-j2ee-programming-with-passion@googlegroups.com
To unsubscribe from this group, send email to
java-ee-j2ee-programming-with-passion+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/java-ee-j2ee-programming-with-passion?hl=en?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to