This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Struts and the fly likes Action Error whit Validation Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Action Error whit Validation " Watch "Action Error whit Validation " New topic

Action Error whit Validation

Lucas Ramos

Joined: Aug 04, 2012
Posts: 2
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:
<s:form action="update" namespace="/" method="post">
<input type="hidden" name="id" value="<s:property value="id"/>"/>
<s:submit value="Editar"></s:submit>

<action name="update" method="update" class= "Action.DatosAction">
<result name="success">/contactos.jsp</result>
<result name="input">/contactos.jsp</result>

public String update() {
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();
catch(Exception e){}
return result;

<field name="nombre">
<field-validator type="requiredstring">
<param name="trim">true</param>
<message key="errors.required" />

Lucas Ramos

Joined: Aug 04, 2012
Posts: 2
well, i did work, i separate my Actions Add, Update Delete, thats fix my issue...

I agree. Here's the link:
subject: Action Error whit Validation
Similar Threads
problems validation.xml in struts 2
problems in validation part of struts 2
struts 2 - client side basic validation
required validator not working
struts 2 validator problem