我有一个 Seam 应用程序,最初由 seam-gen 生成,带有一个视图 Search.xhtml。
Search.xhtml 有许多输入字段,其中一半绑定到 Office 实体,一半绑定到 Devices 实体。
例如,如果您输入一个主机名,它会绑定到设备中的一个字段,如果您输入一个城市,它会绑定到办公室中的一个字段。
默认情况下,目标页面将为 OfficeResult.xhtml,或者,如果已输入“设备”属性,则为 DeviceResult.xhtml。
我的问题有两部分:
我应该在 Search.xhtml 中为提交按钮使用什么组件?我假设 h:commandButton,但是我该用什么来执行该操作?如果我使用目标视图,是否会被 page.xml 文件中的导航规则覆盖?
如何设置我的 Search.page.xml 文件?如何根据参数调整导航?
这是 Search.xhtml(伪代码):
<h:inputText value="#{devicesList.devices.devSerialNum}" />
<h:inputText id="state" value="#{officeList.office.state}" />
<h:commandButton id="search" action="/OfficeResult.xhtml" value="Search" />
Search.page.xml(伪代码):
<navigation>
<rule if devSerNum is set >
<redirect view-id="/DeviceResult.xhtml"/>
</rule>
<rule if state is set >
<redirect view-id="/OfficeResult.xhtml"/>
</rule>
</navigation>