JSF ui:insert with f:attribute更改p:commandButton的属性
我有一个JSF2.1.28和PrimeFaces4.0的项目。我的编辑器控制器模板有问题 我的页面是:JSF ui:insert with f:attribute更改p:commandButton的属性,jsf,jsf-2,primefaces,Jsf,Jsf 2,Primefaces,我有一个JSF2.1.28和PrimeFaces4.0的项目。我的编辑器控制器模板有问题 我的页面是: <ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:p="http://primefaces.org/ui" xmlns:f="http://java.sun.com/jsf/core" xmlns:ui="http://java.sun
<ui:composition
xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:p="http://primefaces.org/ui"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets">
<p:panel header="#{locCommon.report} #{locCommon.editor}">
<h:form id="editForm">
<h:panelGrid columns="2">
<p:outputLabel value="#{locCommon.name}" />
<p:inputText value="#{reportBean.businessItem.name}" />
<p:outputLabel value="HQL" />
<p:selectBooleanCheckbox value="#{reportBean.businessItem.hql}" />
<p:outputLabel value="SQL" />
<p:inputTextarea value="#{reportBean.businessItem.sql}" />
</h:panelGrid>
<p:commandButton value="#{locCommon.tryQuery}" action="#{reportBean.tryQuery()}" process="@form"
update=":resultPanel" styleClass="button" />
</h:form>
</p:panel>
<p:panel id="resultPanel" header="#{locCommon.result}">
<ui:decorate template="/components/reportTable.xhtml">
<ui:param name="lstValues" value="#{reportBean.businessItem.lstResult}" />
<ui:param name="model" value="#{reportBean.businessItem.lstReportFields}" />
</ui:decorate>
</p:panel>
<p:panel>
<h:form>
<ui:decorate template="/components/editorController.xhtml" >
<ui:param name="bean" value="#{reportBean}" />
<ui:define name="saveButtonAttributes">
<f:attribute name="process" value=":editForm"/>
</ui:define>
</ui:decorate>
</h:form>
</p:panel>
</ui:composition>
上面的代码没有将这个
过程
属性设置为目标“:editForm”。我的问题是,我该怎么做?你能发布locCommon
code吗我想知道过程值的验证是否有错误。试用
。(使用)保存取消按钮集应该使用JSF复合组件,而不是JSF模板。模板是为了共享通用的布局和样式而设计的,而组件允许您对一个或多个JSF自定义组件进行分组,并允许以更简单的方式传递参数。这是我的错误。解决方案如下:
<ui:composition
xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:p="http://primefaces.org/ui"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets">
<table style="width: 100%;">
<tr>
<td align="left">
<p:commandButton value="#{locCommon.save}" styleClass="button" action="#{bean.save(true)}" process="@form">
<ui:insert name="saveButtonAttributes"/>
</p:commandButton>
</td>
<td align="right">
<p:commandButton value="#{locCommon.cancel}" styleClass="button" action="#{bean.cancel()}" process="@this" />
</td>
</tr>
</table>
</ui:composition>