求救!!!

liu0214065121 2005-10-29 02:14:40
请问 我怎样把 jsp页面中从数剧库 查找到的参数 传到 javabean 如下 我用的是session 但不可以

<%
String strPage = request.getParameter("Page");
String strSql = "";
ObjDBConnBean = com.goldgrid.DBConnBean.getInstance();
Connection Conn = ObjDBConnBean.getConnection("goa");
Statement stmt = null;
try {
String strPlacard_No = new String(request.getParameter("SelectedItems").getBytes("8859_1"));
stmt = Conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);
session.setAttribute("strPlacard_No1",strPlacard_No);
strSql = "SELECT * FROM [Forum] WHERE Placard_No = '"+strPlacard_No+"'";//显示发布的帖子
rs = stmt.executeQuery(strSql);
//int count=rs.getInt("d_count");
// count++;
if (rs.next()){
int count=rs.getInt("d_count");
count++;
String cishuo=String.valueOf("count");
session.setAttribute("count",cishuo);
session.setAttribute("title0",(String)rs.getString("title"));
session.setAttribute("description0",(String)rs.getString("description"));
%>
然后我就在bean里用 String stPlacard_No ="<%=(String)session.getAttribute('count')%>";调用 但不行 帮帮 谢谢

...全文
75 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
yangjiyue 2005-10-30
  • 打赏
  • 举报
回复
String stPlacard_No ="<%=(String)session.getAttribute('count')%>";???
bean能这样子用?
你可以在BEAN中连接数据库
取出参数,然后存到BEAN中
在调用BEAN时再取出来
yy80680169 2005-10-30
  • 打赏
  • 举报
回复
复杂的问题,迷糊
pieapple 2005-10-30
  • 打赏
  • 举报
回复
up
网络精灵 2005-10-29
  • 打赏
  • 举报
回复
开了两个贴子啊。

62,629

社区成员

发帖
与我相关
我的任务
社区描述
Java 2 Standard Edition
社区管理员
  • Java SE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧