You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by smoonoz <st...@yahoo.com> on 2008/05/20 16:40:22 UTC
Struts 2 xml validation doesn't work
Hi guys,
I been following some spring 2 tutorials and cannot make struts 2 to
validate forms using xml syntax. Annotations seem to work fine though. I'm
running my apps using:
Tomcat Version JVM Version JVM Vendor OS Name OS Version OS
Architecture
Apache Tomcat/6.0.16 1.6.0_03-b05 Sun Microsystems Inc. Linux
2.6.22-14-generic i386
Don't know if I'm missing some important configuration, but I think not
because downloaded code from tutorials don't work either. All other
functionality seem to work OK.
Tutorials are "Bootstrap" y "Struts 2 + Spring 2 + JPA + AJAX" from:
http://struts.apache.org/2.0.11.1/docs/tutorials.html
Cheers,
Stan
--
View this message in context: http://www.nabble.com/Struts-2-xml-validation-doesn%27t-work-tp17342109p17342109.html
Sent from the Struts - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Struts 2 xml validation doesn't work
Posted by smoonoz <st...@yahoo.com>.
Now working!
1) Created a new folder under resources matching the java package
structure of the action:
package: quickstart.action
folder: src/main/resources/quickstart/action
2) Moved PersonAction-save-validation.xml there.
it solved the problem.
Thanks a lot Dave!
--
View this message in context: http://www.nabble.com/Struts-2-xml-validation-doesn%27t-work-tp17342109p17345893.html
Sent from the Struts - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Struts 2 xml validation doesn't work
Posted by smoonoz <st...@yahoo.com>.
Hi Dave,
The code is from tutorial:
http://struts.apache.org/2.x/docs/struts-2-spring-2-jpa-ajax.html
pom.xml fragments:
<modelVersion>4.0.0</modelVersion>
<groupId>quickstart</groupId>
<artifactId>quickstart</artifactId>
<version>0.1-SNAPSHOT</version>
<packaging>war</packaging>
<name>quickstart</name>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-spring-plugin</artifactId>
<version>2.0.6</version>
</dependency>
struts.xml:
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd">
<struts>
<constant name="struts.objectFactory" value="spring" />
<constant name="struts.devMode" value="true" />
<package name="person" extends="struts-default">
<action name="list" method="execute" class="personAction">
<result>pages/list.jsp</result>
<result name="input">pages/list.jsp</result>
</action>
<action name="remove" class="personAction" method="remove">
<result>pages/list.jsp</result>
<result name="input">pages/list.jsp</result>
</action>
<action name="save" class="personAction" method="save">
<result>pages/list.jsp</result>
<result name="input">pages/list.jsp</result>
</action>
</package>
</struts>
The action:
PersonAction.java
and validator:
PersonAction-save-validation.xml
are in the same package "quickstart.action" under folder:
/src/main/java/quickstart/action
Validation is there to prevent creating empty rows in the database, but
doesn't work for some reason. I've also tried changing struts 2 version to
2.0.11.1 with no success.
--
View this message in context: http://www.nabble.com/Struts-2-xml-validation-doesn%27t-work-tp17342109p17343878.html
Sent from the Struts - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Struts 2 xml validation doesn't work
Posted by Dave Newton <ne...@yahoo.com>.
You'll need to provide more information, like where your validation
files are, their names, the configs of the actions that aren't
validating, etc.
I've never had any issues with XML validation, so I'd first check out
the basics. (I'm also not running on Tomcat 6, which I suppose could
cause a problem.)
Dave
--- smoonoz <st...@yahoo.com> wrote:
> I been following some spring 2 tutorials and cannot make struts 2
> to
> validate forms using xml syntax. Annotations seem to work fine
> though. I'm
> running my apps using:
>
> Tomcat Version JVM Version JVM Vendor OS Name OS Version OS
> Architecture
> Apache Tomcat/6.0.16 1.6.0_03-b05 Sun Microsystems Inc. Linux
> 2.6.22-14-generic i386
>
> Don't know if I'm missing some important configuration, but I think
> not because downloaded code from tutorials don't work either. All
> other functionality seem to work OK.
>
> Tutorials are "Bootstrap" y "Struts 2 + Spring 2 + JPA + AJAX"
> from:
>
> http://struts.apache.org/2.0.11.1/docs/tutorials.html
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org