I have this Dialog:
<p:dialog header="Ingrese Comentario"
widgetVar="dlg1" appendTo="@(body)"
modal="true" position="top"
hideEffect="fold" showEffect="fold"
closable="true" draggable="true"
>
<h:form id="d_ingresarComentario">
<h:panelGrid columns="2">
<p:inputTextarea value="#{tareaController.comentarioNuevo.comentario}"
rows="7" cols="60"
placeholder="Ingrese su comentario aquí"
counter="display1" maxlength="200"
counterTemplate="{0} Caracteres faltantes."
>
</p:inputTextarea>
<br/>
<h:outputText id="display1"/>
<f:facet name="footer">
<p:commandButton id ="c_enviar"
immediate="true"
actionListener="#{tareaController.crearComentario()}"
value="Enviar"
oncomplete="dlg1.hide()" global="false">
</p:commandButton>
</f:facet>
</h:panelGrid>
</h:form>
</p:dialog>
The button's listener works fine, the text area is showed with the value's variable when the dialog is called. But whenever I write in the text area the variable (comentarioNuevo.comentario), which is a string, is not updated in the controller. It always keep its initial value. Any idea about what I am doing wrong?
I already tried: printing the variable's value on keyup, and yes it's always the same. Testing with other components, like h:inputTextArea or p:inputText and it have the same behavior, the variable wont get updated. Yes, my variable have both getter and setter.
My controller's code looks like this:
@ManagedBean
@ViewScoped
public class TareaController implements Serializable {
private Comentario comentario = new Comentario();
public void crearComentario() {
comentarioDAO.crearComentario(login.getUsuario(), expediente, comentarioNuevo);
nuevoComentario();
}
public Comentario getComentarioNuevo() {
return comentarioNuevo;
}
public void setComentarioNuevo(Comentario comentarioNuevo) {
this.comentarioNuevo = comentarioNuevo;
}
}
That Comentario is a JPA Entity, which works fine in other sides of the Aditional Information: PrimeFaces version 4.0, Mojarra 2.7, JSF 2.2
Thanks for the help!