Skip to content Skip to sidebar Skip to footer

How To Pass Servlet Action In Redirect Function In Javascript

in my first jsp i am poping up a jsp window. in this pop up window i am selecting few request and passing it to another jsp through servlet. my problem is while i am passing the r

Solution 1:

Place this javascript in parent window. call this javascript function redirect in parent function with the parameter need to passed like redirect(selectedIds)

update the javascript function redirect to accept parameter

function redirect(selectedIds){
    opener.location.href="<%=contextPath%>/AddInterviewPannel?ids="+selectedIds;
    popupobj.close() // popupobj => have the reference to popup , initialize this with return value of window.open
}

Solution 2:

popup.html

<html> 
<head> 
</head> 
<body> 
<a href="#" onclick="window.opener.location.href='new.htm';">change parent</a> 
</body> 
</html>

parent.html

<html> 
<head> 
</head> 
<body> 
<a href="#" onclick="window.open('popup.html','kid','resizable=no,scrollbars=no,width=250,height=148,toolbar=no');">click</a> 
</body> 
</html>

Its working fine for me.. Compare your code and find out the reason.


Post a Comment for "How To Pass Servlet Action In Redirect Function In Javascript"