Thanks dusty for your answer, well the view where I edit the form is :
<s:form id="verEncuesta" action="guardarEncuesta" method="post" validate="true" onsubmit="return valida();">
...
<s:textfield key="form.name" required="true" maxlength="255" cssClass="text medium"/>
....
</s:form>and the javascript for this form (I make this because when I finish the update or save in the greybox window I want to back to the page where it was called in this case "crearEncuesta.html") :
function valida(){
parent.parent.GB_hide();
parent.parent.location.href='<c:url value="/crearEncuesta.html?id=${form.id}"/>';
}and the struts.xml :
<action name="guardarEncuesta" class="formAction" method="save">
<result name="input">/WEB-INF/pages/encuestas/formForm.jsp</result>
<result name="ver" type="redirect-action">listarEncuestas</result>
<result name="cancel" type="redirect-action">listarEncuestas</result>
<result name="delete" type="redirect-action">listarEncuestas</result>
<result name="success" type="redirect">
agregarPreguntasEncuesta.html?id=${id}&first=1
</result>
</action>and the action method that save or update the data:
public String save() {
if (cancel != null) {
return "cancel";
}
if (delete != null) {
return delete();
}
boolean isNew = (form.getId() == null);
String username = this.request.getRemoteUser();
form.setUsername(username);
form.setLast_change(new Date());
form = formManager.saveForm(form);
formManager.makeFlush();
String key = (isNew) ? "form.added" : "form.updated";
saveMessage(getText(key));
this.id = form.getId();
if (!isNew) {
return "input";
} else {
return "success";
}
}
well it seems that the problem is when I close the greybox window going to the view that called this greybox windows of editing, because when I edit the form and save this, I return to the view that called (refreshing the data with parent.parent.location.href='<c:url value="/crearEncuesta.html?id=${form.id}"/>';) but nothing, but if I do F5 or refresh it I can see the updated data ....:S .... I don't know what I m doing wrong ....if you can show me the path I will be really happy!! .... Thanks in advance!
Pancho
I think you need to describe what you do with the POST from the user form and what happens after. So show your action method that is saving the user data. Also show your struts configuration for the results of this action. Are you redirecting? Or is the POST transaction happening inside this modal dialog and then control returned back to the user page. If you refresh the User page does the new user data display or is the user update just never saved?
foward wrote:
Hello !
I want to ask you something, I have a problem with the tag action and the greybox concern to the refresh of the data, I mean, I have a view where I show the user information and I have a button when I press appear a greybox windows to edit this user. Later when I update the user I go to the view where I show the user and still have the old user data ...I don't know if there are other posibility to make this and show later the updates data.
I use this action tag to show the information in the view:
<s:action name="crearEncuesta!getFormInView" id="action" namespace="default" executeResult="false"/>
...
<p><strong>Nombre de la Encuesta : </strong> ${form.name}</p>
<p><strong>Introducción de la Encuesta : </strong> ${form.introduction}</p>
<p><strong>Fecha de Cierre:</strong> ${form.close_date}</p>
...
Here I call the greybox window:
< a href="<c:url value="/editarEncuesta.html?id=${form.id}"/>" style="float:right;" title="Editar Encuesta" rel="gb_page_center[600, 500]">Edit Form< / a>
And in the action :
public String getFormInView() {
//formManager.makeFlush();
form = formManager.getForm(id);
return "success";
}
I believed that was problem of hibernate and put some Flush methods to flush the query but I didnt have any joy...Please if someone can help me I will be very grateful....
Thanks in advance
Best Regards
Pancho