File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes HTML, CSS and JavaScript and the fly likes How to rendar data from new window to  old window through window.focus() ? Or any other way. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "How to rendar data from new window to  old window through window.focus() ? Or any other way." Watch "How to rendar data from new window to  old window through window.focus() ? Or any other way." New topic
Author

How to rendar data from new window to old window through window.focus() ? Or any other way.

Abhra Kar
Ranch Hand

Joined: May 22, 2008
Posts: 124
Hi
I have a jsp named index.jsp---------
<html>
<head>
<script type="text/javascript">
function myfunc(){
var fname=document.getElementById("fname");
var lname=document.getElementById("lname");
window.open("credential.jsp?fname="+fname.value+"&lname="+lname.value,"mywindow","width=200,height=200");
}
</script>
</head>
<body>

<form name="form1">
First Name:
<input type="text" name="fname" id="fname" />
Last Name:
<input type="text" name="lname" id="lname" />
<input type="button" value="click here" onclick="myfunc()" />
</form>
</body>
</html>


Now flow goes to credential.jsp----------
<%@ page isELIgnored="false" %>
<html>
<head>
<script type="text/javascript">
function myfunc1(){
var origWin = window.opener ;
if (origWin != null) {
origWin.document.body.style.backgroundColor = "#a1b2c3" ;
origWin.focus() ;
}
}
</script>
</head>
<body>
<form>
<input type="text" name="credential" value="${param.fname}" />
<input type="hidden" name="lastname" value="${param.lname}" />
<input type="password" name="password"/>
<input type="submit" value="click it" onclick="myfunc1()" />
</form>
</body>
</html>


From credential.jsp flow is coming back to index.jsp,but I want the data I have filled in input field I will append in index.jsp in a text area .
Please suggest me the way(with window.focus() or without window .focus())
Thanks in advance.
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
window.opener is the way to do it. If you debug window.opener is it null? Are you getting errors?

Eric
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to rendar data from new window to old window through window.focus() ? Or any other way.