2

Primefaces モバイルの ap:dataList で ap:commandLink を機能させようとしています。

このスニペットでは、commandButton がメソッド内に入り、別のビューにリダイレクトされますが、commandLink はそうではありません。どうしてこれなの?

<pm:content id="resultsContent">
    <h:form id="resultsForm">
        <p:dataList type="inset" id="studyList" value="#{navigationBean.studies}" var="study">
            <p:commandLink action="{navigationBean.individualStudy}" update=":studyView">#{study.styRefNum} - #{study.shortDesc}</p:commandLink>
            <p:commandButton value="#{study.styRefNum} - #{study.shortDesc}" action="#{navigationBean.individualStudy}" update=":studyView" />
        </p:dataList>
    </h:form>
</pm:content>


@ManagedBean
@ViewScoped
public class NavigationBean {
    public String individualStudy() {
        System.out.println("in individualStudy");
        return "pm:studyView?transition=slide";
    }
}
4

1 に答える 1

1

まず、質問を書いているときのタイプミスだと思いますがactionp:commandLink前の#.

これで、次の 2 つのことを試すことができます。

process="@this"あなたに追加commandLink

<p:commandLink process="@this" action="#{navigationBean.individualStudy}" update=":studyView">

またはactionListener代わりに使用してみてください:

<p:commandLink actionListener="#{navigationBean.individualStudy}" update=":studyView">

[アップデート]

または使用remoteCommand

<p:commandLink onclick="studyFunc()" />
<p:remoteCommand name="studyFunc" update=":studyView" actionListener="#{navigationBean.individualStudy}" />
于 2014-04-09T08:53:02.370 に答える