【发布时间】:2011-06-12 13:23:27
【问题描述】:
在我的一个 JSF 应用程序中,顶部的标题部分包含 selectOneMenu,底部的内容部分显示过滤器组件。默认情况下,应用程序首先在顶部显示 selectOneMenu 数据,在底部显示相应的过滤器信息。如果用户选择不同的 selectOneMenu 数据,则应在底部内容部分加载相应的过滤器信息。
Filter组件有CommandButton,用户填写Filter信息。单击按钮后,过滤器被批准,应用程序应加载另一个组件 - Report.xhtml 代替过滤器组件。即过滤器组件应替换为底部内容部分的报告。
单击 selectOneMenu 项应重复该过程。即显示过滤画面等。
问题区域 1.内容部分无法显示过滤表单和隐藏报表表单 2. Filter的Backing bean - commandButton OK应该返回值。根据结果,应显示报告以代替过滤器。
我不确定设计是否准确,如果这不能按预期工作,请提出建议,我们将不胜感激。我想保持基于 ajax 的应用程序,并且我不想在按钮事件上重新加载整个页面。
GDK
<h:form id="form1">
<h:selectOneMenu value="#{states.stateName}">
<f:selectItems value="#{states.stateChoices}"/>
<f:ajax render=":Filter"/>
</h:selectOneMenu>
</h:form>
<h:form id="Filter">
<div id="content">
<h:panelGroup id="one" rendered="Need a condition from form1 to display this">
#{states.stateName}
<br/>Report
<h:inputText id="report" value="#{Counties.report}" style="width:150px"/>
<h:commandButton id="OK" value="OK" actionListener="#{Counties.getReports}">
<f:param name="CatName" value="Dekalb" />
</h:commandButton>
</h:panelGroup>
</div>
</h:form>
<h:form id="Report">
<div id="content">
<h:panelGroup id="two" rendered="#{should be rendered on acceptance from OK command button}">
<ui:include src="Report.xhtml"/>
</h:panelGroup>
</div>
</h:form>
【问题讨论】:
标签: java javascript html jsf