日期:2014-05-18  浏览次数:20641 次

谁给我看看这代码有什么问题???
<%@   page   contentType= "text/html;   charset=gb2312 "   language= "java "   import= "java.sql.* "   errorPage= " "   %>
<%@   include   file= "banner.jsp "   %>
<div   align= "center ">
<h1> 编辑移动通信用户信息 </h1>
<form   action= "admindata.jsp "   method= "post "   name= "form1 ">
<center>
<input   type= "radio "   name= "radio "   value= "1 "   checked= "checked "   /> 帐号: <input   type= "text "   name= "user "   /> <br   />
<input   type= "radio "   name= "radio "   value= "2 "   /> 电话: <input   type= "text "   name= "telephone "   /> <br   /> <br   />
<input   type= "submit "   name= "submit "   value= "确定 "   onclick= "check() "   />
</center>
</form>
</div>
<%
String   user=request.getParameter( "user ");
String   telephone=request.getParameter( "telephone ");

%>
<%@   include   file= "conn.jsp "   %>
<script   language= "javascript ">
function   check(){
if   (document.form1.radio.value==1){
<%     String   sql= "select   *   from   user_admin   where   user= ' "+user+ " ' ";   %>
}
if   (document.form1.radio.value==2){
<%     sql= "select   *   from   user_admin   where   telephone= ' "+telephone+ " ' ";   %>
}
}
</script>
<%
  if   ((user!=null)||(telephone!=null))
{
ResultSet     rs=statement.executeQuery(sql);  
  user=rs.getString( "user ");
  telephone=rs.getString( "telephone ");  
%>

修改 <%=user%>
<%
rs.close();          
}

%>

<%

  statement.close()   ;
  connection.close();
 
%>


------解决方案--------------------
user=rs.getString( "user ");
telephone=rs.getString( "telephone ");


==>

if(rs.next()){
user=rs.getString( "user ");
telephone=rs.getString( "telephone ");
}