ultan o'carroll <ultan@totalise.co.uk> wrote:
>Im getting errors when I try to use a tag library that Im developing
>(trying to develop I should say)
>telling me that I have "undefined variable or class names" (sepcifically
>request, session, log)
>when I try to use these objects in the class level logic element of the
>library (see <!-- ** here ** --> comments )-
>
They are passed as parameters to the implicit page generation method, and by
default can only be accessed inside the <page> element, or whatever your
root page element is called inside <xsp:page>. But you can easily pass them
outside by passing them to methods as arguments or assigning them to
instance variables. Instance variables in the XSP page are NOT recommended
for this purpose, as they can easily cause all sorts of problems, including
nasty hard-to-track threading problems.
Final "variables" are safe though. For example, an exception to the above
paragraph is servletContext, which is a final instance variable which is set
automatically - you don't have to do anything to be able to use it anywhere
on the XSP page.
Example for session:
<xsp:logic>
public void myMethod (HttpSession session) {
// ...
}
</xsp:logic>
<page>
myMethod (session);
</page>
--
Robin Green
i-tao Ltd.
4 Skyline Village
Limeharbour
London E14 9TS
United Kingdom
Phone +44 20 7537 2233 Fax +44 70 8081 5118
http://www.i-tao.com
________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com
|