0

I am working with Spring and JSF, and I have a bean where I call a method which changes its value from false to true or vice versa. I collect the value of the 'edit' property, and depending on if it is True or False, do one thing or another.

The problem is that although in the bean its value is already 'true', the method in JavaScript continues to catch it as 'false'.

I'm new to JavaScript and I don't know if I'm missing a fundamental concept.

This is the code.

            var editarNuevo = #{configuracionBean.edicion};
            
            if(!editarNuevo){
                alert(editarNuevo);
                dialog.classList.add('large');
                document.getElementById("titleSpan").textContent="#{etiquetas['configuracionP.editar']}";
            }else{
                alert(editarNuevo);
                dialog.classList.remove('large');

            }
Jasper de Vries
  • 19,370
  • 6
  • 64
  • 102
  • 2
    `editarNuevo` only reflects the bean value at page load. If you want to keep it in sync with the back-end without reloading, you'll need to use something like AJAX or websockets to request the current value. – shmosel May 08 '23 at 19:44
  • As you tagged the question with PrimeFaces, you could have a look at https://stackoverflow.com/questions/7221495/pass-parameter-to-premotecommand-from-javascript – Jasper de Vries May 09 '23 at 11:26

0 Answers0