当前位置: 技术问答>java相关
请帮忙看看这个错误,先谢谢了。。。。。。。。。。。。。
来源: 互联网 发布时间:2015-02-22
本文导语: 我在CLASSPATH中加入了e:jspnettomcatwebappsexamplesjsp,在E:jspnettomcatwebappsexamplesjspmy有一个helloWorld.class,我用一个JSP文件连接这个class,但是出现错误: Error: 500 Location: /examples/jsp/1.jsp Internal Servlet Error: org.apache.jasper.JasperExcepti...
我在CLASSPATH中加入了e:jspnettomcatwebappsexamplesjsp,在E:jspnettomcatwebappsexamplesjspmy有一个helloWorld.class,我用一个JSP文件连接这个class,但是出现错误:
Error: 500
Location: /examples/jsp/1.jsp
Internal Servlet Error:
org.apache.jasper.JasperException: Unable to compile Note: sun.tools.javac.Main has been deprecated.
E:jspnettomcatworkDEFAULTexamplesjsp_1_1.java:80: Class my.helloWorld not found.
my.helloWorld helloBean = null;
^
E:jspnettomcatworkDEFAULTexamplesjsp_1_1.java:83: Class my.helloWorld not found.
helloBean= (my.helloWorld)
^
E:jspnettomcatworkDEFAULTexamplesjsp_1_1.java:88: Class my.helloWorld not found.
helloBean = (my.helloWorld) java.beans.Beans.instantiate(this.getClass().getClassLoader(), "my.helloWorld");
^
3 errors, 1 warning
两个文件为:
//helloWorld.java
package my;
public class helloWorld {
public String name = "My first bean";
public String getHi()
{
return "Hello from " + name;
}
}
//1.jsp
Hi-JSP实验
Error: 500
Location: /examples/jsp/1.jsp
Internal Servlet Error:
org.apache.jasper.JasperException: Unable to compile Note: sun.tools.javac.Main has been deprecated.
E:jspnettomcatworkDEFAULTexamplesjsp_1_1.java:80: Class my.helloWorld not found.
my.helloWorld helloBean = null;
^
E:jspnettomcatworkDEFAULTexamplesjsp_1_1.java:83: Class my.helloWorld not found.
helloBean= (my.helloWorld)
^
E:jspnettomcatworkDEFAULTexamplesjsp_1_1.java:88: Class my.helloWorld not found.
helloBean = (my.helloWorld) java.beans.Beans.instantiate(this.getClass().getClassLoader(), "my.helloWorld");
^
3 errors, 1 warning
两个文件为:
//helloWorld.java
package my;
public class helloWorld {
public String name = "My first bean";
public String getHi()
{
return "Hello from " + name;
}
}
//1.jsp
Hi-JSP实验
|
e:jspnettomcatwebappsexamplesWEB-INF改为e:jspnettomcatwebappsexamplesWEB-INFclasses
|
把
放到外面,my.helloWorld.* 应该改为 helloBean.* , 因为你已经设置了 jsp:useBean 这时helloBean 就是你写my.helloWorld .
放到外面,my.helloWorld.* 应该改为 helloBean.* , 因为你已经设置了 jsp:useBean 这时helloBean 就是你写my.helloWorld .