• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Action Error whit Validation

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
well, i did work, i separate my Actions Add, Update Delete, thats fix my issue...

Thanks
reply
    Bookmark Topic Watch Topic
  • New Topic