Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/jsp/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 使用新窗口属性集从JSP在新窗口中打开URL_Java_Jsp - Fatal编程技术网

Java 使用新窗口属性集从JSP在新窗口中打开URL

Java 使用新窗口属性集从JSP在新窗口中打开URL,java,jsp,Java,Jsp,在处理action类之后,我有一个动态属性,它需要作为查询字符串追加到静态URL中,如”https://www.google.co.in/?zipcode=“+zipcode” 至此,我已经完成了。然后,我将控制权传递给JSP,请求中包含URL。现在,我想从JSP中使用特定的新窗口属性在新窗口中打开此URL 这是我正在从我的jsp尝试的: <% String redirectURL = (String)request.getAttribute("url2redirect"); respo

在处理action类之后,我有一个动态属性,它需要作为查询字符串追加到静态URL中,如
”https://www.google.co.in/?zipcode=“+zipcode”
至此,我已经完成了。然后,我将控制权传递给JSP,请求中包含URL。现在,我想从JSP中使用特定的新窗口属性在新窗口中打开此URL

这是我正在从我的jsp尝试的:

<% 
String redirectURL = (String)request.getAttribute("url2redirect");
response.sendRedirect(%><javascript:openNewWindow()><%
%>
<script> 
function openNewWindow() {
    var screenWidth = screen.width;
    var screenHeight = screen.height;
    var contactUsWidth = screenWidth*90/100;
    var contactUsHeight = screenHeight*90/100;         
window.open('<%=redirectURL%>','appointment','scrollbars,menubar=no,width='+contactUsWidth+',height='+contactUsHeight+',resizable=no,toolbar=no,location=no,status=no,copyhistory=yes,left=0,top=0,screenX=0,screenY=0');

}
</script><%);%>

函数openNewWindow(){
var screenWidth=screen.width;
var screenHeight=screen.height;
var contactUsWidth=屏幕宽度*90/100;
var contactUsHeight=屏幕高度*90/100;
window.open(“”,'appointment','scrollbars,menubar=no,width='+contactUsWidth+',height='+contactUsHeight+',resizable=no,toolbar=no,location=no,status=no,copyhistory=yes,left=0,top=0,screenX=0,screenY=0');
}
给出语法错误是行不通的……这是正确的方法吗?
如何在具有不同窗口属性的新窗口中打开此URL。

为什么从
response.sendRedirect()调用此javascript方法

这不管用吗

<% 
String redirectURL = (String)request.getAttribute("url2redirect");
%>
<script> 
function openNewWindow() {
    var screenWidth = screen.width;
    var screenHeight = screen.height;
    var contactUsWidth = screenWidth*90/100;
    var contactUsHeight = screenHeight*90/100;         
window.open('<%=redirectURL%>','appointment','scrollbars,menubar=no,width='+contactUsWidth+',height='+contactUsHeight+',resizable=no,toolbar=no,location=no,status=no,copyhistory=yes,left=0,top=0,screenX=0,screenY=0');

}
</script>

函数openNewWindow(){
var screenWidth=screen.width;
var screenHeight=screen.height;
var contactUsWidth=屏幕宽度*90/100;
var contactUsHeight=屏幕高度*90/100;
window.open(“”,'appointment','scrollbars,menubar=no,width='+contactUsWidth+',height='+contactUsHeight+',resizable=no,toolbar=no,location=no,status=no,copyhistory=yes,left=0,top=0,screenX=0,screenY=0');
}
如果要在加载页面时加载弹出窗口,请从body调用
openNewWindow()