Jsf p:commandLink不起作用,但p:commandButton起作用
我试图在primefaces mobile的p:dataList中使用p:commandLink 在这个代码段中,commandButton进入方法内部并重定向到另一个视图,但commandLink没有。为什么会这样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
<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}" />