In pop up window i am selecting some values and clicking on submit button where i am calling the submit method from bean. In bean i am setting the value of a variable. My problem is how i can pass this bean value in a javascript and display the same in my parent window.
pop up window code
<h:commandButton value="#{bundle['submit']}" action="#{searchBean.submit}"
onclick="postDataToParent()">
</h:commandButton>
<input type="text" id="searchvalue" value="#{searchBean.StatusDTO.searchResults}" />
javascript method in pop up window
<script language="javascript">
function postDataToParent(){
var x=document.getElementById("searchvalue").value;
window.opener.document.confirmation['confirmation:searchResults'].value = x;
window.opener.document.confirmation['confirmation:searchResults'].focus();
alert(x);
//window.opener.location.reload();
window.close();
}
</script>
parent window code. I have to display the pop up window value in this text area
<td width="70%">
<a4j:region id="namesearch">
<h:inputTextarea id="searchResults" value="#Bean.StatusDTO.searchResults}"
rows="10" cols="50" required="true">
<a4j:support event="onchange" reRender="searchResultsMessage"
id="searchResultsSupport" />
</h:inputTextarea>
<h:commandLink onclick="javascript:window.open('NameSearchPopUp.jsf','', 'width=600,height=500,scrollbars=yes,left=250,top=1,resizable=1');return false;" immediate="true" value="Name Search" />
</a4j:region>
</td>