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 michaelcourcy: http://wiki.apache.org/tapestry/Tapestry5How_to_make_a_basic_crud ------------------------------------------------------------------------------ === Basic CRUD with Tapestry 5 === - ==== Introduction ==== + === Introduction === This tutorials aims to present you how easy and elegant could be the conception of a Crud cycle in tapestry 5. 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]. - ==== Create the project ===== + === Create the project ==== To create the project and setting up all the dependencies we use maven : @@ -35, +35 @@ we are ready to work. - ==== Create the model ==== + === Create the model === Create in the package org.apache.tapestry.tutorial.basiccrud.model our model class, as you can see I made it simple : @@ -89, +89 @@ * The id is going to identify a bean * The name is just a property for the only purpose of this tutorial - ==== Create the Service ==== + === 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 Singleon. 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. @@ -203, +203 @@ }}} - ==== Inject the service ==== + === Inject the service === 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 @@ -220, +220 @@ Now the BeanManager is available in any tapestry component through the @Inject annotation. - ==== Display a list of beans in the Start page ==== + === Display a list of beans in the Start page === Change the Start.java to display a list of beans, and handles some Crud action {{{ @@ -346, +346 @@ }}} - ==== Edit or create a bean ==== + === Edit or create a bean === To create or edit a bean we'll use Save.java : {{{ @@ -420, +420 @@ }}} - ==== Try it ==== + === Try it === now try it : {{{ @@ -429, +429 @@ And just navigate to http://localhost:8080 you'll find your way ;-). - ==== Conclusion ==== + === Conclusion === As you can see building a CRUD cycle in Tapestry 5 is really easy. Instead of the other framework we didn't use a code generator or other magic un/ex-plicit rules, things are clear from the start and you know exactly what you do. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
