Vincent Massol wrote:
>
> >
>
> hum ... if you put this in redirector.jsp then it gets called every time ...
> That's why I preferred to put as a static block in JspTestCaller.java. By
> the way, is there any way of putting static java code in a JSP page ?
>
true.
if you want something to be called once only in a JSP page, then you do
have access to the following methods analogous to those in the Servlet
API.
you can declare jspInit and jspDestroy methods in a JSP page like so:
<%!
public void jspInit()
{
//do some initialisation code in here.
}
public void jspDestroy()
{
// do your clear up code here.
}
%>
see part of the j2ee tutorial at sun on:
http://java.sun.com/j2ee/tutorial/doc/JSPIntro5.html
although i really, really have a problem with what they're advocating in
the tutorial - having anything remotely connected to the database layer
in a JSP page is _really_ disgusting...
"oy, Sun, I say NOOOO."
- If it's code, then take it out of the page... otherwise god help us
we'll end up with the mess that a badly written ASP or Visual Basic
program can become ;) (yeuch even the thought gives me the shivers)
Jari
--
Jari Worsley
Senior Programmer
Hyperlink Interactive Ltd