tapestry-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Apache Wiki <wikidi...@apache.org>
Subject [Tapestry Wiki] Trivial Update of "Tapestry5How to make a basic crud" by DanielJue
Date Thu, 05 Jun 2008 18:52:12 GMT
Dear Wiki user,

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

The following page has been changed by DanielJue:
http://wiki.apache.org/tapestry/Tapestry5How_to_make_a_basic_crud

The comment on the change is:
Just changed some English around to make it a bit more clear.

------------------------------------------------------------------------------
  
  This tutorials aims to present how to make a simple Crud cycle in tapestry 5.
  
- Before reading this tutorial, you should read the [http://tapestry.apache.org/tapestry5/tutorial1/
Howard Lewis Ship's tutorials] as we're going to reuse without re-explaining them all the
concepts they introduce.
+ Before reading this tutorial, you should read the [http://tapestry.apache.org/tapestry5/tutorial1/
Howard Lewis Ship's tutorials] as we're going to reuse parts of it without re-explaining all
the concepts they introduce.
  
- In order to stay focused on the question of CRUD we're not going to deal with a database
or wondering about transactions. If you want to work on a tutorial that deals with this question
in great details you should [http://wiki.apache.org/tapestry/Tapstry5First_project_with_Tapestry5,_Spring_and_Hibernate
read this one carrefully].
+ In order to stay focused on designing the CRUD, we're not going to deal with a database
or worry about transactions. If you want to work on a tutorial that deals with this question
in great details you should [http://wiki.apache.org/tapestry/Tapstry5First_project_with_Tapestry5,_Spring_and_Hibernate
read this one carefully].
  
  === Create the project ===
  
- To create the project and setting up all the dependencies we use maven :
+ To create the project and set up all the dependencies we use maven :
  
  {{{
  
@@ -26, +26 @@

  
  }}}
  
- Now let's move in the project and and make it available in eclipse
+ Now let's move in the project and and make it available in Eclipse
  {{{
   cd basicCrud
   mvn eclipse:eclipse
  }}}
  
- Import the project in eclipse : File -> Import -> General -> Existing Project Into
Workspace 
+ Import the project in Eclipse : File -> Import -> General -> Existing Project Into
Workspace 
  Browse to the folder basicCrud and click finish.
  
- we are ready to work.
+ Now we are ready to work!
  
  === Create the model ===
  
@@ -83, +83 @@

  		return id + " : " + name;
  	}
  
- 
  }
  
  }}}
  
   * The id is going to identify a bean 
-  * The name is just a property for the only purpose of this tutorial
+  * The name is just a property we will manipulate with the CRUD.  Of course you can expand
this later!
  
  === Create the Service ===
  
- In this tutorial as explained at the beginning we just target the CRUD process, thus we're
going to make a very simple BeanManager that hold a list of MyBean in memory, this service
is going to be injected (more on this later) as a Singleton. Thus, as long a your application
is deployed the list is still in memory, but every time you restart the server the list is
reinitialized. There's no persistence between server reboot.
+ As explained earlier, we're only going to focus on the CRUD process, thus we're going to
make a very simple BeanManager that will hold a list of MyBean in memory.  This service is
going to be injected (more on this later) as a Singleton. Thus, as long a your application
is deployed the list is still in memory, but every time you restart the server the list is
reinitialized. For this tutorial we're not going to implement persistence between server reboots.
  
- To make a service we need an interface and an implementation. If you wonder why we could
not only work with an implementation, you should read [http://tapestry.formos.com/nightly/tapestry5/tapestry-ioc/overview.html
this].
+ To make a service we need an interface and an implementation. If you wonder why we can't
just use an implementation, you should read [http://tapestry.formos.com/nightly/tapestry5/tapestry-ioc/overview.html
this].
+ Additionally, this is a good habit when used judiciously.
  
  In org.apache.tapestry.tutorial.basiccrud.services.manager create the interface BeanManager
  {{{
@@ -197, +197 @@

  
  Injecting a service in Tapestry is really easy, just add a bind method to your AppModule.java
 
  
- in org.apache.tapestry.tutorial.basiccrud.services.AppModule.java add this method
+ in org.apache.tapestry.tutorial.basiccrud.services.AppModule.java add this method:
  {{{
  
  public static void bind(ServiceBinder binder)
@@ -264, +264 @@

  }}}
  
  
-  * We inject the beanManager service through the @Inject annotation
+  * We inject the beanManager service through the @Inject annotation.  Note that we can only
inject into page/component classes, because Tapestry IOC will handle the necessary transformations.
 Classes outside of these directories will not be transformed, and thus the injected object
will be null.
-  * onActionFromDelete removes the bean from the list but return nothing as we stay on the
same page. The list is only refreshed.
+  * onActionFromDelete removes the bean from the list but return nothing as we stay on the
same page. The list is only refreshed. (You could also return null, which will keep you on
the same page)
-  * onActionFromDelete will be called each time the component actionLink having for id "delete"
is clicked.
+  * onActionFromDelete will be called each time the component actionLink having an id "delete"
is clicked.  (We're talking about the "id" field of the actionLink, not the Bean Id number
that's passed to it)
  
   Change Start.html in the WEB-INF directory
   {{{
@@ -393, +393 @@

        <input type="submit"/>
      </t:form>
  
- 
  </body>
  </html>
  
@@ -412, +411 @@

  
  === Conclusion ===
  
- I made this tutorial because I needed one and thought that I probably was not the only one.
Thanks to the users of the mailing list that point on weakness and help me to make it better.

+ I made this tutorial because I needed one and thought that I probably was not the only one.
Thanks to the users of the mailing list that point on weakness and help me to make it better.
 
  
+ Credit to Michael Courcy for taking the time to write this tutorial.
+ 

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org


Mime
View raw message