主题:疑似找不到引用的类,初学者的问题
弄了将近两天环境,都快崩溃了,只有上来求救下,望各位大侠,不吝赐教,小仙在此拜谢了.全部目录结构是tomcat/webapps/studyJsp ,在这下面有.project .classpath文件 index.jsp cw/ss.class ce/ss.java 以下有各个文件的源码,报错是
org.apache.jasper.JasperException: org.apache.jasper.JasperException: Unable to compile class for JSP
An error occurred at line: 2 in the jsp file: /index.jsp
Generated servlet error:
ss cannot be resolved to a type
ss.class类文件 在cw下 原java内容如下.
package cw;
public class ss {
public String Soul(String x){
x = "Xfu = Le + qL."+x;
return x;
}
}
index.jsp文件 内容如下
<%@ page import="cw.*"%> //改成<%@ page import="ss"%> 也不好使,全目录加过也不行
<%
ss xr = new ss();
String bx = xr.Soul("sL.");
out.print(bx);
%>
.classpath .project 两个是自动生的,我没动过,如果可以的话,请讲下这两文件的用途
.classpath 文件 内容如下
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="ce" path="ce"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="output" path="cw"/>
</classpath>
.project文件 内容如下
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>sL</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
org.apache.jasper.JasperException: org.apache.jasper.JasperException: Unable to compile class for JSP
An error occurred at line: 2 in the jsp file: /index.jsp
Generated servlet error:
ss cannot be resolved to a type
ss.class类文件 在cw下 原java内容如下.
package cw;
public class ss {
public String Soul(String x){
x = "Xfu = Le + qL."+x;
return x;
}
}
index.jsp文件 内容如下
<%@ page import="cw.*"%> //改成<%@ page import="ss"%> 也不好使,全目录加过也不行
<%
ss xr = new ss();
String bx = xr.Soul("sL.");
out.print(bx);
%>
.classpath .project 两个是自动生的,我没动过,如果可以的话,请讲下这两文件的用途
.classpath 文件 内容如下
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="ce" path="ce"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="output" path="cw"/>
</classpath>
.project文件 内容如下
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>sL</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>