Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Fixed package names (credit goes to Axel Werner and Christian Couvez), and expanded the ending paragraph.

...

Code Block
titlesrc/main/java/orgcom/apacheexample/tapestry5/tutorial/pages/address/CreateAddress.java
package orgcom.apache.tapestry5example.tutorial.pages.address;

import orgcom.apacheexample.tapestry5tutorial.annotationsentities.InjectPageAddress;
import orgcom.apacheexample.tapestry5tutorial.annotationspages.PropertyIndex;
import org.apache.tapestry5.hibernate.annotations.CommitAfterInjectPage;
import org.apache.tapestry5.ioc.annotations.InjectProperty;
import org.apache.tapestry5.tutorialhibernate.entitiesannotations.AddressCommitAfter;
import org.apache.tapestry5.tutorialioc.pagesannotations.IndexInject;
import org.hibernate.Session;

public class CreateAddress
{
    @Property
    private Address address;

    @Inject
    private Session session;

    @InjectPage
    private Index index;

    @CommitAfter
    Object onSuccess()
    {
        session.persist(address);

        return index;
    }
}

...

Code Block
titlesrc/main/java/orgcom/apacheexample/tapestry5/tutorial/pages/Index.java (partial)
    @Inject
    private Session session;

    public List<Address> getAddresses()
    {
        return session.createCriteria(Address.class).list();
    }

...

We have lots more to talk about: more components, more customizations, built-in Ajax support, more common design and implementation patterns, and even writing your own components (which is easy!).

More tutorials are planned, but for now check Check out the other many Tapestry resources available on the Tapestry 5 Documentation page page, including the Getting Started and FAQ pages and the Cookbook Recipies. Be sure to peruse the User Guide, which provides comprehensive details on nearly every Tapestry topic.

Wiki Markup
{scrollbar}