Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/324.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
Java 为什么Primefaces commandButton不重定向到页面?_Java_Jsf_Primefaces_Managed Bean_Trinidad - Fatal编程技术网

Java 为什么Primefaces commandButton不重定向到页面?

Java 为什么Primefaces commandButton不重定向到页面?,java,jsf,primefaces,managed-bean,trinidad,Java,Jsf,Primefaces,Managed Bean,Trinidad,我将primefaces版本6.2与jsf和trinidaad结合使用。 在这个项目中,我有一个表,每一行都包含一个按钮,用于根据所选行将此页面重定向到另一个页面。 jsf和trindad commandLink和commandButton完成了任务,但primefaces commandLink和commandButton没有 我已经做了: 将按钮的类型更改为type=button 添加立即数=真 我使用actionListener={coolingBean.viewrow}而不是action

我将primefaces版本6.2与jsf和trinidaad结合使用。 在这个项目中,我有一个表,每一行都包含一个按钮,用于根据所选行将此页面重定向到另一个页面。 jsf和trindad commandLink和commandButton完成了任务,但primefaces commandLink和commandButton没有

我已经做了:

将按钮的类型更改为type=button 添加立即数=真 我使用actionListener={coolingBean.viewrow}而不是action={coolingBean.view}。 有人知道我为什么要改变什么吗

实际上帮助了我

基本上,添加以下内容之一对我起到了作用:

将ajax=false添加到commandButton中 将?faces redirect=true添加到url,例如返回视图?faces redirect=true';
所以如果你在页面或项目中不使用特立尼达岛,它会起作用吗?或者如果您在没有p:datatable和{coolingBean.view被调用?只是重定向不起作用?为什么type='button'?不,它根本不起作用。如果我只使用trinidad,它就起作用,如果我使用primeface,它就不起作用。我想从我的页面中删除trinidad,只使用primefaces按钮和命令链接,但primefaces按钮和命令链接不起作用。我只是使用type='button'来看看它是否产生了差异e、 `type=按钮错误,请参阅PF文档或stackoverflow。最好创建一个失败的real With trinidad。然后删除trinidad标记,因为标记用于问题所在的位置,而不是您使用的位置,当然也不用于工作的位置。我已将trinidad从我的页面中完全删除,但primeface仍然不工作。让我澄清一下。O最初,这个项目是在特立尼达岛上建立的。由于特立尼达岛的死亡,我决定改为primeface。这就是为什么我必须在项目中坚持特立尼达岛,并稍微摆脱它的原因。这一部分已经很清楚了。我只是在帮你缩小问题的范围。h:commandButton有效吗?我还有更多的问题要问m我的评论。请这样做,并相应地将代码更改为a,这样做并不能真正解决原始问题-相反,它可以避免问题。在这种情况下,您的解决方案可以工作-但是当您实际需要ajax时会发生什么?正如@Kukeltje所建议的,您的原始问题需要用更多的代码来补充,因为许多hings会导致commandButton不启动。
<p:column id="viewButtonColumn" exportable="false" style="text-align: center" >
            <tr:commandLink textAndAccessKey="&amp;view " id="viewButton" action="#{coolingBean.view}" styleClass="commandLinkMediumSmallFont" onclick="PF('bui').show()">
                <tr:image source="/imgs/view.png" styleClass="commandLinkImageWithText"/>
                <f:setPropertyActionListener value="#{row.number}" target="#{coolingBean.criteria.number}"/>
                <f:setPropertyActionListener value="#{row.id}" target="#{searchBean.selectedId}"/>
            </tr:commandLink>
</p:column>

<p:column id="viewButtonColumn1" exportable="false" style="text-align: center" >
            <h:commandLink  textAndAccessKey="&amp;view " id="viewButton1" action="#{coolingBean.view}" styleClass="ui-priority-primary" onclick="PF('bui').show()">
                <i class="fa fa-search" ></i>
                <f:setPropertyActionListener value="#{row.number}" target="#{coolingBean.criteria.number}"/>
                <f:setPropertyActionListener value="#{row.id}" target="#{searchBean.selectedId}"/>
            </h:commandLink>
</p:column>

<p:column id="viewButtonColumn2" exportable="false" style="text-align: center" >
            <p:commandLink value="View" id="commandLinkView" action="#{coolingBean.view}" styleClass="ui-priority-primary" onclick="PF('bui').show()">
                <i class="fa fa-search" ></i>
                <f:setPropertyActionListener value="#{row.number}" target="#{coolingBean.criteria.number}"/>
                <f:setPropertyActionListener value="#{row.id}" target="#{searchBean.selectedId}"/>
            </p:commandLink>
</p:column>

<p:column id="viewButtonColumn3" exportable="false" style="text-align: center" >
            <p:commandButton id="viewButton2" value="View" action="#{coolingBean.view}" icon="fa fa-search" immediate="true" type="button" onclick="PF('bui').show()">
               <f:setPropertyActionListener value="#{row.number}" target="#{coolingBean.criteria.number}"/>
               <f:setPropertyActionListener value="#{row.id}" target="#{searchBean.selectedId}"/>
            </p:commandButton>
</p:column>
public String view(Row selectedRow) {
    if(criteria == null)
      criteria = new criteriaBean();

    criteria.setNummer(selectedRow.getNummber());
    searchBean.selectedId = selectedRow.getId();


 //FacesContext.getCurrentInstance().getExternalContext().dispatch("view.jsp");
    return view();
  }

  public String view(){

    return"view';
  }