1
I am trying to implement the following function, when the user clicks the edit button, it would send to the page "create" only populated. but when I try to do so, he sends but with nothing.
in my xhtml is like this
<p:commandButton value="Deletar" icon="fa fa-fw fa-remove"
type="submmit" action="#{proprietarioBean.editar(proprietario)}"
update="form" styleClass="ui-icon ui-icon-pencil" >
<f:setPropertyActionListener target="#{proprietarioBean.proprietario}" value="#{proprietario}"/>
</p:commandButton>
In the method editar
I’m just giving a setProprietario
and a redirect.
public String editar(Proprietario proprietario) {
setProprietario(proprietario);
setTelefones(telefoneService.buscar(getProprietario()));
return "inserirProprietario.xhtml";
}
Up to the line of setProprietario
the object proprietario
is not null
, soon it should appear on the other side of the screen.
Put the method code
editar
, please– igventurelli
If the Ean proprietary bean does not have a larger scope than Viewscoped this approach will not work. Please inform the scope of the propretarioBean
– Bonifacio
this viewScoped, which recommends?
– Danilo
@Igorventurelli ok
– Danilo
@Danilo recommends that you maintain the Viewscoped scope but change the way you pass objects. Instead of passing the whole object. send an identifier as parameter in the URL, and then in the other screen recover from the database the object from the reference. However if you don’t want to change the approach now, just change the scope to Sessionscoped and its implementation should work ;)
– Bonifacio
@Bonifacio thanks for the answer, I will do passing only the ID to recover the object on the other side.
– Danilo