tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nicolas S i l b e r z a h n" <>
Subject TR: Using Packages for Bean Classes
Date Mon, 02 Sep 2002 13:00:48 GMT
for your information...

N i c o l a s   S i l b e r z a h n

<100% Java, Mobile, Offline aware>Wapaka Browser for mobile development
(XHTML, WML)</100% Java, Mobile, Offline aware>

-----Message d'origine-----
De : A mailing list about Java Server Pages specification and reference
[mailto:JSP-INTEREST@JAVA.SUN.COM]De la part de Hans Bergsten
Envoye : dimanche 1 septembre 2002 00:44
Objet : Re: Using Packages for Bean Classes

Nicolas S i l b e r z a h n wrote:
> Hans Bergsten, author of JavaServer Pages in its paper "Hans's Top Ten JSP
> Tips" (google it for URL)
> wrote:
> Using Packages for Bean Classes
> When you develop a bean to be used in a JSP page, I recommend that you
> it part
> of a named package. A Java class that does not use a package statement
> up in the
> so-called unnamed package. The servlet class generated from the JSP page
> however,
> typically assigned to a named package. If you try to refer to a class in
> unnamed
> package from a class in a named package, Java cannot find the class unless
> you use an
> import statement to import it. In a JSP page that means you must use both
> page
> directive to import the class, and the <jsp:useBean> action to make it
> available:
> <%@ page import="UserInfoBean" %>
> <jsp:useBean id="userInfo" class="UserInfoBean" />
> <<<<
> it seems it does not work anymore with Tomcat 4.1.9:
> F:\Tomcat 4.1.9\work\Standalone\localhost\ecomm\ '.'
> expected
> import UserInfoBean;
>                           ^
> How to write it now if I don't want my beans in a package?

This has nothing to do with Tomcat 4.1.x. It's due to a "correction" in
Sun's JDK 1.4.x, see Sun's Bug Parade:


Based on the comments there, it's breaking code in many places and is
a very unpopular change that I wasn't aware of until I saw your mail and
did some research. Your choices at this point is to use a different
compiler (e.g. Jikes or Sun's JDK 1.3.x) or place your beans in a
package (which I recommend no matter what).

Hans Bergsten 
Gefion Software
JavaServer Pages

To unsubscribe: mailto with body: "signoff
For digest: mailto with body: "set JSP-INTEREST
Some relevant FAQs on JSP/Servlets can be found at:

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message