• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Compilation error on importing class

 
James Zhang
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13073
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bill, thanks a lot for your quick reply and excellent suggestion! I made the change and it works now!
Thanks again!
--Jian
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic