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 listener works fine, the text area is displayed with a variable value 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 retains its original meaning. Any idea what I'm doing wrong?
I already tried: typing the value of a variable on the keyboard, and yes, it is always the same. Testing with other components, such as h: inputTextArea or p: inputText and has the same behavior, the variable will not be updated. Yes, my variable has both getter and setter.
My controller code is as follows:
@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; } }
This Comentario is a JPA entity that works great on other sides. Additional information: PrimeFaces version 4.0, Mojarra 2.7, JSF 2.2
Thanks for the help!
source share