我正在尝试根据选择的CheckBox来验证inputText框,如下所示。< <h:inputText required="#{param[facesContext.externalContext.response.namespace'form:checkBoxId']}"> >。
正如您所看到的,问题是组件is是动态的,我应该能够在EL表达式中使用facesContext.externalContext.response.namespace。有没有解决的办法,谢谢大家的建议。
谢谢。
发布于 2011-01-13 01:54:26
只需将UIComponent绑定到页面范围的属性并访问其getValue()方法即可。
<h:selectBooleanCheckbox binding="#{checkbox}" />
<h:inputText required="#{not empty checkbox.value and checkbox.value}" />至于动态性,你也可以给它一个固定的id。
<h:form id="form">
<h:selectBooleanCheckbox id="checkbox" />
<h:inputText required="#{not empty param['form:checkbox'] and param['form:checkbox']}" />
</h:form>然而,只有当它变得冗长时,它才是丑陋的。
https://stackoverflow.com/questions/4672067
复制相似问题