这是 我的部分程序
setlvet :
BookBean bookbean = new BookBean();
bookbean.setbookid(rst.getString(1));
bookbean.settitle(rst.getString(2));
bookbean.setauthor(rst.getString(3));
bookbean.setprice(rst.getFloat(4));
bookbean.setpress(rst.getString(5));
bookbean.setyear(rst.getDate(6));
session.setAttribute("bookbean",bookbean);
}catch(SQLException e){
}
if( id.equals("")){ //id 是 前一个jsp 的form传过来的参数
RequestDispatcher rd = request.getRequestDispatcher("/jsp/request1.jsp");
rd.forward(request, response);
return;
}
else{
RequestDispatcher rd = request.getRequestDispatcher("/jsp/1.jsp");
rd.forward(request, response);
return;
}
jsp :
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
</head>
<%@ include file = "request1.jsp"%>
<body>
<jsp:useBean id = "bookbean" class = "Bean.BookBean" scope="session"/>
<jsp:getProperty name="bookbean" property="bookid"/>
<hr color="#009933">
查询结果:<br>
<p align="center">
书号:<%=bookbean.getbookid()%><br>
书名:<%=bookbean.gettitle()%><br>
作者:<%=bookbean.getauthor()%><br>
价格:<%=bookbean.getprice()%><br>
出版社:<%=bookbean.getpress()%><br>
出版日期:<%=bookbean.getyear()%>
</p>
</body>
</html>
在serlvet里 把数据存放在javabean 对象里 通过forword 转发给jsp javabean 内的数据传递不过去
请高手指点 谢谢!!!