*
The moose likes JSP and the fly likes Compilation error on importing class Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Compilation error on importing class" Watch "Compilation error on importing class" New topic
Author

Compilation error on importing class

James Zhang
Ranch Hand

Joined: Sep 06, 2002
Posts: 30
Hi,
I need help to figure out what is wrong with my testing jsp page as below:
<%@ page import="AddressBean" %>
<jsp:useBean id="address" class="AddressBean" scope="session" />
<jsp:setProperty name="address" property="*" />
<html><body>
The address is <br><jsp:getProperty name="address" property="street" /><br>
<jsp:getProperty name="address" property="city" />,
<jsp:getProperty name="address" property="state" />
<jsp:getProperty name="address" property="zip" />
</body></html>
The AddressBean.class has been compiled correclty and is placed under WEB-INF\classes.
When the jsp page is loaded (either by other jsp page or loaded directly), I always got a compilation error for the first line:
C:\bea\user_projects\domains\SimpleBean\.\myserver\.wlnotdelete\extract\myserver_jspapp3_jspapp3\jsp_servlet\__address.java:17: '.' expected
probably occurred due to an error in /address.jsp line 1:
<%@ page import="AddressBean" %>
It is quite confusing. Anybody has similar experience? By the way, I am using Weblogic as my server.
Thanks in advance!
--Jian
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12761
    
    5
You are not using import correctly, import needs a package and ALL classes used in JSP or servlets should be in packages. (Yes, I know you can sometimes avoid it, but trust me on this.)
Instead of:

use a package in both import and useBean:

Bill
James Zhang
Ranch Hand

Joined: Sep 06, 2002
Posts: 30
Bill, thanks a lot for your quick reply and excellent suggestion! I made the change and it works now!
Thanks again!
--Jian
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Compilation error on importing class
 
Similar Threads
Jasper compile error
jsp:useBean
jsp:useBean question
useBean directive,which is true, and why?
jsp:getProperty action