高手们指点指点啊...
JavaBean.jsp代码如下:
<%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*"
errorPage="" %>
<html>
<body>
<jsp:useBean id="student" scope="application" class="rmg.Student" />
<%=Student.getName()%><br>
<% Student.setName("cong"); %>
<jsp:getProperty name="student" property="classNo" /> <br>
<jsp:getProperty name="student" property="name" /> <br>
<jsp:getProperty name="student" property="age" /> <br>
<jsp:getProperty name="student" property="sexy" /> <br>
<%=Student.getClassNo() %> <br>
<%=Student.getName() %> <br>
<%=Student.getAge() %> <br>
<%=Student.getSexy() %> <br>
<%--引用Java类库中生成的bean组件 --%>
<jsp:useBean id="date" scope="session" class="java.util.Date" />
<%=date%><br>
</body>
</html>
Student.Java代码如下:
package rmg;
public class Student {
private long classNo;
private String name;
private int age;
private boolean sexy;
public Student() { //构造函数
classNo=970431;
name="ZZZl";
age=34;
sexy=true;
}
public long getClassNo() {
return classNo;
}
public void setClassNo(long no) {
this.classNo=no;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name=name;
}
public int getAge() {
return age;
}
public void setAge(int age) {
this.age=age;
}
public boolean getSexy() {
return sexy;
}
public String getSexyStr(){
if(sexy)return "男";
else return "女";
}
public void setSexy(boolean sexy) {
this.sexy=sexy;
}
}
在JavaBean.jsp同一目录下建了一个Student.java,然后生成了一个文件夹rmg,里面是Student.class
高手们看看哪里出错了啊,运行不出来啊...谢谢了啊...
------解决方案--------------------
Student.class
这个文件的位置是不是不正确
应该是在WEB-INF/classes/rmg下面