2013年9月25日星期三

window.open () / pop up a new window , url parameter passing can not get the problem ! ! !

Depressed ~ ~ ~ old depressed ! There is an edit page , pop-up window with the realization editing, editing between the need to pass parameters to the background to the database values:
just the beginning , use OpenDialog modal dialog box pops up , so take the URL parameter in the background , there is no problem . However, in the pop-up edit page , there is a pop-up window for adding ( like , add type kind of thing ), Ajax way to add complete, close the Add page , you need to refresh the current edit page. Therefore, the use OpenDialog way refresh function can not be completed , then replaced the open. But the use of the open method pop-up form , the background to get any URL parameters .
list page, open the code :

function OpenWindowsHzw(FileName, OpenW, OpenH) {
var w, h, str;
w = (window.screen.availWidth - 27) / 2 - OpenW / 2;
h = (window.screen.availHeight - 8) / 2 - OpenH / 2;
str = "width=" + OpenW + ",height=" + OpenH + ",top=" + h + ",left=" + w
+ ",resizable=0,scrollbars=yes";
var newWin = window.open(FileName, "window", str);
newWin.focus();
}

function doEdit() {
var id = $("#hiddenid").val();
if (null == id || "" == id) {
return alert('请选择会议室!');
}
var str = "<%=path%>/platform/meetresedit!getMeetById.action?meetResId=" + id;
alert(str);
OpenWindowsHzw(str,550,400);
window.location.reload();
}


submitted to the Action after the Action supplied meetResId value : null ( But sometimes , they can get ) :

                  String meId = null;
try {
                           //这种方式也是鸟的
                           Object obj = ActionContext.getContext().get("meetResId");
                           //有时候、跑到这一句的时候、报空指针异常
meId = request.getParameter("meetResId");
} catch (Exception e) {
e.printStackTrace();
}

Debug in ten million times , there will be one or two then broke character , made ​​to its value.

------ Solution ------------------------------------ --------
you first take a look reload
------ Solution ---------------------- ----------------------
modal boxes exist in the cache , so the use of pop-up modal dialog OpenDialog when attention after the headband parameters , such as:
var now = new Date ();
var url = 'Xxxxxx? a =' + '& now' + now.getTime ();
------ For reference only -------- -------------------------------


is this damn thing ~ ~ ~ Y refresh it , I fail to get the value of the Request !
------ For reference only -------------------------------------- -



View
I want to use this method, the action request to return the page is displayed in the pop-up form, I want to ask how the onclick should write ah ? Please Gaoshoubangbangmang ah , urgent ! ! ! !

------ For reference only ---------------- -----------------------
him jump over , Firefox should be, Google will not work

没有评论:

发表评论