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> www.Wapaka.com -----Message d'origine----- De : A mailing list about Java Server Pages specification and reference [mailto:[EMAIL PROTECTED]]De la part de Hans Bergsten Envoye : dimanche 1 septembre 2002 00:44 A : [EMAIL PROTECTED] 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 make > it part > of a named package. A Java class that does not use a package statement ends > up in the > so-called unnamed package. The servlet class generated from the JSP page is, > however, > typically assigned to a named package. If you try to refer to a class in the > 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 a > 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\contact_jsp.java:11: '.' > 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: <http://developer.java.sun.com/developer/bugParade/bugs/4361575.html> 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 -- Hans Bergsten [EMAIL PROTECTED] Gefion Software http://www.gefionsoftware.com JavaServer Pages http://TheJSPBook.com =========================================================================== To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST". For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST". Some relevant FAQs on JSP/Servlets can be found at: http://archives.java.sun.com/jsp-interest.html http://java.sun.com/products/jsp/faq.html http://www.esperanto.org.nz/jsp/jspfaq.jsp http://www.jguru.com/faq/index.jsp http://www.jspinsider.com ___________________________________________________________________________ To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff SERVLET-INTEREST". Archives: http://archives.java.sun.com/archives/servlet-interest.html Resources: http://java.sun.com/products/servlet/external-resources.html LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
