日期:2014-05-17  浏览次数:20690 次

处理页面获取不到ID 得到的是为null
这是提交到处理页面的的 连接
JScript code
td>   
<td>
                                                        <a href="order_del_deal.jsp?ID=<%=OrderID%>"onclick="return confirm('真的要删?')">删</a></td>


这是处理删除的页面
JScript code

<%@ page contentType="text/html; charset=gbk" language="java" import="java.sql.*" errorPage="" %>
<meta http-equiv="Content-Type" content="text/html; charset=gbk">
<%@ page import="com.wgh.dao.OrderDaoImpl"%>
<jsp:useBean id="Order" scope="page" class="commerce.Order">
<jsp:setProperty name="Order" 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=Order.getOrderID();            //这边为什么会id=-1  或者为null;  -----传过来就是null的
System.out.println("删除id= "+id);        
ResultSet rs=conn.executeQuery("select * from tb_order where OrderID=" + id);
//System.out.println(rs);
if (!rs.next()){
    out.println("<script language='javascript'>alert('您的操作有误');window.location.href='ordermanage.jsp';</script>");
}else{
    int ret=0;
        OrderDaoImpl del_order=new OrderDaoImpl();
        ret=del_order.delete(Order);
    if (ret!=0){
          out.println("<script language='javascript'>alert('订单信息删除成功!');window.location.href='ordermanage.jsp';</script>"); 
        }else{
          out.println("<script language='javascript'>alert('订单信息删除失败!');window.location.href='ordermanage.jsp';</script>");
        }
}
%>




------解决方案--------------------
用request.getParameter("ID")获取
------解决方案--------------------
+1
探讨

用request.getParameter("ID")获取