• Post Reply Bookmark Topic Watch Topic
  • New Topic

clarifiaction regarding session scope  RSS feed

 
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: 66153
146
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 ??
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!