Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/jsf/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jsf p:commandLink不起作用,但p:commandButton起作用_Jsf_Primefaces_Primefaces Mobile - Fatal编程技术网

Jsf p:commandLink不起作用,但p:commandButton起作用

Jsf p:commandLink不起作用,但p:commandButton起作用,jsf,primefaces,primefaces-mobile,Jsf,Primefaces,Primefaces Mobile,我试图在primefaces mobile的p:dataList中使用p:commandLink 在这个代码段中,commandButton进入方法内部并重定向到另一个视图,但commandLink没有。为什么会这样 <pm:content id="resultsContent"> <h:form id="resultsForm"> <p:dataList type="inset" id="studyList" value="#{naviga

我试图在primefaces mobile的p:dataList中使用p: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";
    }
}

#{study.styRefNum}-{study.shortDesc}
@ManagedBean
@视域
公共类导航bean{
公共字符串individualStudy(){
System.out.println(“个人研究中”);
返回“pm:studyView?转换=幻灯片”;
}
}

首先,我想你在写问题时可能是打字错误,但是你在
p:commandLink
中的
操作
遗漏了前面的

现在我可以想到两件事来尝试:

process=“@this”
添加到您的
commandLink

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

或使用
远程命令

<p:commandLink onclick="studyFunc()" />
<p:remoteCommand name="studyFunc" update=":studyView" actionListener="#{navigationBean.individualStudy}" />


将commandLink放在一个
中,我试过了。不起作用。生成的HTML是什么样子的?下面是生成的HTML@Catfish看起来像个bug!你能试试使用
吗?我已经更新了我的答案。
<p:commandLink onclick="studyFunc()" />
<p:remoteCommand name="studyFunc" update=":studyView" actionListener="#{navigationBean.individualStudy}" />