You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "Felix A. Milovanov" <fe...@terasystems.com> on 2001/04/06 20:24:38 UTC
Superclass for JSPs?
Hello all,
i just started using Java for server-side WEB development ( I've 4 years of
this development in C and Perl ). When I read about JSPs, I found than JSP is
compiled into servlet on a first call and than runs like a servlet.
The question is : is it possible to have a superclass for my JSPs? I need to
make some activity before each JSP is called. I made a superclass for my
servlets, so I cat write my servlets inherited from baseServlet and do not worry
about pre-request activity. But how can I do it for JSP???
Sincerely,
Felix.
Re: Superclass for JSPs?
Posted by Peter Smith <sh...@yahoo.com>.
I honestly don't know if it's possible to subclass
your JSP pages, but I may have a hack workaround.
First, know that you can declare a 'jspinit()' method
that is just like the 'init()' method in your servlet.
Search the following doc for details:
http://developer.java.sun.com/developer/onlineTraining/JSPIntro/contents.html
Also, you might use the 'include' directive to include
a jsp file in all of your other jsp pages. For
instance, you may write a 'init_and_utils.jsp' file
and use the jsp include directive to attach it to each
of your other jsp's.
<jsp:include page="init_and_utils.jsp"/>
--Peter--
--- "Felix A. Milovanov" <fe...@terasystems.com>
wrote:
> Hello all,
>
> i just started using Java for server-side WEB
> development ( I've 4 years of
> this development in C and Perl ). When I read about
> JSPs, I found than JSP is
> compiled into servlet on a first call and than runs
> like a servlet.
>
> The question is : is it possible to have a
> superclass for my JSPs? I need to
> make some activity before each JSP is called. I made
> a superclass for my
> servlets, so I cat write my servlets inherited from
> baseServlet and do not worry
> about pre-request activity. But how can I do it for
> JSP???
>
> Sincerely,
>
> Felix.
__________________________________________________
Do You Yahoo!?
Get email at your own domain with Yahoo! Mail.
http://personal.mail.yahoo.com/