请问 我怎样把 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')%>";调用  但不行 帮帮 谢谢

解决方案 »

  1.   

    首先你能不能从数据库中取得记录 
     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"));
    这边加点打印语句能不能打出来
    如果能打出来的话,应该没有什么问题
      

  2.   

    能够的 那个 我认真的试过 提示'count'附近有错
      

  3.   

    你这写的什么啊。这么多的操作都放在jsp页面里吗?
      

  4.   

    String   stPlacard_No ="<%=(String)session.getAttribute('count')%>";
    这种写法明显有错,String   stPlacard_No =(String)session.getAttribute("count");