[英]javax.faces.view.facelets.TagAttributeException
I'm creating a small application using JSF,facing the exception, below is the code for the form. 我正在使用JSF创建一个小型应用程序,面对异常,下面是表单的代码。
<h:form>
<h:selectManyCheckbox value="#{transferMB.selectedItems}">
<f:selectItem itemValue="1" itemLabel="Transfer Status" />
<p:ajax update=":transForm" />
</h:selectManyCheckbox>
</h:form>
exception " javax.faces.view.facelets.TagAttributeException:" 异常“ javax.faces.view.facelets.TagAttributeException:”
You should be calling Boolean-like
values into your rendered attributes. 您应该在呈现的属性中调用Boolean-like
值的值。
Example: 例:
<p:panelGroup id="group" rendered="{#bean.isOneSelected}">
...
</p:panelGroup>
<p:panelGroup id="group" rendered="{#bean.isTwoSelected}">
...
</p:panelGroup>
And for getting values from selectManyMenu. 并从selectManyMenu获取值。 Please check here . 请在这里检查。
Also the rendered tag is a Boolean
like condition to tell whether a tag should be displayed. 而且,呈现的标签是类似于Boolean
条件,用于告知是否应显示标签。 You shouldn't need to pass a parameter into that. 您不需要向其中传递参数。 You should be getting that information from you transferMB
您应该从transferMB
获得该信息
This is a follow-up for issue while loading data 这是加载数据时的后续问题
As mentioned there, you need to use EL 2.2 for passing parameter inside EL-Expressions. 如此处所述,您需要使用EL 2.2在EL-Expressions内部传递参数。 Seems you don't use that. 似乎您没有使用它。
So we need another way to get this solved: 因此,我们需要另一种方法来解决此问题:
<h:form id="transForm">
<p:panelGrid columns="1" rendered="#{transferMB.transFormEnabled}">
<h:outputText value="transForm"/>
</p:panelGrid>
</h:form>
<h:form id="spreadForm">
<p:panelGrid columns="1" rendered="#{transferMB.spreadFormEnabled}">
<h:outputText value="spreadForm"/>
</p:panelGrid>
</h:form>
and in your corresponding bean: 并在您对应的bean中:
public boolean isTransFormEnabled() {
if (selectedItems.contains("1")) {
return true;
} else {
return false;
}
}
public boolean isSpreadFormEnabled() {
if (selectedItems.contains("2")) {
return true;
} else {
return false;
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.