我在servlet代码中有:sendStr = monaco.getSend(request.getParameter("operation"));
if (sendStr.equals("Send")){
RequestDispatcher requestDispatcher = request.getRequestDispatcher("Prototype.jsp?Prototype.jsp?location="+ request.getParameter("location"));
requestDispatcher.forward(request, response);
}
else if(sendStr.equals("Review")){
RequestDispatcher requestDispatcher = request.getRequestDispatcher("Prototype.jsp?location="+ request.getParameter("location"));
request.setAttribute("isSuccess", "S");
requestDispatcher.forward(request, response);
System.out.print("send");
}
}
request.setAttribute("message",message);
在jsp中:
<script type="text/javascript">
function openReview(){
<%
String location (String)request.getParameter("location");
String isSuccess = (String)request.getAttribute("isSuccess");
String isTipText = (String) request.getAttribute("tiptext");
if(isSuccess != null && "S".equals(isSuccess) && isTipText.equals("")){
%>
window.open ('Review.jsp', 'newwindow', 'height=600, width=400, top=200,left=400, toolbar=no, menubar=no, scrollbars=no, resizable=no,location=no, status=no');
<%
}
%>
}
</script>
<body onload="openReview()">正常操作是当我点击了按钮review时再打开,这样使可以的,问题是当我每次刷新时,总会执行一次window.open ('Review.jsp', 'newwindow', 'height=600, width=400, top=200,left=400, toolbar=no, menubar=no, scrollbars=no, resizable=no,location=no, status=no');
难道是因为request.setAttribute()有缓存吗
if (sendStr.equals("Send")){
RequestDispatcher requestDispatcher = request.getRequestDispatcher("Prototype.jsp?Prototype.jsp?location="+ request.getParameter("location"));
requestDispatcher.forward(request, response);
}
else if(sendStr.equals("Review")){
RequestDispatcher requestDispatcher = request.getRequestDispatcher("Prototype.jsp?location="+ request.getParameter("location"));
request.setAttribute("isSuccess", "S");
requestDispatcher.forward(request, response);
System.out.print("send");
}
}
request.setAttribute("message",message);
在jsp中:
<script type="text/javascript">
function openReview(){
<%
String location (String)request.getParameter("location");
String isSuccess = (String)request.getAttribute("isSuccess");
String isTipText = (String) request.getAttribute("tiptext");
if(isSuccess != null && "S".equals(isSuccess) && isTipText.equals("")){
%>
window.open ('Review.jsp', 'newwindow', 'height=600, width=400, top=200,left=400, toolbar=no, menubar=no, scrollbars=no, resizable=no,location=no, status=no');
<%
}
%>
}
</script>
<body onload="openReview()">正常操作是当我点击了按钮review时再打开,这样使可以的,问题是当我每次刷新时,总会执行一次window.open ('Review.jsp', 'newwindow', 'height=600, width=400, top=200,left=400, toolbar=no, menubar=no, scrollbars=no, resizable=no,location=no, status=no');
难道是因为request.setAttribute()有缓存吗
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货