Craig R. McClanahan wrote:
On Wed, 22 Jan 2003, Hans Bergsten wrote:


See my previous mail; you do _not_ need to have a package statement
for the generated servlet class. Adding it just complicates life.


There is a situation when *not* having the package statement can cause
big problems for users.

The JSP spec doesn't mandate any particular package (or the use of a
package at all) for the generated page class.  But if the container uses
no package, users will find that they can utilize unpackaged beans without
needing to import them -- yet, as soon as they move their application to a
different container (which does put pages in a package), their app no
longer works.

Worse than that, if the new container is running on a JDK 1.4.1 system,
they can't even fix the problem by adding import statements, because 1.4.1
won't let you import unpackaged classes.

IIRC, the portability issue was why we switched from unpackaged to
packaged back in Tomcat 3.2 days.
Again, I'm only talking about JSPC here; I'm not arguing for removing
the package name that JspServlet adds.

For JSPC, the above is not an issue. The servlet classes are used as
is, no matter if you deploy to Tomcat or another container; no one's
inserting package statement at any point after the class is generated.

The only problem would be if the JSP page includes references to
classes in the "default package" and you decide to deploy the JSP page
as is instead of the precompiled class file. Then you may run into
the problem you describe, i.e. it works fine precompiled but not when
the container compiles it.

JSPC has been totally broken in TC 4.1 and TC 5 for a long time. I
suggest we bring it back in line with TC 4.0.4 now (which is what the
current patch does, if you also add the TagLibraryInfoImpl patch I
posted). If there are other concerns which package names, let's please
come up with a consitent solution for _both_ JSPC and JspServlet and
implement it later. Priority one should be to stop all the "JSPC
doesn't work" bug reports.

Hans
--
Hans Bergsten                                <[EMAIL PROTECTED]>
Gefion Software                       <http://www.gefionsoftware.com/>
Author of O'Reilly's "JavaServer Pages", covering JSP 1.2 and JSTL 1.0
Details at                                    <http://TheJSPBook.com/>


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

Reply via email to