struts2 result的jsp页面如何规定width和height?

struts2 result的jsp页面如何规定width和height?

问题描述:

struts2 result的jsp页面如何规定width和height?
比如我的struts.xml中定义了下面这段
[code="java"]
action name="xxx" class="xxxAction">
/index.jsp
/error.jsp
/message.jsp


[/code]
当xxxAction return success后,IE浏览器弹出了message.jsp页面
我如何设定弹出的IE页面的属性,像toolbar=no这样的设置?

我知道js中的window.open()第三个参数就能实现弹出窗口的属性设置,比如toolbar=no。
但是在struts2架构下该在哪里写下toolbar=no这行代码?
我们再来看一下struts2的"运行轨迹"
index.html中定义


/s:form
当我点击登录后执行loginAction.java中的excute()
然后excute()返回了"success"
考虑到我在struts.xml中配置了

/message.jsp

所以浏览器弹出了一个新的窗口
我想解决的就是如何让这个新弹出的窗口上没有菜单栏和地址栏

我的意思是说. 在用表单提交之后.
在返回的页面(已经接收到服务器返回的数据)上
再用window.open 弹出要显示的数据

不能设置的.还是在新页面用window.open吧

或者不用post而用window.open(url)的方式传值

有一种 投机取巧的办法!那就是在action处理之前就设定好window的大小,比如有一行的导航按钮,一点导航按钮的时候,使用:
[code="java"]function openWinNew(htmUrl) {
// alert(htmUrl);
var url = htmUrl; // 要打开的窗口
var winName = "newWin"; // 给打开的窗口命名
// screen.availWidth 获得屏幕宽度
// screen.availHeight 获得屏幕高度
// 居中的算法是:
// 左右居中: (屏幕宽度-窗口宽度)/2
// 上下居中: (屏幕高度-窗口高度)/2
var awidth = screen.availWidth / 3 * 2; // 窗口宽度,需要设置
var aheight = screen.availHeight / 3 * 2.4; // 窗口高度,需要设置
var atop = (screen.availHeight - aheight) / 2; // 窗口顶部位置,一般不需要改
var aleft = (screen.availWidth - awidth) / 2; // 窗口放中央,一般不需要改
var param0 = "toolbar=no, menubar=no, scrollbars=yes, resizable=yes,location=no, status=no,directories=no"; // 新窗口的参数
// 新窗口的左部位置,顶部位置,宽度,高度
var params = "top=" + atop + ",left=" + aleft + ",width=" + awidth
+ ",height=" + aheight + "," + param0;
var win = window.open(url, "", params);
win.focus(); // 新窗口获得焦点
}[/code]

可以设定好窗口的大小,将地址写成action 形式,提交给Action 之后,由于将窗体onfous了,所以始终都放回到你设定好的界面上来!大小也就定了!

ps:window.open(url, "", params);

中“”,应该换成 变量:winName;才能实现始终聚焦!