Craig,

Your response confirms what I thought. My questions was purely educational
and not that I am having such cases in my code. Thanks for your response.
Surely no one should put logic in the PL (jsp). But someone could define and
use a utility method (eg putting a HTML table showing some data eg date etc)
in jsp. I positive that this is something that could be done if not in
current JSP version but in future versions. There could be a directive eg
THIS.doit() that gets translated by the JSP engine into something like
colrs$jsp.doit() (colrs.jsp is the jsp file). Though it is certainly not
that important as required but could be done. Perhaps also at instance
level!

Thanks


----- Original Message -----
From: "Craig R. McClanahan" <[EMAIL PROTECTED]>
To: "Tomcat Users List" <[EMAIL PROTECTED]>
Sent: Tuesday, August 13, 2002 9:18 PM
Subject: Re: jsp in packages


>
>
> On Tue, 13 Aug 2002, D Bamud wrote:
>
> > Date: Tue, 13 Aug 2002 12:27:53 +0530
> > From: D Bamud <[EMAIL PROTECTED]>
> > Reply-To: Tomcat Users List <[EMAIL PROTECTED]>
> > To: Tomcat Users List <[EMAIL PROTECTED]>
> > Subject: jsp in packages
> >
> > Q1. Can I declare my jsp files in packages? How?
> >
>
> No.  You have zero control over what package the JSP compiler puts your
> page in, or even what the class name of the generated servlet is.
>
> > Q2. I have written a static method in one jsp page. I want to call  this
> > method in another jsp page. How to do it? I do not want to take this
method
> > out from the jsp and put into a class (.java) and use it in both the jsp
> > files.
> >
>
> You need to rethink your "do not want to take this method out"
> statement.  JSP pages and servlets are designed to be totally independent
> components, and you can't get a reference to an instance of one page or
> servlet from another.  Shared logic and shared data *must* be stored in
> separate classes.
>
> And, you're going to need to understand how to organize your code properly
> to work on larger scale projects anyway, so now is a good time to start.
> Hint -- putting logic in your JSP pages is not a good design practice.
>
> Craig
>
>
> --
> To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>
>


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to