hellos,
i am using struts 2.1.2 with codebehind plugin ,i cant make client side
validation working with validation annotations in my project though i have
tried
them succesfully in small examples. i am confused if i am hitting any issue
in my configuration in project due to any other plugin.
I am attaching my pom.xml and a small action class and a jsp
thanks and regards
Vineet
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>aplomb.jobfinder</groupId>
<artifactId>jobfinder</artifactId>
<packaging>pom</packaging>
<version>1.0-SNAPSHOT</version>
<name>jobfinder</name>
<url>http://maven.apache.org</url>
<repositories>
<repository>
<id>ibibilo</id>
<name>Java hibernate Repository for Maven 2</name>
<url>http://www.ibiblio.org/maven</url>
<layout>default</layout>
</repository>
<repository>
<id>Maven Plugin Repository</id>
<url>http://struts2plugin-maven-repo.googlecode.com/svn/trunk/</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
<releases>
<enabled>true</enabled>
</releases>
</repository>
<repository>
<id>mvnrepository.com</id>
<name>Java hibernate Repository for Maven 2</name>
<url>http://mvnrepository.com/</url>
<layout>default</layout>
</repository>
<repository>
<id>java.net repo</id>
<name>jta download</name>
<url>http://download.java.net/maven/2</url>
<layout>default</layout>
</repository>
<repository>
<id>struts2.1.2-staging</id>
<name>Struts 2.1.2 staging repository</name>
<layout>default</layout>
<url>http://people.apache.org/builds/struts/2.1.2/m2-staging-repository/</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-report-plugin</artifactId>
<version>2.4.2</version>
</plugin>
</plugins>
</reporting>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.4.2</version>
<configuration>
<suiteXmlFiles>
<suiteXmlFile>src/test/resources/testng.xml</suiteXmlFile>
</suiteXmlFiles>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.12</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.4.2</version>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>5.8</version>
<scope>test</scope>
<classifier>jdk15</classifier>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.0.5</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate</artifactId>
<version>3.3.1.GA</version>
<exclusions>
<exclusion>
<groupId>asm</groupId>
<artifactId>asm</artifactId>
</exclusion>
<exclusion>
<groupId>asm</groupId>
<artifactId>asm-attrs</artifactId>
</exclusion>
<exclusion>
<groupId>cglib</groupId>
<artifactId>cglib</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>asm</groupId>
<artifactId>asm</artifactId>
<version>2.2.3</version>
</dependency>
<dependency>
<groupId>javassist</groupId>
<artifactId>javassist</artifactId>
<version>3.8.0.GA</version>
</dependency>
<dependency>
<groupId>cglib</groupId>
<artifactId>cglib-nodep</artifactId>
<version>2.1_3</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-annotations</artifactId>
<version>3.4.0.GA</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring</artifactId>
<version>2.5.5</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aspects</artifactId>
<version>2.5.5</version>
</dependency>
<dependency>
<groupId>opensymphony</groupId>
<artifactId>ognl</artifactId>
<version>2.6.11</version>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-dojo-plugin</artifactId>
<version>2.1.2</version>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-core</artifactId>
<version>2.1.2</version>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-codebehind-plugin</artifactId>
<version>2.1.2</version>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-spring-plugin</artifactId>
<version>2.1.2</version>
</dependency>
<dependency>
<groupId>com.googlecode</groupId>
<artifactId>jsonplugin</artifactId>
<version>0.30</version>
</dependency>
<dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
<version>1.1.1</version>
</dependency>
</dependencies>
<modules>
<module>core</module>
<module>web</module>
</modules>
</project>
package aplomb.jobfinder.web.jobsearch;
import org.apache.struts2.config.Result;
import org.apache.struts2.config.Results;
import com.opensymphony.xwork2.validator.annotations.RequiredFieldValidator;
import com.opensymphony.xwork2.validator.annotations.RequiredStringValidator;
import com.opensymphony.xwork2.validator.annotations.StringLengthFieldValidator;
import com.opensymphony.xwork2.validator.annotations.Validation;
import com.opensymphony.xwork2.validator.annotations.Validations;
import com.opensymphony.xwork2.validator.annotations.ValidatorType;
@Results(
{
@Result(name="SUCCESS", value="/common/jobsearch/Test.jsp" ),
@Result(name="input", value="/common/jobsearch/TestOne.jsp")
})
//@Validation()
public class TestOneAction {
String one;
@RequiredStringValidator( message = "one field cant be blank",fieldName="one")
@StringLengthFieldValidator( trim = true, minLength="2" , maxLength = "12",
fieldName = "one",message = "one should be of minimum 2 letters")
public String getOne() {
return one;
}
public void setOne(String one) {
this.one = one;
}
/*
@Validations(
requiredFields =
[EMAIL PROTECTED](type = ValidatorType.SIMPLE,
fieldName = "one", message = "You must enter a value for field.")
})*/
public String execute()
{
System.out.println("-----inside execute---");
return "SUCCESS";
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]