Conny Krappatsch <conny@smb-tec.com> wrote:
>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.
I've done it myself many times (in C1). I think you just do <xsl:template
match="xsp:page/mypagetag"><xsp:logic>blah</xsp:logic><xsl:apply-templates/></xsl:template>
where mypagetag is your page root element.
>
>There was a (C2) discussion about having a special tag for placing code at
>the beginning of populateDocument().
That's a special case for redirects.
>Has there been any consensus on this?
No-one objected, IIRC.
_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.
|