[jboss-cvs] jboss-seam/doc/reference/en/modules ...

Gavin King gavin.king at jboss.com
Fri Jan 26 21:25:55 EST 2007


  User: gavin   
  Date: 07/01/26 21:25:55

  Modified:    doc/reference/en/modules  framework.xml
  Log:
  controller docs
  
  Revision  Changes    Path
  1.15      +54 -0     jboss-seam/doc/reference/en/modules/framework.xml
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: framework.xml
  ===================================================================
  RCS file: /cvsroot/jboss/jboss-seam/doc/reference/en/modules/framework.xml,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -b -r1.14 -r1.15
  --- framework.xml	23 Jan 2007 01:34:05 -0000	1.14
  +++ framework.xml	27 Jan 2007 02:25:55 -0000	1.15
  @@ -521,4 +521,58 @@
   </core:managed-persistence-context>]]></programlisting>
           
       </section>    
  +
  +    <section>
  +        <title>Controller objects</title>
  +        <para>
  +            A totally optional part of the Seam Application Framework is the class
  +            <literal>Controller</literal> and its subclasses 
  +            <literal>EntityController</literal>
  +            <literal>HibernateEntityController</literal> and
  +            <literal>BusinessProcessController</literal>. These classes provide 
  +            nothing more than some convenience methods for access to commonly
  +            used built-in components and methods of built-in components. They help
  +            save a few keystrokes (characters can add up!) and provide a great
  +            launchpad for new users to explore the rich functionality built in
  +            to Seam.
  +        </para>
  +        <para>
  +            For example, here is what <literal>RegisterAction</literal> from the
  +            Seam registration example would look like:
  +        </para>
  +        
  +        <programlisting><![CDATA[@Stateless
  + at Name("register")
  +public class RegisterAction extends EntityController implements Register
  +{
  +
  +   @In private User user;
  +   
  +   public String register()
  +   {
  +      List existing = createQuery("select u.username from User u where u.username=:username")
  +         .setParameter("username", user.getUsername())
  +         .getResultList();
  +      
  +      if ( existing.size()==0 )
  +      {
  +         persist(user);
  +         info("Registered new user #{user.username}");
  +         return "/registered.jspx";
  +      }
  +      else
  +      {
  +         addFacesMessage("User #{user.username} already exists");
  +         return null;
  +      }
  +   }
  +
  +}]]></programlisting>
  +
  +        <para>
  +            As you can see, its not an earthshattering improvement...
  +        </para>
  +
  +    </section>
  +    
   </chapter>
  \ No newline at end of file
  
  
  



More information about the jboss-cvs-commits mailing list