2 ouyouna ouyouna 于 2014.10.20 11:11 提问

各位帮个忙,子窗口打开了,按键不响应servlet,是参数没传进去?

ConsultationServlet:

public void buy(HttpServletRequest request,
HttpServletResponse response) throws IOException {

int rem_id = Integer.parseInt(request.getParameter("hi"));
ConsultationService cs = new ConsultationService();
...
if (rtn.equals("1")) {
response.setContentType("text/html;charset=GBK");

        PrintWriter out = response.getWriter();
        out.write("<script  type=\"text/javascript\">");
        out.print("alert('购买成功!待会诊');");
        // //子窗口刷新父窗口
        out.write("self.opener.location.reload();");
        // 关闭窗口
        out.write("window.opener=null;");
        out.write("window.close();");
        out.write("</script>");
        out.close();

}
这是子窗口jsp代码
function fn(){
var id1 = window.dialogArguments;
document.getElementById("hi").value = id1;
var str="ConsultationServlet?flag=buy&rem_id="+ id1;
alert("您传递的参数为:" + str);

var form = document.getElementById("news");
form.action="ConsultationServlet?flag=buy";
form.submit(); ;

body id="bo" 
form id="news" method="post"
haha
input type="hidden" name="hi" id="hi"
input type="button" value="申请授权" onclick="fn()" 
Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!