Hi, i try to validate form fields in Struts2 with xml, when the validation is active, and try to do update, never use the update.action, and not give me the data from db; without the validation its OK... nobody knows whats happend??
thats my code:
JSP
<s:form action="update" namespace="/" method="post">
<input type="hidden" name="id" value="<s:property value="id"/>"/>
<s:submit value="Editar"></s:submit>
</s:form>
Struts.xml
<action name="update" method="update" class= "Action.DatosAction">
<result name="success">/contactos.jsp</result>
<result name="input">/contactos.jsp</result>
</action>
Action
public
String update() {
System.out.print("Editando...");
String result = SUCCESS;
//recupero los datos del contacto a editar
contacto = ContactoUtils.edit(id);
id = contacto.getId();
nombre = contacto.getNombre();
apellido = contacto.getApellido();
telefono = contacto.getTelefono();
mail = contacto.getMail();
nac = contacto.getNac();
try{
list();
}
catch(Exception e){}
return result;
}
action-validation.xml
<validators>
<field name="nombre">
<field-validator type="requiredstring">
<param name="trim">true</param>
<message key="errors.required" />
</field-validator>
</field>
</validators>
Thanks...