myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Apache Wiki <wikidi...@apache.org>
Subject [Myfaces Wiki] Update of "Extensions/Validator/DevDoc" by GerhardPetracek
Date Wed, 08 Apr 2009 01:12:15 GMT
Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Myfaces Wiki" for change notification.

The following page has been changed by GerhardPetracek:
http://wiki.apache.org/myfaces/Extensions/Validator/DevDoc

------------------------------------------------------------------------------
  
  the current goal is that myfaces extval provides bean-validation (jsr 303) integration for
all jsf versions (1.x and 2.x).
  
- '''TODO''' (the integration depends on the final version of the specification and the reference
implementation)
- 
  === group validation (partial validation) ===
  jsf 2.0 integrates bean validation via tags[[BR]]
  e.g.: <f:validateBean validationGroups="javax.validation.groups.Default,app.validation.groups.Order"/>[[BR]]
@@ -402, +400 @@

  
  the idea is to annotate page beans and/or their properties
  
+ ==== default group handling ====
+ per default every page is validated with the default group (javax.validation.groups.Default).
so you don't really need example 1 and 2.[[BR]]
+ there will be a context-param to deactivate this default behavior. in such cases example
1 and 2 make sense again.
+ 
+ ==== usage ====
  the following examples are available [http://svn.apache.org/repos/asf/myfaces/extensions/validator/branches/beanval_integration/trunk/examples/hello_world/
here][[BR]]
  they are based on the hello world application of myfaces
  
@@ -418, +421 @@

  {{{
  public class HelloWorldController
  {
-     @BeanValidationController(@Validate(viewId = "/form1.jsp"))
+     @BeanValidationController(@GroupValidation(viewId = "/form1.jsp"))
      private Person person = new Person();
  ...
  }
@@ -435, +438 @@

      private Person person = new Person();
  
      @BeanValidationController({
-             @Validate(viewId = "/helloWorld.jsp"),
+             @GroupValidation(viewId = "/helloWorld.jsp"),
-             @Validate(viewId = "/form1.jsp", partialValidation = {@Group(User.class)}),
+             @GroupValidation(viewId = "/form1.jsp", use = @Group(User.class)),
-             @Validate(viewId = "/form2.jsp", partialValidation = {@Group(Admin.class)})
+             @GroupValidation(viewId = "/form2.jsp", use = {@Group(Admin.class)})
-             }
-     )
+     })
      public Person getPerson()
      {
          return person;
@@ -459, +461 @@

   * last base of the bound property
   * the bound property
  
- which means:[[BR]]
+ that means:[[BR]]
  #{pageBean.pageBeanProperty.property1.property2.propertyBase.property}
  
  in this example the >possible< targets are:
   * pageBean
   * pageBeanProperty
-  * propertyBase (in most szenarios it this target isn't suggested)
+  * propertyBase (in most szenarios this target isn't suggested)
-  * property (in most szenarios it this target isn't suggested)
+  * property (in most szenarios this target isn't suggested)
  
+ ==== comments ====
+ @GroupValidation instead of @Validate to be clearer and to be neutral for future extensions
of @BeanValidationController
- ==== default group ====
- per default every page is validated with the default group. so you don't really need example
1.[[BR]]
- there will be a context-param to switch off this default behavior. in such cases example
1 makes sense again.
  
  === topics to think about ===
  1)
- @Validate(viewId = "/form1.jsp", partialValidation = {@Group(User.class)}, restrict = {@Group(...)})[[BR]]
+ @GroupValidation(viewId = "/form1.jsp", use = @Group(...), restrict = @Group(...))[[BR]]
- to remove e.g. a group which was added at the class-level for a special property
+ example: to remove a group for a special property which was added at the class-level
  
  2)
  add/remove groups via annotations at action methods

Mime
View raw message