This week's giveaway is in the Spring forum.
We're giving away four copies of REST with Spring (video course) and have Eugen Paraschiv on-line!
See this thread for details.
The moose likes Struts and the fly likes Struts2 validation Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts2 validation" Watch "Struts2 validation" New topic

Struts2 validation

felipe rayo

Joined: Mar 08, 2011
Posts: 3
Hi everybodyl.
Firstly sorry about my English.
I've a problem with validation in Struts2 and Maven.
I don't know why Strus2 don't validate the field fom.
It was ok when I haven't Maven in the project.
I have an structure like this:


Part of struts.xml:
<action name="doLogin" class="com.atosorigin.nuba.actions.login">
<result name="input">loginNuba.jsp</result>
<result name="success">/vistas/saludo.jsp</result>
<result name="error">/vistas/error.jsp</result>
</action> has:
email.required= Email obligatorio y con formato correcto.
password.required=Falta la contrasenya

login-validation.xml has:
?xml version="1.0" encoding="UTF-8"?>

<!-- En Struts2 pondremos el nombre de la clase Java y NO EL NOMBRE DE LA ACCION -->

<!DOCTYPE validators PUBLIC
"-//OpenSymphony Group//XWork Validator 1.0.2//EN"


<field name="userEmail">
<field-validator type="email">
<message key="email.required"/>

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


Has anybody knows the solution to solve this problem?

Best regards.
I agree. Here's the link:
subject: Struts2 validation
It's not a secret anymore!