请问 我怎样把 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')%>";调用 但不行 帮帮 谢谢
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')%>";调用 但不行 帮帮 谢谢
解决方案 »
- java定时器???
- java游戏问题
- 请教一个主键生成
- 多线程的循环问题!!谢谢了
- 把数据库的驱动及URL放到一个配置文件中,如何访问这个配置文件呢,菜鸟求救
- [求助]请问,8000万的数据库记录,根据参数表查询,在2-4小时内生成大约10G的文件,如何才能实现???【在线等】
- 100,如何用java实现对常用格式的文件内容(bytes)的非对称加密?分不够再加!!up有分!
- 请问各位高手个错误可能是什么引起的??
- 对thinking in java2的小问题
- getClass().getResource()问题
- 用MyEclips加Hibernate开发时出现的错误,请高手们帮帮忙
- 对 read(char char[],int off,int len) 不解
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"));
这边加点打印语句能不能打出来
如果能打出来的话,应该没有什么问题
这种写法明显有错,String stPlacard_No =(String)session.getAttribute("count");