If this is static read-only stuff, you might want to avoid the overhead of
getting stuff out of global sessions.
Another option would be to have a common parent for your pages. It could
have onafterinit processing that sets up protected instance variables.
-- Curt Springer
Team ND
At 12:22 PM 2/16/00 -0500, Damian O'Connor wrote:
>Hi,
>
>I have a static{} block I want to execute on our project base page to load
>data
>from our database to a set of hashtables. These I'll then store in global
>session.
>
>Unfortunately I get a null pointer when the project loads the first time.
>It looks
>like the dataobject isn't known to the project at that point.
>
>Should I add the code to the this_onAfterInitEvent of the dataobject?
>
>Any ideas for getting around this?
>
>Regards
>Damian
>
>Code:
> static
> {
> // Method to retrieve or store field display values
> loadHashTables();
> }
>
> /**
> * Searches in the DataObject <i>doqFieldDisplay</i> (table field_display)
> * for the entries for the given project. The resultset is used to create
> * the necessary lookup tables for controlling field display on the
> individual
> * pages.
> *
> * @return A number of Hashtables that contain as
> * key the <i>field name</i>, <i>page name</i> and
> * <i>cntry code</> concatentated as the key.
> */
> protected static final synchronized void loadHashTables ()
> {
> CSpLog.send("pgBase", CSpLog.ERROR, "loadHashTables()");
> boolean locked = true;
> String field_name = new String();
> String page_name = new String();
> String cntry_code = new String();
> try
> {
>
> // Check to see if we can access the global session
> // Attempt to lock the session while we read from it.
> while (! (locked = CSpider.lockGlobalSession ()))
> {
> java.lang.Thread.sleep (new Long("250").longValue());
> }
> CSpValue sessionExists = CSpider.getGlobalSessionObject
> (Constants.getFieldDisplaySession());
> // Verify if we need to create the session objects
> if (sessionExists == null)
> {
>
> CSpSelect doqFldDsp =
> (CSpSelect)CSpider.getDataObject( "doqFieldDisplay" );
>
>******************** doqFldDsp is null *******************
>
>_________________________________________________________________________
>To unsubscribe from this mailing list please send an email to:
>[EMAIL PROTECTED]
>Please remember to use the same email address you subscribed with.
>
>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]
_________________________________________________________________________
To unsubscribe from this mailing list please send an email to:
[EMAIL PROTECTED]
Please remember to use the same email address you subscribed with.
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]