还是关于JAVABEAN的问题
我用的是Eclipse + Tomcat.我建立的是Tomcat项目.在WEB-INF/src下建立了包ufrog之后建立Circle.java.实际文件夹WEB-INF/classes/ufrog下已经编译好了Circle.class.
<!-- Circle.java -->
package ufrog;
public class Circle {
private int radii;
public int getRadii() {
return radii;
}
public void setRadii(int r) {
radii=r;
}
}
<!-- index.jsp -->
<%@ page contentType= "text/html;charset=GB2312 " %>
<%@ page import= "ufrog.Circle; " %>
<jsp:useBean id= "cir " class= "Circle " scope= "page "> </jsp:useBean>
<jsp:setProperty property= "5 " name= "radii " />
<%
out.println( "半径是 "+ cir.getRadii());
%>
index.jsp是放在项目的根目录下
现在启动Tomcat之后出现问题
org.apache.jasper.JasperException: /index.jsp(4,0) The value for the useBean class attribute Circle is invalid.
又或是
org.apache.jasper.
JasperException: Unable to load class for JSP
我是刚开始接触jsp的开放.不知道Eclipse里面是不是也要进行甚么配置.望XD指教
------解决方案-------------------- <jsp:setProperty property= "5 " name= "radii " />
这行改为
<jsp:setProperty name= "cir " property= "radii " value= "5 " />