1 回答

TA贡献1810条经验 获得超4个赞
我所要做的就是execute在标签中添加参数(按照本教程)。现在调用 setter 并且支持 bean 采用我想要的值
.xhtml 代码
<h:form id = "jsfform">
<h:inputHidden id="childCells" value="#{cellBean.childCellsStr}" />
<h:inputHidden id="parentCells" value="#{cellBean.parentCellsStr}" />
<h:commandButton id="button" style="display: none" action="#{cellBean.children()}">
<f:actionListener binding="#{cellBean.checkBtnDisable()}" /> <!--first call the children function, then call the checkBtnDisable -->
<f:ajax execute="childCells parentCells" render=":ajaxform"/>
</h:commandButton>
</h:form>
Javascript代码
document.getElementById('jsfform:childCells').value = json1;
document.getElementById('jsfform:parentCells').value = json2;
//trigger the button of the form with javascript
document.getElementById('jsfform:button').onclick();
爪哇豆
private String childCellsStr;
private String parentCellsStr;
//getters && setters
添加回答
举报