Your Java code runs inside the CP Service process.  Each CP may have one or
more CP Workers (threads).  Class instance variables can only be set and
used within one web event.  A web event is the duration from the start of
the page request (either load() or xxx_onWebEvent()) to the time that the
results are returned to the browser.  As requests come into the ND App
Server, the requests are distributed between the free CP Workers.  Thus, for
any given user/session, there's no guarantee that the same CP Worker will be
used to answer every request.

What you're trying to do won't work because the user ID is being generated
during one web event (page request) and the Insert_onWebEvent is being
processed during another.  There's no guarantee that the same CP will
process the two requests, so you can't depend on any variable stored
locally.  Even if you were lucky enough to have the same CP Worker process
the two requests, you'd still have to worry about what other requests were
processed in the interim.

If you need the user ID to carry over, you should either put it in a session
object (user or page) or in an unbound hidden variable on the originating
page.

Hope that helps.

-- Grace


----- Original Message -----
From: <[EMAIL PROTECTED]>
Newsgroups: netdynamics.public.support.nd4.talk
To: <[EMAIL PROTECTED]>
Sent: Friday, April 09, 1999 6:52 AM
Subject: [ND] No class variable??


> Hello there,
>
> I just started programming with NetDynamics Applicaiton Server 4.1 and ran
into a interesting problem.
> as described below:
>
> I designed a page for user register themselves to our system. Inside this
page user enter his name,
> email address, etc. After he press Insert button, a userID is created for
him and inserted into a
> database table together with other information he provided, and another
page is returned to mainly
> show him the userID.
>
> To do this, first in the onBeforeDataObjectExecuteEvent() I create the
userID and set it for
> the corresponding DataObject. Then in insert_onWebEvent() I load another
page to show this
> userID.  But I got a null. The source is as follows:
>
> public class CustomerRegisterPage extends spider.visual.CSpPage
> {
>     CSpValue userID;
>
>     public int
this_onBeforeDataObjectExecuteEvent(CSpDataDrivenVisualEvent event)
>     {
>         userID = create a userID ;
>         ....
>      }
>
>      public int Insert_onWebEvent(CSpWebEvent event)
>      {
>           CSpPage nextPage = (CSpPage)CSpider.getConnonPage("AcknowPage");
>           nextPage.setDisplayFieldValue("dbo_user_userID", userID);
>           nextPage.setDisplayFieldValue("other_fields",
getDisplayFieldValue("other_field"));
>           .....
>           return (nextPage.load(false));
>      }
> }
>
> I checked the database found the created userID is there. But it becomes
null in the nextPage.
>
> Can anybody give me an explaination?
>
> Thanks,
> -Fujian
>
> _________________________________________________________________________
>
> 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]
>

_________________________________________________________________________

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