1 回答

TA貢獻(xiàn)1810條經(jīng)驗(yàn) 獲得超4個(gè)贊
我所要做的就是execute在標(biāo)簽中添加參數(shù)(按照本教程)?,F(xiàn)在調(diào)用 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
添加回答
舉報(bào)