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]>