| Author |
Import class not working for Servlet
|
Mike Jenkins
Ranch Hand
Joined: Jul 23, 2006
Posts: 57
|
|
I am trying to get my first import to work in Tomcat 5.5 container but it is giving me error. Here is my Controller: Here is my bean file: My JSP called Third.jsp: I mapped in the web.xml so it should show on the web as: http://127.0.0.1:8080/test/First My error: java.lang.NoClassDefFoundError: First (wrong name: beans/First) My First.java is located in Tomcat 5.5 Home\webapps\test\WEB-INF\classes and the bean is located in Tomcat 5.5 Home\webapps\test\WEB-INF\classes\beans. My jsp is located in C:\Program Files\Apache Software Foundation\Tomcat 5.5\webapps\test Please advise. [ July 23, 2006: Message edited by: Mike Jenkins ]
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56179
|
|
|
Your import is not valid. You cannot import a package, you must import classes.
|
[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
|
 |
Mike Jenkins
Ranch Hand
Joined: Jul 23, 2006
Posts: 57
|
|
|
Please advise how I do that?
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56179
|
|
|
Same way as for Java classes.
|
 |
Ben Souther
Sheriff
Joined: Dec 11, 2004
Posts: 13410
|
|
You need to either list each class explicitly: or, to import all beans in a package, you can use the wildcard (*):
|
Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
|
 |
Mike Jenkins
Ranch Hand
Joined: Jul 23, 2006
Posts: 57
|
|
Thanks to both of you. It now works.
|
 |
 |
|
|
subject: Import class not working for Servlet
|
|
|