myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gpetra...@apache.org
Subject svn commit: r763139 - in /myfaces/extensions/validator/branches/beanval_integration/trunk/examples/hello_world/src/main: java/org/apache/myfaces/blank/HelloWorldController.java java/org/apache/myfaces/blank/domain/Person.java webapp/helloWorld.jsp
Date Wed, 08 Apr 2009 08:31:22 GMT
Author: gpetracek
Date: Wed Apr  8 08:31:22 2009
New Revision: 763139

URL: http://svn.apache.org/viewvc?rev=763139&view=rev
Log:
example (part 2)

Modified:
    myfaces/extensions/validator/branches/beanval_integration/trunk/examples/hello_world/src/main/java/org/apache/myfaces/blank/HelloWorldController.java
    myfaces/extensions/validator/branches/beanval_integration/trunk/examples/hello_world/src/main/java/org/apache/myfaces/blank/domain/Person.java
    myfaces/extensions/validator/branches/beanval_integration/trunk/examples/hello_world/src/main/webapp/helloWorld.jsp

Modified: myfaces/extensions/validator/branches/beanval_integration/trunk/examples/hello_world/src/main/java/org/apache/myfaces/blank/HelloWorldController.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/beanval_integration/trunk/examples/hello_world/src/main/java/org/apache/myfaces/blank/HelloWorldController.java?rev=763139&r1=763138&r2=763139&view=diff
==============================================================================
--- myfaces/extensions/validator/branches/beanval_integration/trunk/examples/hello_world/src/main/java/org/apache/myfaces/blank/HelloWorldController.java
(original)
+++ myfaces/extensions/validator/branches/beanval_integration/trunk/examples/hello_world/src/main/java/org/apache/myfaces/blank/HelloWorldController.java
Wed Apr  8 08:31:22 2009
@@ -19,16 +19,22 @@
 package org.apache.myfaces.blank;
 
 import org.apache.myfaces.blank.domain.Person;
-import org.apache.myfaces.extensions.validator.beanval.annotation.group.BeanValidationController;
+import org.apache.myfaces.blank.validation.group.Admin;
+import org.apache.myfaces.blank.validation.group.User;
+import org.apache.myfaces.extensions.validator.beanval.annotation.BeanValidationController;
+import org.apache.myfaces.extensions.validator.beanval.annotation.group.Group;
+import org.apache.myfaces.extensions.validator.beanval.annotation.group.GroupValidation;
 
 /**
  * A typical simple backing bean, that is backed to <code>helloworld.jsp</code>
- * 
  */
+
+//@Group({User.class, Admin.class})
+//in case of deactivated default validation
 @BeanValidationController
 public class HelloWorldController
 {
-    //@BeanValidationController(@ValidateGroup(viewId = "/page2.jsp"))
+    //@BeanValidationController(@GroupValidation(viewId = "/form1.jsp"))
     private Person person = new Person();
 
     /**
@@ -47,6 +53,11 @@
         return "success";
     }
 
+    @BeanValidationController({
+            @GroupValidation(viewId = "/helloWorld.jsp"),
+            @GroupValidation(viewId = "/form1.jsp", use = @Group(User.class)),
+            @GroupValidation(viewId = "/form2.jsp", use = {@Group(Admin.class)})
+    })
     public Person getPerson()
     {
         return person;

Modified: myfaces/extensions/validator/branches/beanval_integration/trunk/examples/hello_world/src/main/java/org/apache/myfaces/blank/domain/Person.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/beanval_integration/trunk/examples/hello_world/src/main/java/org/apache/myfaces/blank/domain/Person.java?rev=763139&r1=763138&r2=763139&view=diff
==============================================================================
--- myfaces/extensions/validator/branches/beanval_integration/trunk/examples/hello_world/src/main/java/org/apache/myfaces/blank/domain/Person.java
(original)
+++ myfaces/extensions/validator/branches/beanval_integration/trunk/examples/hello_world/src/main/java/org/apache/myfaces/blank/domain/Person.java
Wed Apr  8 08:31:22 2009
@@ -18,10 +18,12 @@
  */
 package org.apache.myfaces.blank.domain;
 
+import org.apache.myfaces.blank.validation.group.Admin;
+import org.apache.myfaces.blank.validation.group.User;
 import org.apache.myfaces.extensions.validator.baseval.annotation.Required;
-import org.hibernate.validation.constraints.Length;
 
 import javax.validation.constraints.NotNull;
+import javax.validation.constraints.Size;
 
 public class Person
 {
@@ -31,7 +33,10 @@
 
     //demo for bean validation based validation support
     @NotNull
-    @Length(max = 6)
+    @Size.List({
+            @Size(min = 3, max = 6, groups = User.class),
+            @Size(min = 3, max = 12, groups = Admin.class)
+    })
     private String lastName;
 
     public String getFirstName()

Modified: myfaces/extensions/validator/branches/beanval_integration/trunk/examples/hello_world/src/main/webapp/helloWorld.jsp
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/beanval_integration/trunk/examples/hello_world/src/main/webapp/helloWorld.jsp?rev=763139&r1=763138&r2=763139&view=diff
==============================================================================
--- myfaces/extensions/validator/branches/beanval_integration/trunk/examples/hello_world/src/main/webapp/helloWorld.jsp
(original)
+++ myfaces/extensions/validator/branches/beanval_integration/trunk/examples/hello_world/src/main/webapp/helloWorld.jsp
Wed Apr  8 08:31:22 2009
@@ -26,7 +26,7 @@
             <h:form id="mainForm">
               <h:panelGrid columns="3">
                 <h:outputLabel for="first_name" value="First name:"/>
-                <h:inputText id="first_name" label="First name" value="#{helloWorld.person.firstName}"/>
+                <h:inputText id="first_name" label="First name" value="#{helloWorld['person'].firstName}"/>
                 <h:message for="first_name" showSummary="true" showDetail="false"/>
 
                 <h:outputLabel for="last_name" value="Last name:"/>



Mime
View raw message