Jsf 2 primefaces移动视图导航
我正在制作我的第一个primefaces移动站点,我对视图有一种奇怪的行为Jsf 2 primefaces移动视图导航,jsf-2,primefaces,primefaces-mobile,Jsf 2,Primefaces,Primefaces Mobile,我正在制作我的第一个primefaces移动站点,我对视图有一种奇怪的行为 <pm:page> <pm:view id="viewName"> <ui:include src="home.xhtml" /> </pm:view> <pm:view id="otherView"> <ui:include src="viewWhereThereIsTheForm.xhtml" /
<pm:page>
<pm:view id="viewName">
<ui:include src="home.xhtml" />
</pm:view>
<pm:view id="otherView">
<ui:include src="viewWhereThereIsTheForm.xhtml" />
</pm:view>
</pm:page>
如果我在第二个视图(otherView)中使用commandButton(h:或p:),页面将重新加载,并且每次都会显示第一个视图(viewName),即使按钮所在的表单中有必需的元素
示例:
<h:form>
<h:inputText value="#{upload.something}" required="true" />
<h:commandButton value="Upload" action="#{upload.upload()}" />
//or
<p:commandButton value="Send" action="#{upload.trySomething()}" />
</h:form>
//或
我尝试过一些解决方案,但总是没有成功:
- 在backingbean方法中返回“pm:viewName”
- RequestContext.getCurrentInstance().execute(“PrimeFaces.navigate('#viewName',{reverse:'true'})”)李>
- FacesContext.getCurrentInstance().getExternalContext().redirect(“pageName.xhtml#viewName”)李>
<p:commandButton value="Send" action="#{upload.tryLatLon()}" oncomplete="PrimeFaces.navigate('#viewName', {reverse : 'true'})" />
但是它对h:commandButton不起作用
我怎么才能停下来
任何帮助都将不胜感激
(我使用的是PrimeFaces 3.5、PrimeFaces Mobile 0.9.4和JSF 2.2)您可能需要在
中添加标记
我尝试使用
在视图之间导航,如下代码所示:
<pm:page title="Mobile">
<pm:view id="mainView">
<pm:header title="Music Inventory" />
<pm:content>
<h:form id="mainForm">
<h:outputLink value="#artist?transition=slide">Artists</h:outputLink>
</h:form>
</pm:content>
</pm:view>
<pm:view id="artist">
<pm:header title="Artists">
<h:outputLink value="#mainView">Go to Home</h:outputLink>
</pm:header>
<pm:content>
<h:outputText value="Some detail of artists" />
</pm:content>
</pm:view>
</pm:page>
艺术家
回家
Primefaces移动站点中提供的一些示例与showcase中显示的不一样 您应该将primefaces更新为5.0以获得更好的结果。我也有同样的问题,我尝试了很多我无法解决的事情,将我的primefaces更新到最新版本解决了这个问题
这是pom.xml文件中的一段代码,您可以在其中将primefaces从3.5更新到5.0,只需更改版本标记中的编号
<dependency>
<groupId>org.primefaces</groupId>
<artifactId>primefaces</artifactId>
<version>5.0</version>
</dependency>
org.primefaces
素面
5