Hello People,

 

i´m using the struts 2 in a project and i´m with a problem on the
validation. When i try validate a form, the struts say the validation
failed, even when the field is with correct value, in addition, it is not
going back to the field with the old value

 

here is my struts.xml. The action is the Cliente_insert:

 

<package name="cliente" namespace="/" extends="struts-default">

<default-interceptor-ref name="defaultStack"/>

 

<action name="Cliente_input" >

<result >/cliente/inputCliente.jsp</result>

</action>

<action name="Cliente_edit" class="br.com.robson.modelo.ClienteAction"
method="editar">

<interceptor-ref name="paramsPrepareParamsStack" />

<result >/cliente/editCliente.jsp</result>

</action>

<action name="Cliente_list" class="br.com.robson.modelo.ClienteAction"
method="listar">

<result name="success">/cliente/listaClientes.jsp</result>

</action>

<action name="Cliente_insert" class="br.com.robson.modelo.ClienteAction"
method="inserir">

<interceptor-ref name="validationWorkflowStack"/>

 

<result name="input">/cliente/inputCliente.jsp</result>

<result name="success" type="redirect">Cliente_list.action</result>

</action>

<action name="Cliente_delete" class="br.com.robson.modelo.ClienteAction"
method="deletar">

<result name="success" type="redirect">Cliente_list.action</result>

</action>

<action name="Cliente_update" class="br.com.robson.modelo.ClienteAction"
method="atualizar">

<result name="success" type="redirect">Cliente_list.action</result>

</action>

 

</package>

 

Here is my validation archive:

 

<!DOCTYPE validators PUBLIC "-//OpenSymphony Group//XWork Validator
1.0.2//EN" "http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd";>

<validators>

<!-- <field name="nome">

<field-validator type="required">

true

<message> O campo nome é obrigatório </message>

</field-validator>

</field> -->

<field name="telefone">

<field-validator type="required">

true

<message> O campo telefone é obrigatório </message>

</field-validator>

<field-validator type="stringlength">

true

6

14

<message> O campo telefone deve ter entre 6 e 14 caracteres </message>

</field-validator>

</field>

</validators>

 

here is my jsp:

 

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"

pageEncoding="ISO-8859-1"%>

<%...@page import="br.com.robson.modelo.Cliente" %>

<%...@page import ="java.util.*" %>

<%@ taglib prefix="s" uri="/struts-tags" %>

 

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd";>

<html:html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">

<title>Insert title here</title>

<script language="javascript">

</script>

</head>

<body>

Novo Cliente

<s:debug/>

 

<s:form action="Cliente_insert.action" method="POST" >

 

<s:textfield name="idCli" label="Id" />

 

<s:textfield name="nome" label="Nome"/>

 

<s:textfield name="telefone" label="Ielefone"/>

 

<s:submit></s:submit>

</s:form>

 

 

 

 

</body>

</html:html>

 

I hope you can help me

 

Hugs!

 
-- 
View this message in context: 
http://www.nabble.com/Struts-2-Validation-tp24382602p24382602.html
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org

Reply via email to