打开一个缩小了圣杯尺寸的新窗口

Opening a new window with reduced size in grails

本文关键字:新窗口 窗口 圣杯 缩小 一个      更新时间:2023-09-26

我有一个名为showcontacts的控制器操作,单击链接时会调用该操作。该操作显示联系人调用一个java方法,该方法在接受参数作为参数后从Web服务获取一些联系人。这些都工作正常。现在,我必须从此操作中打开一个缩小大小的窗口(如弹出窗口)作为新模板。我该怎么做?请帮忙。我尝试的如下:

控制器:客户

行动:

def showcontacts={
    log.info(params.tdc+params.companyid+params.companytype)
    def contact=server.util.SOAPClientSAAJ.showContacts(params);
    render view:'showcontacts', model:[contact:contact]
}

我在showcontacts.gsp中尝试过这样:

<html>
<head>
<meta charset="utf-8" />
<title>jQuery UI Dialog - Default functionality</title>
<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jqueryui.css" />
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
<link rel="stylesheet" href="/resources/demos/style.css" />
<script>
 $(function() {
 $( "#dialog" ).dialog();
 });
</head>
<body>
<g:if test="${contact}">
<div id="dialog" title="Contacts">
 ${contact.firstName}
</div>
</g:if>
</body>
</html>

即使新窗口出现,它也隐藏了另一个窗口(不像弹出窗口)。

或者简单地说明我的要求是如何调用窗口。从我的视图中打开javascript显示联系人???

您可以像这样打开一个缩小大小的新窗口。

<a href="javascript:void(0)" onclick="javascript:asd()">asd</a>
<script>
function asd(){
window.open("${g.createLink(controller: 'testController', action: 'testAction', params: [name:'hello Vivek'])}",'', 'width=200,height=100');
}
</script>

如果要在新选项卡中打开它,可以尝试此操作。

<g:link controller="testController" action="testAction" target="_blank">Test</g:link>

享受。。