• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Compilation error on importing class

 
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
It is difficult to free fools from the chains they revere - Voltaire. tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic