当前位置: 代码迷 >> Java Web开发 >> 50分求救,Struts中如何让页面跳出一个对话框
  详细解决方案

50分求救,Struts中如何让页面跳出一个对话框

热度:109   发布时间:2016-04-17 13:04:10.0
50分求救,Struts中怎么让页面跳出一个对话框
谢谢各位大哥赐教!!!

------解决方案--------------------



out.println( " <script> alert( '这样就弹出来了啊 '); </script> ");
------解决方案--------------------
同意楼上。
或者用 BODY 的 onload 触发中。
------解决方案--------------------
function openWin(url, target, width, height, top, left) {
if (orteusSubmitStatus) {
return null;
}
if (url.indexOf( "? ") != -1) {
url += "&windowType= " + POPUP_WINDOW;
} else {
url += "?windowType= " + POPUP_WINDOW;
}
url += "&com.nec.jp.orteusActionMethod.orteusSubmitByLink=controlStart ";

var win = window.open (url, target,
"width= " + width +
", height= " + height +
", top= " + top +
", left= " + left +
", toolbar=no, menubar=no, scrollbars=no, resizable=no,location=no, status=no ");
win.focus();
if (window.gSubWindow == null) {
window.gSubWindow = new Array();
window.gSubWindow[0] = win;
} else {
var subWindowCnt = window.gSubWindow.length;
var isSetted = false;
for (var i = 0; i < subWindowCnt; i++) {
try {
if (window.gSubWindow[i] == null || window.gSubWindow[i].closed) {
window.gSubWindow[i] = win;
isSetted = true;
break;
}
} catch (e) {
window.gSubWindow[i] = win;
isSetted = true;
break;
}
}
if (!isSetted) {
window.gSubWindow[subWindowCnt] = win;
}
}
return win;
}
------解决方案--------------------
在action中 request.setAttribute( "showMsg ", "××成功! ");
在jsp页尾处加入JS
<script language= "javascript ">
var showMsg= " <%=request.getAttribute( "showMsg ")%> ";
if(showMsg!= "null "&&showMsg!= " "){
alert(showMsg);
}
</script>
这样弹出信息就会出现。不知你问的是不是这个意思!
------解决方案--------------------
<logic:equal name= "flag " value= "1 ">
<script language= "javascript ">
alert(‘ <bean:write name= "s "/> ');
</script>
</logic:equal>
需要显示的时候在action中把flag设置成1,alert内容可以写成静态,也可以在action中设置s来实现
------解决方案--------------------
var now=new Date();
var number=now.getSeconds();
var minute=now.getMinutes();
var sum= number*minute;
var objReturn=showModalDialog( "reserve.do?action=detailed&j_code= "+j_code+ "&id= "+id+ "&sum= "+sum, "dialogWidth: "+600+ "px; dialogHeight: "+600+ "px; ");
  相关解决方案