This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes JSP and the fly likes Jasper compile error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Jasper compile error" Watch "Jasper compile error" New topic
Author

Jasper compile error

cyril vidal
Ranch Hand

Joined: Jul 02, 2003
Posts: 247
Dear all,
i encounter a very strange problem. Every time I want to test a JSP page that imports a JavaBean, I receive the following error message about import declaration.
org.apache.jasper.JasperException: Unable to compile class for JSP
An error occurred at line: 1 in the jsp file: /addressDisplay.jsp
Generated servlet error:
[javac] Compiling 1 source file
C:\java\plateforme\tomcat\work\Standalone\localhost\chapter14\addressDisplay_jsp.java:7: '.' expected
import AddressBean;
^

I'm don't see what is wrong in the declaration of my JSP page:

the code of the bean AdresseBean is the following:

Really I don't understand what's happening.
I would be very grateful for any assistance.
Regards,
Cyril.


SCJP 1.4, SCWCD, SCBCD, IBM XML, IBM Websphere 285, IBM Websphere 287
Tim Baker
Ranch Hand

Joined: Oct 04, 2003
Posts: 541
you don't need an import statement if it is just a class/bean. you only use import statements to import packages. from the code you pasted that bean is not in a package.


Kim Jong II (North Korea's Dear Leader) said:Nuclear weapons don't kill people, people kill people.
cyril vidal
Ranch Hand

Joined: Jul 02, 2003
Posts: 247
Hi Tim,
Thanks for your response.
I have tried without the import statement and now there's a problem because the class is not found:

C:\java\plateforme\tomcat\work\Standalone\localhost\chapter14\addressDisplay_jsp.java:42: cannot resolve symbol
symbol : class AddressBean
location: class org.apache.jsp.addressDisplay_jsp
AddressBean address = null;
^

by the way, are you sure we don't need to import the bean, even if it is not part of package?
The code I test come from source code of book SCWCD Exam Study Kit, and the import statement is right in the page JSP.
My Bean class is in WEB-INF/classes directory ...
I'm stuck
Regards,
Cyril.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61066
    
  66

Put your bean in a package. The various servlet containers get freaky about package-less classes. This is just good practice in any case.
bear


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
cyril vidal
Ranch Hand

Joined: Jul 02, 2003
Posts: 247
Many thanks Bear! It's OK now.. and it's worth knowing it!!
Regards,
Cyril.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Jasper compile error