我注意到带有 ajax=false 的 commandButton 在 primefaces mobile 中不起作用。当用户按下按钮时,我想进行非 ajax 调用以导航到不同的 url。如果我删除 ajax=false,它会命中 bean 管理器类,但这不会导航到不同的页面。解决方法是什么?
ui:composition template="/mobile/templates/masterLayout.xhtml"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:p="http://primefaces.org/ui"
xmlns:cc="http://java.sun.com/jsf/composite/composite"
xmlns:pm="http://primefaces.org/mobile">
<ui:define name="center">
<pm:page title="Test">
<pm:view id="main">
<pm:header title="Test" swatch="b" />
<pm:content>
<p:messages />
<h:form id="mainForm" prependId="false">
<p:inputText id="title" value="#{bean.title}"
required="true" label="title" />
<p:inputText id="wbUserName"
value="#{bean.creator}" required="true"
label="User name" />
<p:commandButton id="dialogButton" value="Create" ajax="false"
actionListener="#{bean.create}">
</p:commandButton>
</h:form>
</pm:content>
</pm:view>
</pm:page>
</ui:composition>
更新:
我已经用 h:commandButton 替换了 p:commandButton 并且我可以点击托管 bean 函数,但它没有转发到它假设的 url。
豆类
public String create(){
return "pretty:newPage";
}
漂亮的配置.xml
<url-mapping id="newPage">
<pattern value="/test/"/>
<view-id value="/views/test.jsf"/>
</url-mapping>