我不想要p:commandLink重定向

时间:2013-09-10 12:59:14

标签: ajax jsf-2 primefaces

有人可以解释一下为什么以下的commandLink会重定向吗?

<p:commandLink value="#{popupMsg['painel.informacoes.conta.alterar']}"
               actionListener="#{controladorPopupSelecaoConta.abrir}"
               oncomplete="exibirPopup(xhr,status,args,dlgselecaoConta);"
               title="#{popupMsg['painel.informacoes.conta.alterar.descricao']}"
               update=":selecaoConta :alerta" process="@none"/>

如果我将相同的元素(没有任何修改)放在另一个存在的h:表单中,它就像预期的那样工作(打开一个对话框)。

1 个答案:

答案 0 :(得分:0)

当我在这里创建SSCCE项目时,我注意到xmlns:p =“http://primefaces.org/ui”未在我使用p:commandLink的文件中声明。所以我来自这个:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
  xmlns:ui="http://java.sun.com/jsf/facelets"
  xmlns:h="http://java.sun.com/jsf/html"
  xmlns:f="http://java.sun.com/jsf/core"
  xmlns:hrgi="http://java.sun.com/jsf/composite/hrgi">

<ui:component>
     <h:form>
        <p:commandLink value="#{popupMsg['painel.informacoes.conta.alterar']}"
                   actionListener="#{controladorPopupSelecaoConta.abrir}"
                   oncomplete="exibirPopup(xhr,status,args,dlgselecaoConta);"
                   title="#{popupMsg['painel.informacoes.conta.alterar.descricao']}"
                   update=":selecaoConta :alerta" process="@none"/>
    </h:form>
</ui:component>
</html>

到此:

<ui:component xmlns="http://www.w3.org/1999/xhtml"
          xmlns:ui="http://java.sun.com/jsf/facelets"
          xmlns:h="http://java.sun.com/jsf/html"
          xmlns:p="http://primefaces.org/ui"
          xmlns:f="http://java.sun.com/jsf/core">
    <h:form>
        <p:commandLink value="#{popupMsg['painel.informacoes.conta.alterar']}"
                   actionListener="#{controladorPopupSelecaoConta.abrir}"
                   oncomplete="exibirPopup(xhr,status,args,dlgselecaoConta);"
                   title="#{popupMsg['painel.informacoes.conta.alterar.descricao']}"
                   update=":selecaoConta :alerta" process="@none"/>
    </h:form>
</ui:component>