Java 面板内的命令按钮有问题
我有一个代码,当我从SelectOne菜单中选择一个选项时,会生成一个包含Inputtext和commandButton的面板。问题是commandButton在面板中不起作用 当我点击页面重新加载的按钮时(我有一个3个按钮,一个生成PDF报告,第二个导航到另一个页面,第三个用于重置),我添加了一个用于测试的know just按钮。 我的代码JSF ChooseKPI.xhtml:Java 面板内的命令按钮有问题,java,jsf,primefaces,Java,Jsf,Primefaces,我有一个代码,当我从SelectOne菜单中选择一个选项时,会生成一个包含Inputtext和commandButton的面板。问题是commandButton在面板中不起作用 当我点击页面重新加载的按钮时(我有一个3个按钮,一个生成PDF报告,第二个导航到另一个页面,第三个用于重置),我添加了一个用于测试的know just按钮。 我的代码JSF ChooseKPI.xhtml: <h:form> <br></br>
<h:form>
<br></br>
KPIs:<h:selectOneMenu style="width:200px" immediate="true" value="#{ToolsKPI.myChoice}" onchange="submit()" valueChangeListener="#{BeanTest.selectChangeHandler}" required="true" >
<f:selectItems value="#{ToolsKPI.getMyListKPI()}" />
</h:selectOneMenu>
<p:panel header="KPI" style="margin-bottom:10px;width:450px;height:350px;" rendered="#{BeanTest.showPanelBoolClosed}" >
<h1>KPI1</h1>
<br></br>
test <h:inputText autocomplete="on" value="#{BeanTest.test}" />
<h:commandButton immediate="true" action="#{BeanTools.testt}" value="Valid" />
</p:panel>
<p:panel rendered="#{BeanTest.showPanelBoolOpen}" >
<br></br>
<h1>KPI2</h1>
<h:inputText value="test2" />
<h:inputText value="test3" />
</h:form>
我应该再加一张表格吗?如果是,我如何在导航规则中提及第二种形式
谢谢也许您应该尝试使用条件导航:
start.xhtml
测验
#{BeanTools.testt}
finish.xhtml
我不确定是否可以将布尔类型与from output一起使用……我只使用过/见过字符串。也许您应该尝试使用条件导航:
start.xhtml
测验
#{BeanTools.testt}
finish.xhtml
我不确定您是否可以将布尔类型用于from output…我只使用过/见过字符串。@Wade感谢您的回复,我添加此方法只是为了测试按钮的功能,此方法工作正常。您的managedbean是哪个范围?@madhu,managedbean的范围是request@Wade谢谢你的回复,我添加这个方法只是为了测试按钮的功能,这个方法很好用。你的managedbean的作用域是什么?@madhu,managedbean的作用域是request@DD,谢谢您的回复,我将尝试条件导航,是的,您可以使用布尔类型,结果是我以前使用过的。@DD,感谢您的回复,我将尝试条件导航,是的,您可以使用布尔类型,结果是我以前使用过它们。
<navigation-rule>
<from-view-id>ChooseKPI.xhtml</from-view-id>
<navigation-case>
<from-action>#{BeanTools.testt}</from-action>
<from-outcome>true</from-outcome>
<to-view-id>Test1.xhtml</to-view-id>
</navigation-case>
<navigation-case>
<from-action>#{BeanTools.testt}</from-action>
<from-outcome>false</from-outcome>
<to-view-id>index.xhtml</to-view-id>
</navigation-case>
Managed Bean:
public boolean testt()
{
if(test.equals("a"))
return true;
else
return false;
}
<navigation-rule>
<from-view-id>start.xhtml</from-view-id>
<navigation-case>
<from-outcome>test</from-outcome>
<if>#{BeanTools.testt}</if>
<to-view-id>finish.xhtml</to-view-id>
</navigation-case>
</navigation-rule>