jsp中使用<jsp:setProperty />向javabean中设值为什么javabean不能调用啊?
jsp代码:
<%@page contentType= "text/html "%>
<%@page pageEncoding= "UTF-8 "%>
<jsp:useBean class= "pack.MyBean " scope= "session " id= "tt "/>
<html>
<head>
<meta http-equiv= "Content-Type " content= "text/html; charset=UTF-8 ">
<title> JSP Page </title>
</head>
<body>
<jsp:setProperty name= "tt " property= "bookid " value= "1 "/>
<jsp:getProperty name= "tt " property= "bookid "/>
<jsp:getProperty name= "tt " property= "desc "/>
</body>
</html>
javabean代码:
package pack;
import java.io.Serializable;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import
java.sql.SQLException;
import java.sql.Statement;
public class MyBean extends Object implements Serializable {
private String desc;
public String getDesc() {
return this.desc;
}
public void setDesc(String desc) {
this.desc = desc;
}
public int bookid;
public int getBookid() {
return this.bookid;
}
public void setBookid(int bookid) {
this.bookid = bookid;
}
public MyBean() {
try {
Class.forName( "sun.jdbc.odbc.JdbcOdbcDriver ");
Connection conn=DriverManager.getConnection( "jdbc:odbc:bookdb ", " ", " ");
&nbs