JSP页面无法重定向到打印页面

时间:2019-11-09 06:33:40

标签: java jsp

我通过console.log检查了ajax函数的结果。但是我发送的页面没有重定向到print.jsp页面

[{{“ lastinsetid”:44}] [{“ lastinsetid”:44},{“ lastinsetid”:44}]

Ajax调用中的

sales.jsp页面

 success: function (data)
        {
           window.location.href = "print.jsp?lastinsetid=" + lastinsetid;   
        }

salesadd servlet (添加数据之后)返回sales.jsp页面

 JSONArray list = new JSONArray();
            JSONObject obj = new JSONObject();
            Class.forName("com.mysql.jdbc.Driver");
            pst = con.prepareStatement("insert into sales_product(sales_id,prod_id,price,qty,total)values(?,?,?,?,?) ");
            pst.setInt(1, lastinsetid);
            pst.setInt(2, product.get_barcode());
            pst.setInt(3, product.getPrice());
            pst.setInt(4, product.getQty());
            pst.setInt(5, product.getTotal());
            pst.executeUpdate();
            obj.put("lastinsetid", lastinsetid);
            list.add(obj);
            out.print(list.toJSONString());
            out.flush();     

0 个答案:

没有答案