JSP Section Index | Page 49
How can I override the jspInit() and jspDestroy() methods within a JSP page?
The jspInit() and jspDestroy() methods are each executed just once during the lifecycle
of a JSP page and are typically declared as JSP declarations:
<%!
public void jspInit() {
. . .
}...more
What JSP lifecycle methods can I override?
You cannot override the _jspService() method within a JSP page.
You can however, override the jspInit() and jspDestroy() methods within a JSP page.
jspInit() can be useful for allocating resourc...more
How does JSP handle run-time exceptions?
You can use the errorPage attribute of the page directive to
have uncaught run-time exceptions automatically forwarded to an error
processing page. For example:
<%@ page errorPage="error.js...more
How can I implement a thread-safe JSP page?
You can make your JSPs thread-safe by having them implement the
SingleThreadModel interface.
This is done by adding the directive
<%@ page isThreadSafe="false" %>
within your...more
How do I access a database from my servlet or JSP?
[See also How can I pool my database connections so I don't ...]
Since JDK 1.1, Java comes with a package called JDBC (Java Database
Connectivity). JDBC allows you to write SQL queries as Java St...more
How do I mix JSP and SSI #include?
If you're just including raw HTML, use the #include directive
as usual inside your .jsp file.
<!--#include file="data.inc"-->
But it's a little trickier if you want the server...more