下面的代码是tabView,后面是加载页面的结构。对于 commandButton,我尝试了 actionListener、渲染和更新的不同组合,显式引用目标 inputtextarea (req) 等。当表单在其自己的页面中运行时(而不是在选项卡中),该操作可以正常工作。
在“preRenderView”事件中,我初始化数据结构,这些数据结构在表单显示时填充。问题是当我单击预览按钮时。通常动作触发,处理方法组装数据以在预览输入外部区域(req)中显示,并显示。
奇怪的是,当我单击按钮时,不会调用该操作,尽管有活动调用我的其他选项卡的 loadReqEvents,并且在托管 tabView 的外部页面中。我怀疑这是我不知道的 JSF 的请求-响应细微差别。感谢帮助。
<p:tabView id="tbv" dynamic= "true" activeIndex="#{sessionController.activeTab}" styleClass="tabview-style">
<p:tab id="rtmTab" styleClass="tab-style" title="RTM" closable="false" titletip="Requirements Traceability Matrix">
<ui:include src="url(./../rtm.xhtml"/>
</p:tab>
<p:tab id="composeTab" styleClass="tab-style" title="#{sessionController.composeTabTitle}" rendered="#{sessionController.crudTabRendered}" closable="false" titletip="Composition Form">
<ui:include src="url(./..#{sessionController.composeUrl}.xhtml"/>
</p:tab>
<p:tab id="objTab" styleClass="tab-style" title="Object / Data Model" closable="false" titletip="Object and Data Model View">
<ui:include src="url(./../objView.xhtml"/>
</p:tab>
</p:tabView>
</p:layoutUnit>
<p:layoutUnit id="formLayout" position="center" gutter="0" styleClass="form-layout">
<h:form>
<f:event listener="#{attrDefController.loadReqEvent}" type="preRenderView"></f:event>
<p:panel style="background-color:rgb(222,231,254);width:925px;height:98%;margin-top:-4px;margin-left:-8px">
<h:panelGrid columns="7" style="margin-right:-8px" cellpadding="2">
<h:commandButton id="preview" value="Preview" action="#{attrDefController.previewReqAction}" style="width:100px; margin-top:2px">
<f:ajax execute="@form" render="req"/>
</h:commandButton>
</h:panelGrid>
</p:panel>
</h:form>
</p:layoutUnit>