- This topic has 4 replies, 3 voices, and was last updated 21 years, 8 months ago by
support-michael.
-
AuthorPosts
-
stardevMemberHi,
I have a simple Java Bean called from my JSP using “<jsp:includebean…”.
When I run the application in debug mode (deployed to Tomcat 5) I get the following error:
org.apache.jasper.JasperException: Unable to compile class for JSP
An error occurred at line: 30 in the jsp file: /MyJsp.jsp
Generated servlet error:
[javac] Compiling 1 source fileC:\Program Files\Apache Software Foundation\Tomcat 5.0\work\Catalina\localhost\HelloWorld\org\apache\jsp\MyJsp_jsp.java:69: cannot resolve symbol
symbol : class User
location: class org.apache.jsp.MyJsp_jsp
User myUserBean = null;
^FYI, the User.class file has been deployed to the Tomcat webapps\WEB-INF\classes folder.
Any ideas why this isn’t working? Do I need to add the WEB-INF\classes folder to the classpath?
Regards
D.
November 19, 2003 at 10:45 am #200179
Scott AndersonParticipantD,
Is the User class in the default package or is there a proper export for it? Did the JSP pass compilation validation within the enviornment? You can ensure that this is on by checking the setting on the JSP editor preference page.
–Scott
MyEclipse SupportNovember 19, 2003 at 11:40 am #200183
stardevMemberHi,
The JSP is valid, so no worries there. Whether it’s correct or not is a different matter… 😀
The class was in the default package. Consequently the JSP just referenced “User”, e.g.:
<jsp:useBean id=”myUserBean” scope=”request” class=”User”/>
<%
out.println(“User is ” + myUserBean.getName());
%>I don’t understand the bit about exporting? What is that?
BTW, I have now moved my bean to a defined package (com.djwheatley) and added a “<%@ page import=”com.djwheatley.User” %> to my JSP. I then changed my “usebean” tag to specifically reference the package:
<jsp:useBean id=”myUserBean” scope=”request” class=”com.djwheatley.User”/>
Now everything works fine!
I’m still confused though. Why should I need to put the bean in a defined package?
Thanks for your help.
D.
November 19, 2003 at 11:11 pm #200194
support-michaelKeymasterI believe a error resulting from a reference to Java class located in the default package is a bug. I’m submitting this for further research.
Michael
MyEclipse SupportNovember 19, 2003 at 11:21 pm #200195
support-michaelKeymasterI was just running test on our next release and it supports Java classes located in the default package without error. Maybe I’ll look a little closer. Please note that there this a bug in the handling of jsp:setProperty and jsp:getProperty that has been addressed and will be available shortly.
Michael
MyEclipse Support -
AuthorPosts