You can. But the use depends on the webcontainer used. For every kind of webcontainer you likely have to rewrite the stuff.
In case of Tomcat, you simply have to extend the [url=http://tomcat.apache.org/tomcat-4.1-doc/jasper/docs/api/org/apache/jasper/runtime/HttpJspBase.html]HttpJspBase [/url] and implement accordingly.