From balld@webslingerZ.com Wed Jan 10 02:54:59 2001 Return-Path: Mailing-List: contact cocoon-dev-help@xml.apache.org; run by ezmlm Delivered-To: mailing list cocoon-dev@xml.apache.org Received: (qmail 92739 invoked from network); 10 Jan 2001 02:54:59 -0000 Received: from rdu25-5-046.nc.rr.com (HELO akira.webslingerZ.com) (24.25.5.46) by h31.sny.collab.net with SMTP; 10 Jan 2001 02:54:59 -0000 Received: by akira.webslingerZ.com (Postfix, from userid 501) id BB42913032; Tue, 9 Jan 2001 21:56:05 -0500 (EST) Received: from localhost (localhost [127.0.0.1]) by akira.webslingerZ.com (Postfix) with ESMTP id 9A81E60B1; Tue, 9 Jan 2001 21:56:05 -0500 (EST) Date: Tue, 9 Jan 2001 21:56:05 -0500 (EST) From: Donald Ball X-Sender: To: Vadim Gritsenko Cc: Robin Green , , Subject: RE: [C2] xsp:logic tag behaviour In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Spam-Rating: h31.sny.collab.net 1.6.2 0/1000/N On Tue, 9 Jan 2001, Vadim Gritsenko wrote: > Sorry to hear this... But - correct me if I don't understand this - > it is possible to re-write logicsheet so it uses variables only > inside scope of tag, example: > ------------- existing code -------------- > > Stack esqlSessions = new Stack(); > EsqlSession esqlSession = null; > > > -------------- replace by ---------------- > > Stack esqlSessions = new Stack(); > EsqlSession esqlSession = null; > > > > > ------------------------------------------ > > And the code will be a little bit clearer (at least, you can see > variable scope - so you know where this variable may be used) - of > course, this is objective. no. some variables declared in an xsp:logic element may be used in expressions which are used outside of the xsp:logic element. if you want your variables to lose scope after your xsp:logic element ends, put curly braces inside your xsp:logic element ({ ... }). > > They rely on the ability to create variables which continue after the > > xsp:logic tag ends - one of the few technical advantages which > > XSP has over plain Java. > > But now, if your tag declares variable - you can not use this tag again in > same jsp - or you must do some sort of variable name generation. that's why well-behaved logicsheets, e.g. esql, mail, smtp, put a prefix (_esql_) on variables they declare. yeah, i can see some rationale for an xsp:variable element so that this process is automatic, but others have disagreed so far. - donald