Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

171
Vistas
p:remoteCommand being invoked, but not the action method

I am having some trouble getting a p:remoteCommand to work, it is defined as follows:

<ui:composition xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
    template="/template.xhtml" xmlns:h="http://java.sun.com/jsf/html"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:p="http://primefaces.org/ui">
    <ui:define name="content">
        <h:form id="form" enctype="multipart/form-data" >
            <p:remoteCommand name="connectionTest" action="#{entry.checkConnection}" oncomplete="console.log('BAR');" style="display: none;"/> 
                            
            <p:inputText id="dummy" required="true" value="#{entry.X}" disabled="#{entry.disabled}" />           
            
            <script type="text/javascript"> 
                $(function() {
                    $(document).ready(async function () {
                        console.log('foo');
                        connectionTest();
                    });
                });
            </script>
        </h:form>
    </ui:define>
</ui:composition>

And a bean method in a ViewScoped bean named "entry":

public void checkConnection() {
    ...do stuff
}

The remote command is invoked, as foo and BAR are printed to the console, but the actual bean method checkConnection is not being invoked. I have tried all permutations of action vs actionListener and entry.checkConnection vs entry.checkConnection().

The remoteCommand and script tags are in the same h:form inside a ui:define inside a ui:composition. What am I missing?

Edit: after some trial and error, it seems related to having a required="true" p:inputText on the same form. I have updated my question accordingly. Moving the p:remoteCommand out of the form seems to make it work, but I still am unsure why a p:remoteCommand inside a form with a required p:inputText does not work.

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda