0

初めてのプライムフェイス モバイル サイトを作成していますが、ビューで奇妙な動作が発生します

<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>

2 番目のビュー (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>

私はいくつかの解決策を試しましたが、常に成功しませんでした:

  • バッキング Bean メソッドで「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 を使用しています)

4

2 に答える 2