cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Conny Krappatsch <co...@smb-tec.com>
Subject [C1 (and C2?)] global variables in XSP page
Date Tue, 09 Jan 2001 09:33:51 GMT
Hi,

I have a problem regarding global variables (members) in an XSP page.
In our Prowler taglib we have tags that interact. For instance, the
following tag performes a login:

<prowler:login id="li"/>

Using the given id, one can refer on the result of the login (within the
same XSP page):

<prowler:onSuccess idref="li">
</prowler:onSuccess>

If login was successful the content of <prowler:onSuccess> is
executed/copied.

This is done using a Hashtable created within <xsp:logic> within
<xsp:page>:

<xsp:page>
    ...
    <xsp:logic>
        Hashtable prowlerResultTable = new Hashtable(3);
    </xsp:logic>
</xsp:page>

Now I recognized that this may cause problems if the same page is called
more than ones at on time. As prowlerResultTable becomes a global member
and the same object is used for each page request, it may happen that a
request changes the result of an operation before the previous request
could evaluate it - the classis synchronization problem.

Unfortunalty I don't see any chance to synchronize on prowlerResultTable,
because within the taglib I don't know which tags in which order and
quantity will be used in the XML files.

Having prowlerResultTable as local variable within the populateDocument()
method would solve the problem, but currently there's no way to get it
there.

There was a (C2) discussion about having a special tag for placing code at
the beginning of populateDocument().
Has there been any consensus on this?
Or does anybody have an idea how I can work around this?

Thanks in advance,

Conny Krappatsch

-- 
______________________________________________________________________
Conny Krappatsch                              mailto:conny@smb-tec.com
SMB GmbH                                        http://www.smb-tec.com




Mime
View raw message