Win a copy of Rust Web Development this week in the Other Languages forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

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

 
Ranch Hand
Posts: 183
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
window.opener is the way to do it. If you debug window.opener is it null? Are you getting errors?

Eric
 
reply
    Bookmark Topic Watch Topic
  • New Topic