简体   繁体   English

javax.faces.view.facelets.TagAttributeException

[英]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.

相关问题 javax.faces.view.facelets.TagAttributeException: - javax.faces.view.facelets.TagAttributeException: javax.faces.view.facelets.TagAttributeException:无效的路径 - javax.faces.view.facelets.TagAttributeException: Invalid path <ui:include>抛出javax.faces.view.facelets.TagAttributeException:路径无效 - <ui:include> throws javax.faces.view.facelets.TagAttributeException: Invalid path javax.faces.view.facelets.FaceletException:注释中不允许字符串“-” - javax.faces.view.facelets.FaceletException: The string “--” is not permitted within comments javax.faces.view.facelets.FaceletException:错误解析/template.xhtml:引用了实体“nbsp”,但未声明 - javax.faces.view.facelets.FaceletException: Error Parsing /template.xhtml: The entity “nbsp” was referenced, but not declared 更换<f:param>用 JSTL 标记<c:set>标记和 javax.faces.view.facelets.TagException - Replacing the <f:param> tag with the JSTL <c:set> tag & the javax.faces.view.facelets.TagException 错误:验证组合组件时出现java.io.NotSerializableException:javax.faces.view.facelets.ValidatorHandler - Error: java.io.NotSerializableException: javax.faces.view.facelets.ValidatorHandler when validating composite component 无法使用JSF 2.3启动Tomcat 8:java.lang.NoSuchMethodError:javax.faces.view.facelets.FaceletCache.setCacheFactories - Cannot start Tomcat 8 with JSF 2.3: java.lang.NoSuchMethodError: javax.faces.view.facelets.FaceletCache.setCacheFactories javax.faces.view.facelets.FaceletException: Error Parsing /: Error Traced[line: 1] 内容不允许在 prolog - javax.faces.view.facelets.FaceletException: Error Parsing /: Error Traced[line: 1] Content is not allowed in prolog 视图处理程序引用未实现接口javax.faces.application.ViewHandler的“ com.sun.facelets.FaceletViewHandler” - view-handler references to “com.sun.facelets.FaceletViewHandler” that does not implement interface javax.faces.application.ViewHandler
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM