• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

clarifiaction regarding session scope

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What happened when you tried it?
 
Ranch Hand
Posts: 5575
Eclipse IDE Windows XP Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i think :p

 
hem kum
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ??
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic