Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

clarifiaction regarding session scope

 
hem kum
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all, below is the 2 simple programs from Apache struts novice to professional--

1 - first page

<jsp:useBean id="myVariable" scope="session" class="java.lang.StringBuffer"/>
<%
myVariable.append("1");
%>

<jsp:forward page="Second.jsp" />


2- second page

<jsp:useBean id="myVariable"scope="session"lass="java.lang.StringBuffer"/>

<%
myVariable.append("2");
%>

<%= myVariable.toString()%>


Now what will be the answer if the following 2 user access the application in this order--

� Audrey is the first person to view First.jsp. What will she see?
� Brenda next views First.jsp from a different machine. What does she see?
� If Audrey again views First.jsp after Brenda, what will she see?
� What if Brenda now loads Second.jsp directly?

This is only for my clarification...My answer is

Audrey = 12
Brenda = 12
Audrey = 1212
Brenda = 122

Please clarify me...Thank you all for replying....
[ September 22, 2008: Message edited by: Bear Bibeault ]
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65545
110
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What happened when you tried it?
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i think :p

 
hem kum
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
if myVariable getting a new value for both Audrey and Brenda for the first time then Brenda shuld see 122 when she loads the second page. But why is its coming as 12122 ??
 
Live a little! The night is young! And we have umbrellas in our drinks! This umbrella has a tiny ad:
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!