[jboss-cvs] jboss-seam/examples/booking/view/exp ...

Michael Yuan michael.yuan at jboss.com
Fri Jul 14 01:28:45 EDT 2006


  User: myuan   
  Date: 06/07/14 01:28:45

  Modified:    examples/booking/view/exp  registerExp.html
  Log:
  Update the validation stuff
  
  Revision  Changes    Path
  1.3       +21 -11    jboss-seam/examples/booking/view/exp/registerExp.html
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: registerExp.html
  ===================================================================
  RCS file: /cvsroot/jboss/jboss-seam/examples/booking/view/exp/registerExp.html,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -b -r1.2 -r1.3
  --- registerExp.html	17 Apr 2006 20:51:08 -0000	1.2
  +++ registerExp.html	14 Jul 2006 05:28:45 -0000	1.3
  @@ -27,12 +27,14 @@
       </p>
   
       <p>
  -       This JSF form includes <code>&lt;h:message></code> tags that
  -       will display the results of any JSF validation failures that
  -       occur during the form submission cycle.
  +       The register.xhtml JSF form captures the user input for new account
  +       registration. It validates the user input, binds the data to a 
  +       Seam data component, and invokes a Seam UI event handler method
  +       when the form is submitted.
       </p>
       
   <code class="block">
  +&lt;s:validateAll>
   &lt;div class="entry">
       &lt;div class="label">
           &lt;h:outputLabel for="username">Username:&lt;/h:outputLabel>
  @@ -51,6 +53,7 @@
           &lt;span class="errors">&lt;h:message for="name" />&lt;/span>
       &lt;/div>
   &lt;/div>
  +&lt;/s:validateAll>
   
   ... ...
   
  @@ -72,12 +75,24 @@
      </p>
   
      <p>
  +       Notice that the input fields are enclosed by a <code>&lt;s:validateAll</code>
  +       tag. This tag is part of Seam's extension to JSF. It tells the Seam
  +       runtime to validate those input fields when the form is submitted.
  +       The validation conditions are specified on the entity bean classes
  +       those input fields map to (e.g., here the validation condition is
  +       on the <code>User</code> class, see later).
  +       This JSF form also includes <code>&lt;h:message></code> tags that
  +       will display the results of any JSF validation failures.
  +    </p>
  +
  +   <p>
         The <code>User</code> class is an EJB 3.0 entity bean with a 
         <code>@Name</code> annotation that binds the bean instance to a
         context variable named <code>user</code>. In addition to the standard 
         EJB 3.0 O/R mapping metadata, this bean features several Hibernate 
         Validator annotations such as 
  -      <code>@NotNull</code>, <code>@Length</code>. These constraints are 
  +      <code>@NotNull</code>, <code>@Length</code>. Due to the 
  +      <code>&lt;s:validateAll</code> tag in the form, these constraints are 
         automatically validated by Seam when the form is submitted. If the user 
         enters invalid data in the JSF form, the form will be redisplayed with 
         error messages.
  @@ -151,7 +166,7 @@
   public class RegisterAction implements Register
   {
   
  -   @In @Valid
  +   @In
      private User user;
      
      @PersistenceContext
  @@ -162,7 +177,6 @@
      
      private String verify;
      
  -   @IfInvalid(outcome=REDISPLAY)
      public String register()
      {
         if ( user.getPassword().equals(verify) )
  @@ -209,10 +223,6 @@
          component is a built-in Seam component that makes it very easy to display templated and localized
          messages to the user, even when redirect after post is used.
       </p>
  -    <p>
  -       The <code>@IfInValid</code> annotation tells the Seam to apply the Hibernate Validator constraints
  -       and redisplay the form with error messages if the constraints are violated.
  -    </p>
   
       <p>
          <center>
  
  
  



More information about the jboss-cvs-commits mailing list