首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > Java Web开发 >

JSP页面中有些获取不到值 不知道咋回事求解多谢各位了

2012-04-11 
JSP页面中有些获取不到值 不知道怎么回事求解谢谢各位了这是修改页面JScript code%@ page contentTypet

JSP页面中有些获取不到值 不知道怎么回事求解谢谢各位了
这是修改页面

JScript code
<%@ page contentType="text/html; charset=gbk" language="java" import="java.sql.*" errorPage="" %><%@ page import="com.wgh.DB.connDB"%><%@ page import="com.wgh.DB.chStr"%><jsp:include page="safe.jsp"/><%connDB conn=new connDB();chStr chStr=new chStr();    String PID="";    String userName="";    String trueName="";    String city="";    String address="";    String postcode="";    String cardNO="";    String cardType="";          float Amount=0;    String tel="";    String email=""; PID=request.getParameter("ID");if (PID!=null && PID!=""){    int ID=Integer.parseInt(PID);    ResultSet rs=conn.executeQuery("select * from tb_member where ID="+ID);    if(!rs.next()){        out.println("<script lanuage='javascript'>alert('您的操作有误!');window.location.href='membermanage.jsp';</script>");    }else{        userName=rs.getString("userName");    //用户名        trueName=rs.getString("trueName");    //真实姓名     都有值啊        city=rs.getString("city");        //城市        address=rs.getString("address");    //地址        postcode=rs.getString("postcode");    //邮编        cardNO=rs.getString("cardNO");        //证件号            都有值啊        cardType=rs.getString("cardType");      //证件类型            都有值啊        Amount=rs.getFloat("Amount");            //消费额                tel=rs.getString("tel");        //电话         email=rs.getString("email");    //email        }%><html><head><title>酷腾电子商城后台管理</title><meta http-equiv="Content-Type" content="text/html; charset=gbk"><link href="../CSS/style.css" rel="stylesheet"><script src="onclock.JS"></script><script language="javascript">function mycheck(){    if (form1.username.value==""){        alert("请输入用户名称!");form1.username.focus();return;    }    if (form1.Truename.value==""){        alert("请输入真实姓名!");form1.Truename.focus();return;    }    if (form1.city.value==""){        alert("请输入城市!");form1.city.focus();return;    }    if (form1.address.value==""){        alert("您输入的地址!");form1.address.focus();return;    }        if (form1.postcode.value==""){        alert("请输入邮政编码!");form1.postcode.focus();return;    }    if (form1.cardNO.value==""){        alert("请输入证件号码!");form1.cardNO.focus();return;    }    if (form1.cardType.value==""){        alert("请输入证件类型!");form1.cardType.focus();return;    }        if (form1.tel.value==""){        alert("请输入电话!");form1.tel.focus();return;    }    if (form1.email.value==""){        alert("请输入email!");form1.email.focus();return;    }            if (form1.Amount.value==""){        alert("请输入消费额!");form1.Amount.focus();return;    }    //form1.submit();}</script></head><body  onLoad="clockon(bgclock)"> <table width="777" height="192"  border="0" align="center" cellpadding="0" cellspacing="0" class="tableBorder"><tr>  <td><jsp:include page="banner.jsp"/><table width="777" height="288"  border="0" align="center" cellpadding="0" cellspacing="0">  <tr>    <td width="182" valign="top"><table width="100%" height="431"  border="0" cellpadding="0" cellspacing="0">      <tr>        <td valign="top" background="../images/manage_02.gif"><jsp:include page="navigation.jsp"/></td>      </tr>    </table></td>    <td align="center" valign="top"><table width="100%" height="120"  border="0" cellpadding="0" cellspacing="0">      <tr>        <td valign="top" background="../images/manage_center_memberdetail.gif"><table width="100%" height="36"  border="0" cellpadding="0" cellspacing="0">          <tr>            <td width="98%" align="right">&nbsp;</td>            <td width="2%">&nbsp;</td>          </tr>        </table></td>      </tr>    </table>      <table width="92%" height="192"  border="0" cellpadding="0" cellspacing="0">        <tr>          <td valign="top">          <form action="member_modify_deal.jsp" method="post" name="form1">                       <table width="96%"  border="0" align="center" cellpadding="0" cellspacing="0" class="tableBorder_dashed">               <tr>                 <td width="19%" height="27" align="center" class="tableBorder_B_dashed">&nbsp;用 户 名:</td>                 <td height="13" class="tableBorder_B_dashed"><input name="userName" type="text" class="Sytle_text" value="<%=userName%>" size="50">                     <input name="ID" type="hidden" value="<%=PID%>" />   <!-- 这句是隐藏的PID -->                 </td>               </tr>               <tr>                 <td height="27" align="center" class="tableBorder_B_dashed">&nbsp;真实姓名:</td>                 <td height="14" class="tableBorder_B_dashed"><input name="trueName" type="text" class="Sytle_text" value="<%=trueName%>" size="50">                                   </td>               </tr>               <tr>                 <td height="27" align="center" class="tableBorder_B_dashed">&nbsp;城&nbsp;&nbsp;&nbsp;&nbsp;市:</td>                 <td class="tableBorder_B_dashed"><input name="city" type="text" class="Sytle_text" value="<%=city%>" size="50">                 </td>               </tr>               <tr>                 <td height="27" align="center" class="tableBorder_B_dashed">&nbsp;地&nbsp;&nbsp;&nbsp;&nbsp;址:</td>                 <td height="14" class="tableBorder_B_dashed"><input name="address" type="text" class="Sytle_text" value="<%=address%>" size="50"></td>               </tr>               <tr>                 <td height="27" align="center" class="tableBorder_B_dashed">&nbsp;邮政编码:</td>                 <td width="81%" height="27" class="tableBorder_B_dashed"><input name="postcode" type="text" class="Sytle_text" value="<%=postcode%>" size="50">                 </td>               </tr>               <tr>                 <td height="27" align="center" class="tableBorder_B_dashed">&nbsp;证件类型:</td>                 <td height="14" class="tableBorder_B_dashed"><input name="cardType" type="text" class="Sytle_text" value="<%=cardType%>" size="50">                 </td>               </tr>               <tr>                 <td height="27" align="center" class="tableBorder_B_dashed">&nbsp;证件号码:</td>                 <td class="tableBorder_B_dashed"><input name="cardNO" type="text" class="Sytle_text" value="<%=cardNO%>" size="50">                 </td>               </tr>               <tr>                 <td height="27" align="center" class="tableBorder_B_dashed">&nbsp;电&nbsp;&nbsp;&nbsp;&nbsp;话:</td>                 <td class="tableBorder_B_dashed"><input name="tel" type="text" class="Sytle_text" value="<%=tel%>" size="50"></td>               </tr>               <tr>                 <td height="27" align="center" class="tableBorder_B_dashed">&nbsp;email:</td>                 <td class="tableBorder_B_dashed"><input name="email" type="text" class="Sytle_text" value="<%=email%>" size="50"></td>               </tr>               <tr>                 <td height="27" align="center" class="tableBorder_B_dashed">&nbsp;消 费 额:</td>                 <td class="tableBorder_B_dashed"><input name="Amount" type="text" class="Sytle_text" value="<%=Amount%>" size="50">                   (元)</td>               </tr>               <tr>                 <td height="38" colspan="2" align="center"><input name="Button" type="button" class="btn_grey" value="保存" onClick="submit()">                   &nbsp;                   <input name="Submit2" type="reset" class="btn_grey" value="重置">                   &nbsp;                   <input name="Submit3" type="button" class="btn_grey" value="返回" onClick="JScript:history.back()">                 </td>               </tr>             </table>                              </form>                       </td>        </tr>      </table>      <table width="100%" height="46"  border="0" cellpadding="0" cellspacing="0">        <tr>          <td background="../images/manage_06.gif">&nbsp;</td>        </tr>      </table></td>  </tr></table><table width="777"  border="0" align="center" cellpadding="0" cellspacing="0">  <tr>    <td height="54" align="center"><jsp:include page="copyright.jsp"/></td>  </tr></table></td></tr></table></body></html><%}else{    out.println("<script lanuage='javascript'>alert('您修改会员操作有误!');window.location.href='membermanage.jsp';</script>");}%> 


我Debug的时候
Java code
userName=rs.getString("userName");    //用户名        trueName=rs.getString("trueName");    //真实姓名     都有值啊        city=rs.getString("city");        //城市        address=rs.getString("address");    //地址        postcode=rs.getString("postcode");    //邮编        cardNO=rs.getString("cardNO");        //证件号            都有值啊        cardType=rs.getString("cardType");      //证件类型            都有值啊        Amount=rs.getFloat("Amount");            //消费额                tel=rs.getString("tel");        //电话         email=rs.getString("email");
这些都有值

处理页面:
JScript code
<%@ page contentType="text/html; charset=gbk" language="java" import="java.sql.*" errorPage="" %><%@ page pageEncoding="gbk"%><meta http-equiv="Content-Type" content="text/html; charset=gbk"><%@ page import="com.wgh.dao.MemberDaoImpl"%>   <!-- 到这句就出错   在MemberDaoImpl获取会员的一些信息获取不到  --><jsp:useBean id="member" scope="page" class="commerce.member"><jsp:setProperty name="member" property="*"/></jsp:useBean><jsp:useBean id="chStr" scope="page" class="com.wgh.DB.chStr"/><jsp:useBean id="conn" scope="page" class="com.wgh.DB.connDB"/><jsp:include page="safe.jsp"/><%Integer id=member.getID();System.out.println("会员id: "+id);        //id为null??  ResultSet rs=conn.executeQuery("select * from tb_member where ID="+id);//System.out.println("会员"+rs);//System.out.println("会员"+rs.next());if (!rs.next()){    //out.println("<script language='javascript'>alert('您的操作有误!');window.location.href='index.jsp';</script>");    //不同一条记录?}else{    int ret=0;        MemberDaoImpl up_member=new MemberDaoImpl();        ret=up_member.update(member);    if (ret!=0){          out.println("<script language='javascript'>alert('会员信息修改成功!');window.location.href='membermanage.jsp';</script>");            }else{          out.println("<script language='javascript'>alert('会员信息修改失败!');window.location.href='membermanage.jsp';</script>");        }}%>



[解决办法]
帮顶。。。去打打断点

热点排行