| Author |
Bean Importing error
|
Kerry Wilson
Ranch Hand
Joined: Oct 29, 2003
Posts: 251
|
|
When I am using trying to use a bean in my jsp files I get an error unless I put in the entire class path (in the useBean tag). I have my class in WEB-INF/classes/some/thing/database/ConnectorBean.class <jsp irective.page import="some.thing.database.*" info="Bean Tester Page" contentType="text/html;charset=ISO-8859-1"/> <HTML> <BODY> <!-- Test Dbconnector Bean --> <jsp:useBean id="dbconnector" class="some.thing.database.ConnectorBean" scope="application" /> Like I said it works fine unless I take out the full class path (which should not be required). I made a .jar file, which resides in the WEB-INF/lib/ folder. Does this need to be in the $CLASSPATH variable? Any help would be greatly appreciated. [ November 18, 2003: Message edited by: Kerry Wilson ]
|
http://www.goodercode.com
SCJP 1.4
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56152
|
|
When I am using trying to use a bean in my jsp files I get an error unless I put in the entire class path
What makes you think you can get away without specifying the full name of the class? bear
|
[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
|
 |
Tim Baker
Ranch Hand
Joined: Oct 04, 2003
Posts: 541
|
|
Originally posted by Bear Bibeault: What makes you think you can get away without specifying the full name of the class? bear
his import statement i presume
|
Kim Jong II (North Korea's Dear Leader) said:Nuclear weapons don't kill people, people kill people.
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56152
|
|
The import statement is immaterial. Although the means of instantiation is left up to the container, most servlet containers will use Class.forName() (or something that eventually calls forName() such as java.beans.Beans.instantiate()) which require a full class name to operate. Resin, interestingly enough, is the only container I tested that does a direct "new" operation, and hence is sensitive to the import. Bottom line is, specify the full class name. bear
|
 |
Tim Holloway
Saloon Keeper
Joined: Jun 25, 2001
Posts: 14456
|
|
That's the operative word, BTW, it's fully-qaulified class name, not class path, which is a thing 'nother entirely.
|
Customer surveys are for companies who didn't pay proper attention to begin with.
|
 |
Kerry Wilson
Ranch Hand
Joined: Oct 29, 2003
Posts: 251
|
|
So if I am going to need to put the fully qualified class name in every usebean tag what good is the import statement? [ November 19, 2003: Message edited by: Kerry Wilson ]
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56152
|
|
The import statement will apply to any Java scriplets that you write in the JSP. <normal disclaimer about accepted best practice is to limit scriplets> bear
|
 |
Kerry Wilson
Ranch Hand
Joined: Oct 29, 2003
Posts: 251
|
|
|
Understood, thanks alot.
|
 |
 |
|
|
subject: Bean Importing error
|
|
|