【问题标题】:JSF Primefaces Mobile navigationJSF Primefaces 移动导航
【发布时间】:2016-10-05 14:10:42
【问题描述】:

该场景是使用 JSF 和 Primeface Mobile 开发的移动页面。 我想在多个页面之间的同一个 xhtml 页面中导航。当我单击主页中的按钮时,必须从第二页中的托管 bean 加载内容。我按照此示例 http://www.primefaces.org/showcase/mobile/navigation.xhtml 进行操作,但无法导航,我收到以下消息“viewId mobile.xhtml、操作 #{myManagedBean.gotoSecond} 和结果 pm:second 没有导航案例匹配”。 这里是xhtml代码

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
     xmlns:p="http://primefaces.org/ui"
     xmlns:pm="http://primefaces.org/mobile">

    <f:view renderKitId="PRIMEFACES_MOBILE" />

    <h:head>
    </h:head>

    <h:body>

      <pm:page id="first">
        <pm:header title="Page 1"></pm:header>

        <pm:content>
            <h:form>
                <p:commandButton value="Ajax Action" action="#{myManagedBean.gotoSecond}"/> 

            </h:form>
        </pm:content>
      </pm:page>

      <pm:page id="second">
        <pm:header title="Page 2"></pm:header>

        <pm:content>
            <p>Page 2 content.</p>
            <p:button outcome="pm:first" value="Go Back" />

            <h:form>
              #{myManagedBean.hello}
            </h:form>

        </pm:content>
      </pm:page> 

    </h:body>

  </html>

还有托管bean方法

public String gotoSecond(){
   return "pm:second";
}

【问题讨论】:

    标签: primefaces jsf-2


    【解决方案1】:

    你需要在你的面孔配置文件中使用这个:

    <application>
        <navigation-handler>
            org.primefaces.mobile.application.MobileNavigationHandler
        </navigation-handler>
    </application>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2013-01-22
      • 2011-08-14
      • 2011-01-26
      • 1970-01-01
      • 2015-01-02
      • 1970-01-01
      • 2014-09-29
      相关资源
      最近更新 更多