> -----Original Message-----
> From: Stefano Bonnin [mailto:[EMAIL PROTECTED]] 
> Sent: Wednesday, March 20, 2002 1:21 PM
> To: [EMAIL PROTECTED]
> Subject: Question about Static Variables
> 
> 
> Hi,
> 
> I'd like to know the answer at the following question:
> 
> how can I define (with Cocoon) a "Static variable"?
> 
> I have a series of xsp documents and I'd like to define a 
> Static variable (?application variable?) common to these documents.


You can define any variable in your XSP document. Use <xsp:logic> before
your first root element and you'll get class level logic:
<xsp:logic>
        public static String s = "This is a static string";
</xsp:logic>

But note, that you'll have problems with static variables in a distributed
environment. It's better to use application context attributes (servlet
context). You can place variables there in a plenty of ways: using an action
or an XSP logic, overriding CocoonServlet, using additional servlet to load
that variables, etc.

--
Konstantin Piroumian 
[EMAIL PROTECTED]


> 
> Thanks
> 
> 
> ---
> Outgoing mail is certified Virus Free. (FLASHH!)
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.338 / Virus Database: 189 - Release Date: 14/03/02
> 
> 
> ---------------------------------------------------------------------
> Please check that your question has not already been answered 
> in the FAQ before posting. 
<http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <[EMAIL PROTECTED]>
For additional commands, e-mail: <[EMAIL PROTECTED]>

---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <[EMAIL PROTECTED]>
For additional commands, e-mail: <[EMAIL PROTECTED]>

Reply via email to