在弹出窗口中,我选择一些值,然后单击提交按钮,我从bean调用submit方法。在bean中我设置变量的值。我的问题是我如何在javascript中传递这个bean值并在我的父窗口中显示相同的内容。
弹出窗口代码
<h:commandButton value="#{bundle['submit']}" action="#{searchBean.submit}"
onclick="postDataToParent()">
</h:commandButton>
<input type="text" id="searchvalue" value="#{searchBean.StatusDTO.searchResults}" />
弹出窗口中的javascript方法
<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>
父窗口代码。我必须在此文本区域中显示弹出窗口值
<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>