1

我在 worklistManager.jsp 中有一个按钮,它调用一个函数(getWorklistManagerModify()).. 该函数位于 utility.js 文件中,该文件又执行一些操作并重定向到 worklist.jsp 页面及其响应.. 如何打开工作列表.jsp 页面在 worklistManager.jsp 的同一选项卡或同一窗口中。现在它作为单独的选项卡打开。

getWorklistManagerModify 函数:

function getWorklistManagerModify(){
    var whereCondn = "";
    //alert(gbshowgridFlag);
    if(dijit.byId('finderResponseGridCWPWORKLIST')){
        var selctedItem = dijit.byId('finderResponseGridCWPWORKLIST').selection.getSelected();
        if(selctedItem.length){
            dojo.forEach(selctedItem, function(selectedItem){
                if(selectedItem !== null){
                    dojo.forEach(dijit.byId('finderResponseGridCWPWORKLIST').store.getAttributes(selectedItem), function(attribute){
                        var value = dijit.byId('finderResponseGridCWPWORKLIST').store.getValues(selectedItem, attribute);
                        //alert(value);
                        if(attribute == "CWDOCID"){
                            whereCondn = whereCondn+attribute+"="+value;
                        }
                        //alert(whereCondn);
                    });
                    var cols= "DUE_DATE,PRIORITY,CWDOCID";
                    var ioArgs = {
                            url: "./DynamicDBServlet",
                            content: { TABLE_NAME:'CWPWORKLIST',WHERE_CONDN:whereCondn,COLUMNS:cols,ACTION:'select'}, 
                            handleAs: "text",
                            load: function(response) {
                            postRequestPage("worklist.jsp",response,'title');

                            },
                            error: function(error) {
                                alert("An unexpected error occurred: " + error);
                            }
                    };
                    var deferred = dojo.xhrPost(ioArgs);

                }
            });
            //alert("grid row selected");
        }else{
            alert("Please select a task");
        }
    }
    if(gbshowgridFlag==false){
        alert("Please select a task");
    }
}

发送post请求的函数:

function postRequestPage(url, params, name){
    alert(params);
    var form = document.createElement("form");
    form.setAttribute("method", "post");
    form.setAttribute("action", url);
    form.setAttribute("target", name);
    var input = document.createElement('input');
    input.type = 'hidden';
    input.name = "PARAM";
    input.value = params;
    form.appendChild(input);
    document.body.appendChild(form);
    window.location.href = url;
    //window.open(url,"_self");
    form.submit();
    document.body.removeChild(form);
}

我尝试使用 window.location.href、window.open、location.href 和 window.location ......没有任何结果......

4

1 回答 1

2

remove this line;

form.setAttribute("target", name);
于 2013-01-28T10:59:09.057 回答