开发者

pass parameter from javascript to another jsp

I want to pass parameter from a Javascript function to another JSP page. 开发者_如何学GoCurrently I am doing like this:

function viewapplet(strPerfMonPoint) {
    var dateSelected = document.forms[0].hdnDateSelected.value;
    document.forms[0].hdnPerfMonPoint.value = strPerfMonPoint;
    var win;   
    win = window.open("jsp/PopUp.jsp?GraphPerfMon="+strPerfMonPoint+"&strDateSelected="+dateSelected, strPerfMonPoint,"width=800,height=625,top=40,left=60 resizable=No");     
}

I added hdnPerfMonPoint hidden variable and tried to acces in PopUp.jsp using request.getparameter(hdnPerfMonPoint) but it is giving null.

I want my window.open like:

window.open("jsp/PopUp.jsp", strPerfMonPoint,"width=800,height=625,top=40,left=60 resizable=No");   

Please suggest solution.


Are you quoting it properly? (and note the name change!)

String GraphPerfMon = request.getParameter("GraphPerfMon");

"The returned value of a parameter is a string. If the requested parameter does not exist, then a null value is returned."


You've actually passed it as GraphPerfMon as well. So request.getParameter("GraphPerfMon") should return the desired value. If you really insist in using the value of the hidden input element of the opener window instead for some reason, then you need Javascript.

var hdnPerfMonPoint = window.opener.document.forms[0].hdnPerfMonPoint.value;

To learn more about the wall between JSP and Javascript, you may find this article useful as well.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜