Inputtex with 2 Managedbean

Asked

Viewed 19 times

-1

Good morning, everyone

How can I pass the contents of an inputText to 2 Managedbeans? Example

<p:inputText id=“usuario” value="#{usuarioBeanCelular.usuarioCelular}" />
<p:inputText id=“usuario” value="#{usuarioBeanTelefone.usuarioTelefone}" />

1 answer

0

There is no such option, inputtext value only accepts an object, as stated in the documentation: https://www.primefaces.org/docs/guide/primefaces_user_guide_6_2.pdf. I believe you are making a mistake in the modeling of your manegedbean, because it would take two MB to input a phone number? Wouldn’t it be easier to control that on the same MB? If you want to continue with this option, an output would be you to take the instance of the second MB and pass the inputado value in the first MB. In the first MB you would have something like this:

Bean bean = (Bean) request.getSession().getAttribute("beanName");
bean.setMeuAtributo(meuAtributo);

Browser other questions tagged

You are not signed in. Login or sign up in order to post.