This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach 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 Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Action Error whit Validation " Watch "Action Error whit Validation " New topic
Author

Action Error whit Validation

Lucas Ramos
Greenhorn

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:
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...
Lucas Ramos
Greenhorn

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

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