在我的一个JSF应用程序中,我顶部的标题部分包含selectOneMenu,底部的内容部分显示为"过滤器组件".默认情况下,应用程序首先在顶部显示selectOneMenu数据,在底部显示相应的Filter信息.如果用户选择不同的selectOneMenu数据,则应在底部内容部分上加载相应的过滤器信息.
Filter组件具有CommandButton,用户填充Filter信息.单击该按钮,并且过滤器被批准,应用程序应加载另一个组件 - Report.xhtml代替Filter组件.那就是Filter组件应该由底部内容部分的Report替换.
单击selectOneMenu项应该重复该过程.那就是显示过滤器屏幕等.
问题区域1.无法显示过滤器表单并隐藏内容部分2上的报表.过滤器的后台bean - commandButton确定应该返回值.根据结果,应显示报告以代替过滤器.
我不确定设计是否准确,如果这不能按预期工作,请提出建议,我们将非常感谢您的宝贵答案.我想保持应用程序基于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>
Run Code Online (Sandbox Code Playgroud)