Yes you do need to use session variables to handle this situation.

If understand your question correctly, you are asking about member variables within
         ND. The problem is that in a multi-user environment you never now which cp 
worker
         is handling your request. Each cp request may even be in its own java jvm 
(with its
         own memory space). This means that you have now Idea what's in memory.

In the scenerio you described you really can't be sure of what you get back. You may
         get the member variable you set, you may get the other users, or you may get 
a null
         if its in a jvm that it wasn't set in yet.

The key is to be very careful of how you use member variables. Within one continous
         web request, you are supposedly safe to use them. For example an onbefore 
display
         request to an on before html output. Within all of those methods you could 
use a
         member variable (assuming you set it on onBefore display). As soon as you go 
to another
         event, for example a buttons web event , its a new request. This means you 
may or
         may not be in a new memory space and you are unsure of the member variables 
value.
         This is why you would need a session variable in this case.

Most of the reports of session "bleeding" I see in nd applications come down to this
         problem. The kicker here is that you will normally only find this out when 
you go
         to a multi-user environment, which for some people means production! Be very 
careful
         of how you use member variables!



"Mikko" <[EMAIL PROTECTED]> wrote:
>Hi,
>
>I have coded about 5 months with NetDynamics and I still have some
>confusion that how ND server internally dispatches ND project's pages with
>multiple
>users and how the variables of the pages are stored(swapped, permanent or
>what)
>
>For example:
>
>If I have a ND project which has one page derived from CSpPage.
>It runs inside ND server. That page has some member variables
>for example:
>
>class CSomePage extends CSpPage
>{
>....
>           private String      _Value;
>.....
>}
>
>User 1 starts this project and
>somewhere in page's code a value is set to that variable:
>_Value = new String("Susan");
>
>Okey, then another user uses that same application(and page too)
>and somewhere he/she runs that same code where variable _Value
>changes it's value.
>_Value = new String("Megan");
>
>Then finally the question!!!!
>
>If user1 neither user2 does not set that _Value variables value anymore what
>will be seen in Web browser when this field is shown to user in some display
>field when
>the page is reloaded?
>
>Will both users see the last value of the _Value variable(Megan here?) or
>will they
>see their own values set to that variable?
>
>Can anyone tell me the answer?
>
>Is UserSession-object the only way to prevent this? Or how these situation
>are usually
>handled.
>
>It is so easy to program a project  when the programmer is the only
>(single user) tester but when real customers are using that program
>simultanously ...
>
>I would be very grateful for the answer.
>
>Regards
>
>Mikko
>
>
>
>
>
>
>
>

_________________________________________________________________________

For help in using, subscribing, and unsubscribing to the discussion
forums, please go to: http://www.netdynamics.com/support/visitdevfor.html

For dire need help, email: [EMAIL PROTECTED]

Reply via email to