在modify.jsp中怎么的到href="modify.jsp?id=<%=id%>">中id的值
我写了二个页面,一个是userlist.jsp页面,一个是modefy.jsp页面,userlist.jsp用来显示数据库中的内容,modefy.jsp页面是用来修改数据库中的内容的!userlist.jsp中的链接代码相关如下,: <a   href= "modify.jsp?id= <%=rs.getInt( "ID ")%>  "> 修改 </a> 数据库中的ID的值是int类型的. 
 modefy.jsp页面中的相关代码如下: <% 
 int   id=0; 
 try 
 { 
 id=Integer.parseInt(request.getParameter( "id ").toString()); 
 }catch(Exception   e) 
 { 
 out.println( "连接错误! "); 
 out.close(); 
 } 
 %>  
 ResultSet   rs=stmt.executeQuery( "select   *   from   users   where   ID= "+id); 
 调试的时候老是显示( "连接错误! "),toString()这个去掉了也还是一样,知道的兄弟帮下忙,!!
------解决方案--------------------ID用一个hidden的文本框啊。。 
 我也不清楚为什么会连接错误,应该是你的id=Integer.parseInt......不能取到值吧。。     
 如果你第一页有输入ID ,,request.getParameter()能得到值 。。。。
------解决方案--------------------1、就直接String id=request.getParameter( "id "); 
 2、为什么ResultSet不放在 <%%> 里面?应该是 <%ResultSet rs=stmt.executeQuery( "select * from users where ID= ' "+id+ " ' ");%>  
 3、你第二个页面有连接上数据库吗?
------解决方案--------------------既然try,catch里只有这一句:id=Integer.parseInt(request.getParameter( "id ").toString()); 
 那应该就是他的问题了,调试看看request.getParameter( "id ")得到的是什么东西。
------解决方案--------------------把数据库的异常打出来,看看是不是stmt为空,或是数据库没有连接上,应该是还没执行语句就抛错了 
 try 
 { 
 id=Integer.parseInt(request.getParameter( "id ").toString()); 
 }catch(Exception e) 
 { 
 e.printStackTrace(); 
 out.println( "连接错误! "); 
 out.close(); 
 } 
------解决方案--------------------恩,有可能估计是数据库的问题,
------解决方案--------------------恩,有可能估计是数据库的问题, 
 ==================================== 
 什么数据库有问题,他的catch里面就没有根数据库做任何交互 
 try 
 { 
 id=Integer.parseInt(request.getParameter( "id ").toString()); 
 }catch(Exception e) 
 { 
 e.printStackTrace(); 
 out.println( "连接错误! "); 
 out.close(); 
 } 
 看他catch的是什么,只不过是一次转化,情况无外乎两种1,你取不到id,2,你的Id不能转化为int. 
 你为什么要转成int呢? 
 select语句中有不需要这样 
------解决方案--------------------request.getParameter( "id ") 先取值调试下,然后看看,: <a href= "modify.jsp?id= <%=rs.getInt( "ID ")%>  "> 是否rs中是否有值传到id中,可以打印出来可看看的
------解决方案--------------------恩
------解决方案--------------------和下面数据库操作无关,肯定是request.getParameter( "id ")这个出错了,拿到的可能是null或者是字符串,这样前面的转换就会报错
------解决方案--------------------类型转换错误,跟数据库没有关系.request.getPara得到的值不是数字字符串
------解决方案--------------------up