[CONF] Apache Tapestry Getting Started

2011-11-22 Thread confluence







Getting Started
File attached by  Howard M. Lewis Ship




getting-started.png
(75 kB image/png)



   
Change Notification Preferences
   
   View Attachments









[CONF] Apache Tapestry Getting Started

2011-11-22 Thread confluence







Getting Started
Page edited by Howard M. Lewis Ship


 Changes (4)
 




{float:right|background="" {contentbylabel:title=Related Articles|showLabels=false|showSpace=false|labels=new-users} 
{float} 
 
Getting started with Tapestry is easy, and you have lots of ways to begin your adventure: watch a video, browse the source code of a working demo app, create a skeleton app using Maven, or step through the tutorial.  
...
The easiest way to start a new app is to use [Apache Maven|http://maven.apache.org] to create your initial project; Maven can use an _archetype_ (a kind of project template) to create a bare-bones Tapestry application for you.  
Once you have Maven installed, execute the following command:{{mvn archetype:generate -DarchetypeCatalog=http://tapestry.apache.org}}. \-DarchetypeCatalog=}}{{[http://tapestry.apache.org]}}. Maven will prompt you for the archetype to create (Tapestry 5 Quickstart Project) and the exact version number (5.3, at the time of writing).  It also asks you for a group id, an artifact id, and a version number.  You can see this in the following transcript: 
 {noformat} $ mvn archetype:generate -DarchetypeCatalog=http://tapestry.apache.org [INFO] Scanning for projects... 
[INFO] 
[INFO]  [INFO] Building Maven Stub Project (No POM) 1 [INFO]  
[INFO] 
[INFO]  maven-archetype-plugin:2.1:generate (default-cli) @ standalone-pom  
[INFO] 
[INFO]  maven-archetype-plugin:2.1:generate (default-cli) @ standalone-pom  
[INFO] 
[INFO] --- maven-archetype-plugin:2.1:generate (default-cli) @ standalone-pom --- [INFO] Generating project in Interactive mode 
...
2: http://tapestry.apache.org - org.apache.tapestry:tapestry-archetype (Tapestry 4.1.6 Archetype) Choose a number or apply filter (format: [groupId:]artifactId, case sensitive contains): : 1 
Choose version: 
1: 5.0.19 2: 5.1.0.5 
...
Define value for property groupId: : com.example Define value for property artifactId: : newapp 
Define value for property version:  1.0-SNAPSHOT: : 
Define value for property package:  com.example: : com.example.newapp Confirm properties configuration: 
...
version: 1.0-SNAPSHOT package: com.example.newapp 
 Y: : 
[INFO]  [INFO] Using following parameters for creating project from Archetype: quickstart:5.3 
...
!getting-started.png|align=center,thumbnail!  
The application consists of three pages sharing a common look and feel.  The initial page, Index, allows you to perform some basic operations. 
 
You can also load the newly-created project it into any IDE and start coding. See the next section on where to find the different components of the application. 
 h2. Exploring the generated project 
...
A Tapestry application is composed of pages, each page consisting of one template file and one Java class.  
Tapestry page templates have the {{.tml}} extension and are found in src/main/*resources*/com/example/newapp/*pages{*}{footnote}That is, in the {{com.example.newapp.pages}} package.{footnote} . Templates are essentially HTML with some special markup to link the template to the Java class and to reference ready-made components you can use to speed up your development. 
 Java classes are found in src/main/*java*/com/example/newapp/*pages* and their name matches their template name ({{Index.tml}} \- {{Index.java}}). 
...
h2. Obtain Help  
Tapestry has an active user mailing list on which you can find a lot of valuable support. You can subscribe by sending e-mail to [mailto:users-subscr...@tapestry.apache.org] or look for an answer in the [archives|http://markmail.org/search/list:org.apache.tapestry.users].   [More Options|Mailing Lists]... 
 Having trouble?  Try our [TAPESTRY:Frequently Asked Questions]. 
...


Full Content


Related Articles


 Page:
 Introduction





 Page:
 Principles



[CONF] Apache Tapestry Creating The Skeleton Application

2011-11-22 Thread confluence







Creating The Skeleton Application
File attached by  Howard M. Lewis Ship




startpage.png
(75 kB image/png)



   
Change Notification Preferences
   
   View Attachments









[CONF] Apache Tapestry Creating The Skeleton Application

2011-11-22 Thread confluence







Creating The Skeleton Application
Page edited by Howard M. Lewis Ship


Comment:
Update for 5.3


 Changes (37)
 




...
{code}  
It will then prompt you to pick the archetype - choose the latest *Tapestry 5.X3 Quickstart Project*, enter the group id, artifact id, version and package when prompted. 
 {noformat} 
~/Documents/workspace 
$ mvn archetype:generate -DarchetypeCatalog=http://tapestry.apache.org [INFO] Scanning for projects... 
[INFO] Searching repository for plugin with prefix: archetype. 
[INFO]  
[INFO]  
[INFO] Building Maven Default Stub Project (No POM) 1 
[INFO]task-segment: [archetype:generate] (aggregator-style) 
[INFO]  
[INFO] Preparing archetype:generate [INFO] No goals needed for project - skipping [INFO] [archetype:generate {execution: default-cli}] 
[INFO]  [INFO]  maven-archetype-plugin:2.1:generate (default-cli) @ standalone-pom  [INFO]  [INFO]  maven-archetype-plugin:2.1:generate (default-cli) @ standalone-pom  [INFO]  [INFO] --- maven-archetype-plugin:2.1:generate (default-cli) @ standalone-pom --- 
[INFO] Generating project in Interactive mode [INFO] No archetype defined. Using maven-archetype-quickstart (org.apache.maven.archetypes:maven-archetype-quickstart:1.0) Choose archetype: 
1: http://tapestry.apache.org - org.apache.tapestry:quickstart (Tapestry 5.X 5 Quickstart Project) 
2: http://tapestry.apache.org - org.apache.tapestry:tapestry-archetype (Tapestry 4.1.6 Archetype) 
Choose a number: : 1 
Choose a number or apply filter (format: [groupId:]artifactId, case sensitive contains): : 1 
Choose version:  
1: 5.1.0.5 5.0.19 
2: 5.0.19 5.1.0.5 
3: 5.2.46 
4: 5.2.5 5.3 
 
Choose a number: 4: 4 Define value for property groupId: : com.example Define value for property artifactId: : tutorial1 
Define value for property version:   1.0-SNAPSHOT: : 
Define value for property package:   com.example: : com.example.tutorial 
Confirm properties configuration: groupId: com.example 
...
version: 1.0-SNAPSHOT package: com.example.tutorial 
Y:  
 Y: :  [INFO]  [INFO] Using following parameters for creating project from Archetype: quickstart:5.3 [INFO]  [INFO] Parameter: groupId, Value: com.example [INFO] Parameter: artifactId, Value: tutorial1 [INFO] Parameter: version, Value: 1.0-SNAPSHOT [INFO] Parameter: package, Value: com.example.tutorial [INFO] Parameter: packageInPathFormat, Value: com/example/tutorial [INFO] Parameter: package, Value: com.example.tutorial [INFO] Parameter: version, Value: 1.0-SNAPSHOT [INFO] Parameter: groupId, Value: com.example [INFO] Parameter: artifactId, Value: tutorial1 [WARNING] Dont override file /Users/hlship/Documents/workspace/tutorial1/src/test/java [WARNING] Dont override file /Users/hlship/Documents/workspace/tutorial1/src/main/webapp [WARNING] Dont override file /Users/hlship/Documents/workspace/tutorial1/src/main/resources/com/example/tutorial [WARNING] Dont override file /Users/hlship/Documents/workspace/tutorial1/src/test/resources [WARNING] Dont override file /Users/hlship/Documents/workspace/tutorial1/src/test/conf [WARNING] Dont override file /Users/hlship/Documents/workspace/tutorial1/src/site [INFO] project created from Archetype in dir: /Users/hlship/Documents/workspace/tutorial1 
[INFO]  
[INFO] BUILD SUCCESSFUL 
[INFO]  
[INFO] Total time: 1 minute 41 seconds 
[INFO] Total time: 22.398s 
[INFO] Finished at: Wed Jul 02 17:00:16 Tue Nov 22 11:46:08 PST 2011 
[INFO] Final Memory: 16M/81M 7M/81M 
[INFO]  ~/Documents/workspace 
...
 {noformat} 
URLRewriter: TranslatorSource: DEFINED 
UpdateListenerHub: TypeCoercer: REAL 
URLEncoder: DEFINED  UpdateListenerHub: DEFINED 

[CONF] Apache Tapestry Creating The Skeleton Application

2011-11-22 Thread confluence







Creating The Skeleton Application
File attached by  Howard M. Lewis Ship




startpage.png
(74 kB image/png)



   
Change Notification Preferences
   
   View Attachments









[CONF] Apache Tapestry Creating The Skeleton Application

2011-11-22 Thread confluence







Creating The Skeleton Application
Page edited by Howard M. Lewis Ship


 Changes (1)
 




...
  
!startpage.png|border=1! !startpage.png|align=center,thumbnail! 
 The date and time in the middle of the page proves that this is a live application. 
...


Full Content

Dependencies, Tools and PluginsTapestry TutorialLoading the Project Into Eclipse

Using the Quickstart Archetype

Before we can get down to the fun, we have to create an empty application. Tapestry uses a feature of Maven to do this: archetypes (a too-clever way of saying "project templates").

What we'll do is create an empty shell application using Maven, then import the application into Eclipse to do the rest of the work.

For the tutorial, we're using a fresh install of Eclipse and an empty workspace at /Users/Howard/Documents/workspace




1


.  You may need to adjust a few things for other operating systems or local paths.

From our workspace directory, we'll use Maven to create a skeleton Tapestry project. 

Before proceeding, we have to decide on four things: A Maven group id and artifact id for our project, a version, and a base package name.

Maven uses the group id and artifact id to provide a unique identity for the application, and Tapestry needs to have a base package name so it knows where to look for pages and components.

For this example, we'll use the group id com.example, artifact id tutorial1, version 1.0-SNAPSHOT and we'll use com.example.tutorial as the base package.

Our final command line is:



mvn archetype:generate -DarchetypeCatalog=http://tapestry.apache.org



It will then prompt you to pick the archetype - choose the latest Tapestry 5.3 Quickstart Project, enter the group id, artifact id, version and package when prompted.


$ mvn archetype:generate -DarchetypeCatalog=http://tapestry.apache.org
[INFO] Scanning for projects...
[INFO] 
[INFO] 
[INFO] Building Maven Stub Project (No POM) 1
[INFO] 
[INFO] 
[INFO]  maven-archetype-plugin:2.1:generate (default-cli) @ standalone-pom 
[INFO] 
[INFO]  maven-archetype-plugin:2.1:generate (default-cli) @ standalone-pom 
[INFO] 
[INFO] --- maven-archetype-plugin:2.1:generate (default-cli) @ standalone-pom ---
[INFO] Generating project in Interactive mode
[INFO] No archetype defined. Using maven-archetype-quickstart (org.apache.maven.archetypes:maven-archetype-quickstart:1.0)
Choose archetype:
1: http://tapestry.apache.org - org.apache.tapestry:quickstart (Tapestry 5 Quickstart Project)
2: http://tapestry.apache.org - org.apache.tapestry:tapestry-archetype (Tapestry 4.1.6 Archetype)
Choose a number or apply filter (format: [groupId:]artifactId, case sensitive contains): : 1
Choose version: 
1: 5.0.19
2: 5.1.0.5
3: 5.2.6
4: 5.3
Choose a number: 4: 4
Define value for property 'groupId': : com.example
Define value for property 'artifactId': : tutorial1
Define value for property 'version':  1.0-SNAPSHOT: : 
Define value for property 'package':  com.example: : com.example.tutorial 
Confirm properties configuration:
groupId: com.example
artifactId: tutorial1
version: 1.0-SNAPSHOT
package: com.example.tutorial
 Y: : 
[INFO] 
[INFO] Using following parameters for creating project from Archetype: quickstart:5.3
[INFO] 
[INFO] Parameter: groupId, Value: com.example
[INFO] Parameter: artifactId, Value: tutorial1
[INFO] Parameter: version, Value: 1.0-SNAPSHOT
[INFO] Parameter: package, Value: com.example.tutorial
[INFO] Parameter: packageInPathFormat, Value: com/example/tutorial
[INFO] Parameter: package, Value: com.example.tutorial
[INFO] Parameter: version, Value: 1.0-SNAPSHOT
[INFO] Parameter: groupId, Value: com.example
[INFO] Parameter: artifactId, Value: tutorial1
[WARNING] Don't override file /Users/hlship/Documents/workspace/tutorial1/src/test/java
[WARNING] Don't override file /Users/hlship/Documents/workspace/tutorial1/src/main/webapp
[WARNING] Don't override file /Users/hlship/Documents/workspace/tutorial1/src/main/resources/com/example/tutorial
[WARNING] Don't override file /Users/hlship/Documents/workspace/tutorial1/src/test/resources
[WARNING] Don't override file /Users/hlship/Documents/workspace/tutorial1/src/test/conf
[WARNING] Don't override file /Users/hlship/Documents/workspace/tutorial1/src/site
[INFO] project created from Archetype in dir: /Users/hlship/Documents/workspace/tutorial1
[INFO] 

[CONF] Apache Tapestry Implementing the Hi-Lo Guessing Game

2011-11-22 Thread confluence







Implementing the Hi-Lo Guessing Game
Page edited by Howard M. Lewis Ship


Comment:
Update for 5.3


 Changes (3)
 




...
{code:lang=xml|title=Index.tml} html t:type=layout title=Hi/Lo Guess 
xmlns:t=http://tapestry.apache.org/schema/tapestry_5_1_0.xsd xmlns:t=http://tapestry.apache.org/schema/tapestry_5_3.xsd 
   p 
...
{code:lang=xml|title=src/main/resources/com/example/tutorial/pages/Guess.tml} html t:type=layout title=Guess The Number 
xmlns:t=http://tapestry.apache.org/schema/tapestry_5_1_0.xsd xmlns:t=http://tapestry.apache.org/schema/tapestry_5_3.xsd 
   p 
...
{code:lang=xml|title=Guess.tml (revised)} html t:type=layout title=Guess The Number 
xmlns:t=http://tapestry.apache.org/schema/tapestry_5_1_0.xsd xmlns:t=http://tapestry.apache.org/schema/tapestry_5_3.xsd 
  xmlns:p=tapestry:parameter  
...


Full Content

Exploring the ProjectTapestry TutorialUsing BeanEditForm To Create User Forms

Let's start building a basic Hi-Lo Guessing game.

In the game, the computer selects a number between 1 and 10. You try and guess the number, clicking links. At the end, the computer tells you how many guesses you required to identify the target number. Even a simple example like this will demonstrate several important concepts in Tapestry:


	Breaking an application into individual pages
	Transferring information from one page to another
	Responding to user interactions
	Storing client information in the server-side session



We'll build this little application in small pieces, using the kind of iterative development that Tapestry makes so easy.



Our page flow is very simple, consisting of three pages: Index (the starting page), Guess and GameOver. The Index page introduces the application and includes a link to start guessing. The Guess page presents the user with ten links, plus feedback such as "too low" or "too high". The GameOver page tells the user how many guesses they took before finding the target number.

Index Page

Let's get to work on the Index page and template.

Index.tml

html t:type="layout" title="Hi/Lo Guess"
  xmlns:t="http://tapestry.apache.org/schema/tapestry_5_3.xsd"

  p
I'm thinking of a number between one and ten ... /p

  p
a href="" class="code-quote">"#"start guessing/a
  /p

/html



Running the application gives us our start:



However, clicking the link doesn't do anything yet, as its just a placeholder \a\ tag, not an actual Tapestry component. Let's think about what should happen when the user clicks that link:


	A random target number between 1 and 10 should be selected
	The number of guesses taken should be reset to 0
	The user should be sent to the Guess page to make a guess



Our first step is to find out when the user clicks that "start guessing" link.  In a typical web application framework, we might start thinking about URLs and handlers and maybe some sort of XML configuration file.  But this is Tapestry, so we're going to work with components and methods on our classes.

First, the component.  We want to perform an action (selecting the number) before continuing on to the Guess page.  The ActionLink component is just what we need; it creates a link with a URL that will trigger an action event in our code ... but that's getting ahead of ourselves.  First up, convert the \a\ tag to an ActionLink component:

Index.tml (partial)

  p
t:actionlink t:id="start"start guessing/t:actionlink
  /p



If you refresh the browser, you'll see that the URL for the "start guessing" link is now /tutorial1/index.start, which identifies the name of the page ("index") and the id of the component ("start").

If you click the link, you'll get an error:



Tapestry is telling us that we need to provide some kind of event handler for that event.  What does that look like?

An event handler is a method of the Java class with a special name. The name is onevent-nameFromcomponent-id ... here we want a method named onActionFromStart().  How do we know that "action" is the right event name?  Because that's what ActionLink does, that's why its named _Action_Link.

Once again, Tapestry gives us options; if you don't like naming conventions, there's an @OnEvent annotation you can place on the method instead, which restores the freedom to name the method as you like. Details about this approach are in the Tapestry Users' Guide. We'll be sticking with the naming convention approach for the tutorial.

When handling a component event request (the kind of request triggered by the ActionLink component's URL), Tapestry will find the component and trigger a component event on it. This is the callback our 

[CONF] Apache Tapestry Loading the Project Into Eclipse

2011-11-22 Thread confluence







Loading the Project Into Eclipse
File attached by  Howard M. Lewis Ship




eclipse-launch.png
(95 kB image/png)



   
Change Notification Preferences
   
   View Attachments









[CONF] Apache Tapestry Loading the Project Into Eclipse

2011-11-22 Thread confluence







Loading the Project Into Eclipse
File attached by  Howard M. Lewis Ship




eclipse-launch-vmargs.png
(70 kB image/png)



   
Change Notification Preferences
   
   View Attachments









[CONF] Apache Tapestry Loading the Project Into Eclipse

2011-11-22 Thread confluence







Loading the Project Into Eclipse
File attached by  Howard M. Lewis Ship




eclipse-jetty.png
(139 kB image/png)



   
Change Notification Preferences
   
   View Attachments









[CONF] Apache Tapestry Loading the Project Into Eclipse

2011-11-22 Thread confluence







Loading the Project Into Eclipse
Page edited by Howard M. Lewis Ship


Comment:
Update for 5.3 and newer version of RunJettyRun


 Changes (7)
 




...
!eclipse-launch.png|thumbnail!  
Make sure you clear the field labeled *HTTPS*. 
You will need to click the Show advanced Options checkbox, then uncheck SSL and Enable Scanner.   
 
You can then click *Run* and Jetty will launch (it takes only a few seconds): 
Tapestry runs best with a couple of additional options; click the Arguments tab and enter the following VM Arguments: {{-XX:MaxPermSize=256M -Xmx600m -Dtapestry.execution-mode=development}} 
 
Once you click Run, Jetty will start up and launch (it should take about two seconds). 
!eclipse-launch-vmargs.png|thumbnail! 
 
Tapestry uses more PermGen space (the part of Java memory used for loading classes) than a typical application, and uses more heap memory than the default; the above settings are good for a medium-to-large size Tapestry application, and will keep Java from running the Garbage Collector too often. The setting of tapestry.execution mode tells Tapestry to run in development mode, where runtime exceptions are reported more exhaustively.  With those settings in place, you can then click *Run* and Jetty will launch (it takes only a few seconds):  Once you click Run, Jetty will start up and launch (it should take a second or two).  
!eclipse-jetty.png|thumbnail!  
...


Full Content

Creating The Skeleton ApplicationTapestry TutorialExploring the Project

The first step is to ask Maven to generate the Eclipse control files (.classpath and .project) for us:


$ mvn eclipse:eclipse -DdownloadSources=true
[INFO] Scanning for projects...
Downloading: http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-war-plugin/2.1.1/maven-war-plugin-2.1.1.pom
Downloaded: http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-war-plugin/2.1.1/maven-war-plugin-2.1.1.pom (7 KB at 7.1 KB/sec)
Downloading: http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-war-plugin/2.1.1/maven-war-plugin-2.1.1.jar
Downloaded: http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-war-plugin/2.1.1/maven-war-plugin-2.1.1.jar (76 KB at 83.4 KB/sec)
Downloading: http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-eclipse-plugin/maven-metadata.xml
Downloaded: http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-eclipse-plugin/maven-metadata.xml (680 B at 1.9 KB/sec)
Downloading: http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-eclipse-plugin/2.8/maven-eclipse-plugin-2.8.pom
Downloaded: http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-eclipse-plugin/2.8/maven-eclipse-plugin-2.8.pom (12 KB at 22.9 KB/sec)
Downloading: http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-plugins/17/maven-plugins-17.pom
Downloaded: http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-plugins/17/maven-plugins-17.pom (13 KB at 25.6 KB/sec)
Downloading: http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-eclipse-plugin/2.8/maven-eclipse-plugin-2.8.jar
Downloaded: http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-eclipse-plugin/2.8/maven-eclipse-plugin-2.8.jar (202 KB at 237.8 KB/sec)
[INFO] 
[INFO] 
[INFO] Building tutorial1 Tapestry 5 Application 1.0-SNAPSHOT
[INFO] 
[INFO] 
[INFO]  maven-eclipse-plugin:2.8:eclipse (default-cli) @ tutorial1 
[INFO] 
[INFO]  maven-eclipse-plugin:2.8:eclipse (default-cli) @ tutorial1 
[INFO] 
[INFO] --- maven-eclipse-plugin:2.8:eclipse (default-cli) @ tutorial1 ---
Downloading: http://repo1.maven.org/maven2/org/codehaus/plexus/plexus-archiver/1.0-alpha-7/plexus-archiver-1.0-alpha-7.pom
Downloaded: http://repo1.maven.org/maven2/org/codehaus/plexus/plexus-archiver/1.0-alpha-7/plexus-archiver-1.0-alpha-7.pom (2 KB at 2.3 KB/sec)
Downloading: http://repo1.maven.org/maven2/org/codehaus/plexus/plexus-components/1.1.6/plexus-components-1.1.6.pom
Downloaded: http://repo1.maven.org/maven2/org/codehaus/plexus/plexus-components/1.1.6/plexus-components-1.1.6.pom (2 KB at 3.7 KB/sec)
Downloading: http://repo1.maven.org/maven2/org/codehaus/plexus/plexus-utils/1.2/plexus-utils-1.2.pom
Downloaded: http://repo1.maven.org/maven2/org/codehaus/plexus/plexus-utils/1.2/plexus-utils-1.2.pom (767 B at 1.5 KB/sec)
Downloading: http://repo1.maven.org/maven2/org/codehaus/plexus/plexus/1.0.5/plexus-1.0.5.pom
Downloaded: 

[CONF] Apache Tapestry Dependencies, Tools and Plugins

2011-11-22 Thread confluence







Dependencies, Tools and Plugins
Page edited by Howard M. Lewis Ship


Comment:
Minor tweaks


 Changes (6)
 




...
h1. JDK 1.5 or Newer  
Tapestry 5 makes use of features of JDK 1.5. This includes Java Aannotations, and a little bit of Java Ggenerics.  JDK 1.6 works fine too. 
 
h1. Eclipse Helios (3.6.1 Indigo (3.7 or Newer) 
 Since were emphasizing a free and open source stack, well concentrate on the best _free_ IDE. 
...
You can install RunJettyRun using Eclipses _Install New Software..._ menu item; the update URL is [http://run-jetty-run.googlecode.com/svn/trunk/updatesite].  
This tutorial was written with RunJettyRun version 1.13.1. 
 
h1. Maven 2.2.1 3 
 Maven is a software build tool of rather epic ambitions. It has a very sophisticated plugin system that allows it to do virtually anything, though compiling Java code, building WAR and JAR files, and creating reports and web sites are its forte. 
...
Maven is not essential for using Tapestry, but is especially helpful when performing the initial setup of a Tapestry application.  
Maven 2.2.1 is available from [http://maven.apache.org/download.html|http://maven.apache.org/download.html]. 
 
{note} Maven 3.0 is now available but we have not tested the tutorial against it. {note}  
There are plugins available for Eclipse, but we will not be using those here; instead, well use Maven to generate Eclipse control files for us.  
...


Full Content

Tapestry TutorialCreating The Skeleton Application

As much as we would like to dive into Tapestry right now, we must first talk about setting up your development environment. The joy and the pain of Java development is the volume of choice available. There's just a bewildering number of JDKs, IDEs and other TLAs (Three Letter Acronyms) out there.

Let's talk about a stack of tools, all open source and freely available, that you'll need to setup. Likely you have some of these, or some version of these, already on your development machine.

JDK 1.5 or Newer

Tapestry 5 makes use of features of JDK 1.5. This includes Java annotations, and a little bit of Java generics.  JDK 1.6 works fine too.

Eclipse Indigo (3.7 or Newer)

Since we're emphasizing a free and open source stack, we'll concentrate on the best free IDE.

Ok, sure, IntelliJ is now free as well. And NetBeans has gotten really nice. Feel free to adapt these instructions to those IDEs.

Eclipse comes in various flavors, and includes a reasonable XML editor built-in.  It can be downloaded from the eclipse.org web site.  We recommend the Eclipse IDE for Java Developers.

Jetty

Jetty is an open source servlet container created by Greg Wilkins of Webtide (which offers commercial support for Jetty). Jetty is high performance and designed for easy embedding in other software.

RunJettyRun Eclipse Plugin

RunJettyRun is a very simple Eclipse plugin that bundles a version of Jetty (Jetty 6 at this writing) so that you can create Eclipse launches that start Jetty to execute your web application.

You can install RunJettyRun using Eclipse's Install New Software... menu item; the update URL is http://run-jetty-run.googlecode.com/svn/trunk/updatesite.

This tutorial was written with RunJettyRun version 1.3.1.

Maven 3

Maven is a software build tool of rather epic ambitions. It has a very sophisticated plugin system that allows it to do virtually anything, though compiling Java code, building WAR and JAR files, and creating reports and web sites are its forte.

Perhaps the biggest advantage of Maven over, say, Ant, is that it can download project dependencies (such as the Tapestry JAR files, and the JAR files Tapestry itself depends on) automatically for you, from one of several central repositories.

Maven is not essential for using Tapestry, but is especially helpful when performing the initial setup of a Tapestry application.

Maven is available from http://maven.apache.org/download.html.

There are plugins available for Eclipse, but we will not be using those here; instead, we'll use Maven to generate Eclipse control files for us.

Tapestry

You should not have to download this directly; as we'll see, Maven should take care of downloading Tapestry, and its dependencies, as needed.

Tapestry TutorialCreating The Skeleton Application



Change Notification Preferences

View Online
|
View Changes









[CONF] Apache Tapestry Using BeanEditForm To Create User Forms

2011-11-22 Thread confluence







Using BeanEditForm To Create User Forms
Page edited by Howard M. Lewis Ship


Comment:
Update for 5.3


 Changes (4)
 




...
{code:XML|title=src/main/resources/com/example/tutorial/pages/address/CreateAddress.tml} html t:type=layout title=Create New Address 
xmlns:t=http://tapestry.apache.org/schema/tapestry_5_1_0.xsd xmlns:t=http://tapestry.apache.org/schema/tapestry_5_3.xsd 
   emcoming soon .../em 
...
Tapestry is encouraging you to use a more descriptive name: Create{_}Address_, not just Create, but it isnt making you pay the cost (in terms of longer, uglier URLs). The URL to access the page will still be [http://localhost:8080/tutorial1/address/create].  
And remember, regardless of the name that Tapestry assigns to your page, the template file is named like the Java class itself: CreateAddress.tml.  
{info} Index pages work in folders as well. A class named com.example.tutorial.pages.address.AddressIndex would be given the name address/Index. However, Tapestry has special rules for pages named Index and the rendered URL would be [http://localhost:8080/tutorial1/address/]. In other words, you can place Index pages in any folder and Tapestry will build a short URL for that page ... and you _dont_ have to keep naming the classes Index (its confusing to have many classes with the same name, even across multiple packages); instead, you can name each index page after the package that contains it. Tapestry users a smart _convention_ to keep it all straight and generate short, to the point URLs. 
...
MR=Mr. MRS=Mrs. 
DR=Dr.{noformat} 
{noformat} 
 Notice that we dont have to include an option for MISS, because that is converted to Miss anyway. You might just want to include it for sake of consistency ... the point is, each option label is searched for separately. 
...


Full Content

Implementing the Hi-Lo Guessing GameTapestry TutorialUsing Tapestry With Hibernate

In the previous chapters, we saw how Tapestry can handle simple links, even links that pass information in the URL. In this chapter, we'll see how Tapestry can do the same, and quite a bit more, for HTML forms.

Form support in Tapestry is deep and rich, more than can be covered in a single chapter. However, we can show the basics, including some very common development patterns. To get started, let's create a simple address book application.

We'll start with the entity data, a simple object to store the information we'll need. These classes go in an entities sub-package. Unlike the use of the pages sub-package (for page component classes), this is not enforced by Tapestry; it's just a convention (but as we'll see shortly, a handy one).

Tapestry treats public fields as if they were JavaBeans properties; since the Address object is just "dumb data", there's no need to get carried away writing getters and setters. Instead, we'll define an entity that is all public fields:

src/main/java/com/example/tutorial/entities/Address.java

package com.example.tutorial.entities;

import com.example.tutorial.data.Honorific;

public class Address
{
  public Honorific honorific;

  public String firstName;

  public String lastName;

  public String street1;

  public String street2;

  public String city;

  public String state;

  public String zip;

  public String email;

  public String phone;
}



We also need to define the enum type, Honorific:

src/main/java/com/example/tutorial/data/Honorific.java

package com.example.tutorial.data;

public enum Honorific
{
  MR, MRS, MISS, DR
}



Address Pages

We're probably going to create a few pages related to addresses: pages for creating them, for editing them, for searching and listing them. We'll create a sub-folder, address, to hold them. Let's get started on the first of these pages, "address/Create" (that's the real name, including the slash  we'll see in a minute how that maps to classes and templates).

First, we'll update the Index.tml template, to create a link to the new page:

src/main/resources/com/example/tutorial/pages/Index.tml (partial)

h1Address Book/h1

ul
  lit:pagelink page="address/create"Create new address/t:pagelink/li
/ul





Now we need the address/Create page; lets start with an empty shell, just to test our navigation.

src/main/resources/com/example/tutorial/pages/address/CreateAddress.tml

html t:type="layout" title="Create New Address"
  xmlns:t="http://tapestry.apache.org/schema/tapestry_5_3.xsd"

  emcoming soon .../em

/html



And the corresponding class:

src/main/java/com/example/tutorial/tutorial/pages/address/CreateAddress.java

package 

[CONF] Apache Tapestry Using BeanEditForm To Create User Forms

2011-11-22 Thread confluence







Using BeanEditForm To Create User Forms
Page edited by Howard M. Lewis Ship


Comment:
Update for 5.3


 Changes (4)
 




...
{code:XML|title=src/main/resources/com/example/tutorial/pages/address/CreateAddress.tml} html t:type=layout title=Create New Address 
xmlns:t=http://tapestry.apache.org/schema/tapestry_5_1_0.xsd xmlns:t=http://tapestry.apache.org/schema/tapestry_5_3.xsd 
   emcoming soon .../em 
...
Tapestry is encouraging you to use a more descriptive name: Create{_}Address_, not just Create, but it isnt making you pay the cost (in terms of longer, uglier URLs). The URL to access the page will still be [http://localhost:8080/tutorial1/address/create].  
And remember, regardless of the name that Tapestry assigns to your page, the template file is named like the Java class itself: CreateAddress.tml.  
{info} Index pages work in folders as well. A class named com.example.tutorial.pages.address.AddressIndex would be given the name address/Index. However, Tapestry has special rules for pages named Index and the rendered URL would be [http://localhost:8080/tutorial1/address/]. In other words, you can place Index pages in any folder and Tapestry will build a short URL for that page ... and you _dont_ have to keep naming the classes Index (its confusing to have many classes with the same name, even across multiple packages); instead, you can name each index page after the package that contains it. Tapestry users a smart _convention_ to keep it all straight and generate short, to the point URLs. 
...
MR=Mr. MRS=Mrs. 
DR=Dr.{noformat} 
{noformat} 
 Notice that we dont have to include an option for MISS, because that is converted to Miss anyway. You might just want to include it for sake of consistency ... the point is, each option label is searched for separately. 
...


Full Content

Implementing the Hi-Lo Guessing GameTapestry TutorialUsing Tapestry With Hibernate

In the previous chapters, we saw how Tapestry can handle simple links, even links that pass information in the URL. In this chapter, we'll see how Tapestry can do the same, and quite a bit more, for HTML forms.

Form support in Tapestry is deep and rich, more than can be covered in a single chapter. However, we can show the basics, including some very common development patterns. To get started, let's create a simple address book application.

We'll start with the entity data, a simple object to store the information we'll need. These classes go in an entities sub-package. Unlike the use of the pages sub-package (for page component classes), this is not enforced by Tapestry; it's just a convention (but as we'll see shortly, a handy one).

Tapestry treats public fields as if they were JavaBeans properties; since the Address object is just "dumb data", there's no need to get carried away writing getters and setters. Instead, we'll define an entity that is all public fields:

src/main/java/com/example/tutorial/entities/Address.java

package com.example.tutorial.entities;

import com.example.tutorial.data.Honorific;

public class Address
{
  public Honorific honorific;

  public String firstName;

  public String lastName;

  public String street1;

  public String street2;

  public String city;

  public String state;

  public String zip;

  public String email;

  public String phone;
}



We also need to define the enum type, Honorific:

src/main/java/com/example/tutorial/data/Honorific.java

package com.example.tutorial.data;

public enum Honorific
{
  MR, MRS, MISS, DR
}



Address Pages

We're probably going to create a few pages related to addresses: pages for creating them, for editing them, for searching and listing them. We'll create a sub-folder, address, to hold them. Let's get started on the first of these pages, "address/Create" (that's the real name, including the slash  we'll see in a minute how that maps to classes and templates).

First, we'll update the Index.tml template, to create a link to the new page:

src/main/resources/com/example/tutorial/pages/Index.tml (partial)

h1Address Book/h1

ul
  lit:pagelink page="address/create"Create new address/t:pagelink/li
/ul





Now we need the address/Create page; lets start with an empty shell, just to test our navigation.

src/main/resources/com/example/tutorial/pages/address/CreateAddress.tml

html t:type="layout" title="Create New Address"
  xmlns:t="http://tapestry.apache.org/schema/tapestry_5_3.xsd"

  emcoming soon .../em

/html



And the corresponding class:

src/main/java/com/example/tutorial/tutorial/pages/address/CreateAddress.java

package 

[CONF] Apache Tapestry Implementing the Hi-Lo Guessing Game

2011-11-22 Thread confluence







Implementing the Hi-Lo Guessing Game
Page edited by Howard M. Lewis Ship


 Changes (1)
 




...
{code:title=GameOver.tml} html t:type=layout title=Game Over 
xmlns:t=http://tapestry.apache.org/schema/tapestry_5_1_0.xsd xmlns:t=http://tapestry.apache.org/schema/tapestry_5_3.xsd 
  xmlns:p=tapestry:parameter  
...


Full Content

Exploring the ProjectTapestry TutorialUsing BeanEditForm To Create User Forms

Let's start building a basic Hi-Lo Guessing game.

In the game, the computer selects a number between 1 and 10. You try and guess the number, clicking links. At the end, the computer tells you how many guesses you required to identify the target number. Even a simple example like this will demonstrate several important concepts in Tapestry:


	Breaking an application into individual pages
	Transferring information from one page to another
	Responding to user interactions
	Storing client information in the server-side session



We'll build this little application in small pieces, using the kind of iterative development that Tapestry makes so easy.



Our page flow is very simple, consisting of three pages: Index (the starting page), Guess and GameOver. The Index page introduces the application and includes a link to start guessing. The Guess page presents the user with ten links, plus feedback such as "too low" or "too high". The GameOver page tells the user how many guesses they took before finding the target number.

Index Page

Let's get to work on the Index page and template.

Index.tml

html t:type="layout" title="Hi/Lo Guess"
  xmlns:t="http://tapestry.apache.org/schema/tapestry_5_3.xsd"

  p
I'm thinking of a number between one and ten ... /p

  p
a href="" class="code-quote">"#"start guessing/a
  /p

/html



Running the application gives us our start:



However, clicking the link doesn't do anything yet, as its just a placeholder \a\ tag, not an actual Tapestry component. Let's think about what should happen when the user clicks that link:


	A random target number between 1 and 10 should be selected
	The number of guesses taken should be reset to 0
	The user should be sent to the Guess page to make a guess



Our first step is to find out when the user clicks that "start guessing" link.  In a typical web application framework, we might start thinking about URLs and handlers and maybe some sort of XML configuration file.  But this is Tapestry, so we're going to work with components and methods on our classes.

First, the component.  We want to perform an action (selecting the number) before continuing on to the Guess page.  The ActionLink component is just what we need; it creates a link with a URL that will trigger an action event in our code ... but that's getting ahead of ourselves.  First up, convert the \a\ tag to an ActionLink component:

Index.tml (partial)

  p
t:actionlink t:id="start"start guessing/t:actionlink
  /p



If you refresh the browser, you'll see that the URL for the "start guessing" link is now /tutorial1/index.start, which identifies the name of the page ("index") and the id of the component ("start").

If you click the link, you'll get an error:



Tapestry is telling us that we need to provide some kind of event handler for that event.  What does that look like?

An event handler is a method of the Java class with a special name. The name is onevent-nameFromcomponent-id ... here we want a method named onActionFromStart().  How do we know that "action" is the right event name?  Because that's what ActionLink does, that's why its named _Action_Link.

Once again, Tapestry gives us options; if you don't like naming conventions, there's an @OnEvent annotation you can place on the method instead, which restores the freedom to name the method as you like. Details about this approach are in the Tapestry Users' Guide. We'll be sticking with the naming convention approach for the tutorial.

When handling a component event request (the kind of request triggered by the ActionLink component's URL), Tapestry will find the component and trigger a component event on it. This is the callback our server-side code needs to figure out what the user is doing on the client side.  Let's start with an empty event handler:

Index.java

package com.example.tutorial.pages;

public class Index
{
  void onActionFromStart()
  {

  }
}



In the browser, we can re-try the failed component event request by hitting the refresh button ... or we can restart the application.  In either case, we get the default behavior, which is simply to re-render the page.

Note that the event handler method does not have to be public; it can be protected, private, or package private (as in this example). By convention, such methods are package 

[CONF] Apache Tapestry Using Tapestry With Hibernate

2011-11-22 Thread confluence







Using Tapestry With Hibernate
Page edited by Howard M. Lewis Ship


Comment:
Update to 5.3


 Changes (20)
 




...
So, you fill in all the fields, submit the form (without validation errors) and voila: you get back the same form, blanked out. What happened, and where did the data go?  
What happened is that we havent told Tapestry what to do after the form is successfully submitted (by successful, we mean, with no validation errors). Tapestrys default behavior is to redisplay the active page, and that occurs in a new request, with a new instance of the Address object (because the address field is not a peristent field). 
 Well, since were creating objects, we might as well store them somewhere ... in a database. Were going to quickly integrate Tapestry with [Hibernate|http://hibernate.org] as the object/relational mapping layer, and ultimately store our data inside a [HSQLDB|http://www.hsqldb.org/] database. HSQLDB is an embedded database engine and requires no installation -- it will be pulled down as a dependency via maven. 
...
Since Hibernate can work with so many different databases, we must explicitly add in the correct driver.  
After changing the POM, you must re-execute the command {{mvn eclipse:eclipse -DdownloadSources=true}}. Then, inside Eclipse, right click on the project (in Package Explorer) and select the Refresh menu item. You should also stop Jetty.  
h3. Hibernate Configuration  
...
property name=hibernate.format_sqltrue/property /session-factory 
/hibernate-configuration{code} 
{code} 
 Most of the configuration is to identify the JDBC driver and connection URL. 
...
 {code:title=src/main/java/org/apache/tapestry5/tutorial/entities/Address.java} 
package org.apache.tapestry5.tutorial.entities; com.example.tutorial.entities; 
 
import org.apache.tapestry5.beaneditor.NonVisual; import org.apache.tapestry5.beaneditor.Validate; import org.apache.tapestry5.tutorial.data.Honorific;  
import javax.persistence.Entity; import javax.persistence.GeneratedValue; 
...
import javax.persistence.Id;  
import org.apache.tapestry5.beaneditor.NonVisual; import org.apache.tapestry5.beaneditor.Validate;  import com.example.tutorial.data.Honorific;  
@Entity public class Address { 
  @Id
  @GeneratedValue(strategy = GenerationType.IDENTITY)
  @NonVisual 
private public Long id; 
 
private public Honorific honorific; 
 
  @Validate(required) 
private public String firstName; 
 
  @Validate(required) 
private public String lastName; 
 
private public String street1; 
 
private public String street2; 
 
  @Validate(required) 
private public String city; 
 
  @Validate(required) 
private public String state; 
 
  @Validate(required,regexp) 
private public String zip; 
 
private public String email; 
 
private public String phone; 
} {code} 
 
public Long getId() { return id; }  public void setId(Long id) { this.id = id; }  public Honorific getHonorific() { return honorific; }  public String getFirstName() { return firstName; }  public String getLastName() { return lastName; }  public String getStreet1() { return street1; }  public String getStreet2() { return street2; }  public String getCity() { return city; }  public String getState() { return state; }  public String getZip() { return zip; }  public String getEmail() { return email; }  public String getPhone() { return phone; }  public void setCity(String city) { this.city = city; }  public void setEmail(String email) { this.email = email; }  public void setFirstName(String firstName) { this.firstName = firstName; }  public void setHonorific(Honorific honorific) { this.honorific = honorific; }  public void setLastName(String lastName) { this.lastName = lastName; }  public void setPhone(String phone) { this.phone = phone; }  public void setState(String state) { this.state = state; }  public void 

[CONF] Apache Tapestry Using BeanEditForm To Create User Forms

2011-11-22 Thread confluence







Using BeanEditForm To Create User Forms
Page edited by Howard M. Lewis Ship


Comment:
More 5.3 updates


 Changes (17)
 




...
!create-address-reordered.png|thumbnail!  
Ultimately, however we will be using the BeanEditForm with the Address entity on several pages, and dont want to have to reiterate that list of properties every time.   
h3. Customizing labels  
...
Since this is a _new_ file (and not a change to an existing file), you may have to restart Jetty to force Tapestry to pick up the change.  
!address-v3.png|border=1,width=760,height=446! Create Address form with field labels corrected 
...
 {code:XML} 
  t:beaneditform submitlabel=message:submit-label object=address/{code} 
  t:beaneditform object=address submitlabel=message:submit-label reorder=honorific,firstName,lastName,street1,street2,city,state,zip,email,phone / {code} 
 And then define the submit-label key in the message catalog:  {noformat} 
submit-label=Create Address{noformat} 
{noformat} 
 At then end of the day, the exact same HTML is sent to the client, regardless of whether you include the label text directly in the template, or indirectly in the message catalog. In the long term, the latter approach will work better if you later chose to internationalize your application. 
...
The BeanEditForm checks for a Tapestry-specific annotation, @org.apache.tapestry5.beaneditor.Validate, on the getter _or_ setter method of each property.  
Update the getter methods for the lastName, firstName, street1, city, state and zip fields, adding a @Validate annotation to each: 
 {code}   @Validate(required) 
public String getFirstName() firstName; 
  { return firstName;   } 
{code}  
...
You can apply multiple validations, by separating the validator names with commas. Some validators can be configured (with an equals sign). Thus you might say required,minLength=5 for a field that must be specified, and must be at least five characters long.  
{warning} You can easily get confused when you make a change to an entity class, such as adding the @Validate annotatation, and _not_ see the result in the browser. Only component classes, and (most) classes in the Tapestry services layer, are live-reloaded.  Data and entity objects are not reloaded, so this is one area where you need to stop and restart Jetty to see the change. {warning}  
Restart the application, and refresh your browser, then hit the submit button.  
!address-v6.png|border=1,width=760,height=482! 
  
...
{code}   @Validate(required,regexp=^\\d{5}(-\\d{4})?$) 
public String getZip() zip; 
  { return zip;   } 
{code}  
...
 {noformat} 
zip-regexp-message=Zip Codes are five or nine digits.  Example: 02134 or 90125-1655.{noformat} 
{noformat} 
 Refresh the page and submit again:  
!address-v8.png|border=1,width=760,height=482! 
  
...
{code}   @Validate(required,regexp) 
public String getZip() zip; 
  { return zip;   } 
{code}  
...
{noformat} zip-regexp=^\\d{5}(-\\d{4})?$ 
zip-regexp-message=Zip Codes are five or nine digits.  Example: 02134 or 90125-1655.{noformat} 
{noformat} 
 After a restart youll see the ... the same behavior. But when we start creating more complicated regular expressions, itll be much, much nicer to put them in the message catalog rather than inside the annotation value. And inside the message catalog, you can change and tweak the regular expressions without having to restart the application each time. 
...


Full Content

Implementing the Hi-Lo Guessing GameTapestry TutorialUsing Tapestry With Hibernate

In the previous chapters, we saw how Tapestry can handle simple links, even links that pass information in the URL. In this chapter, we'll see how Tapestry can do the same, and quite a bit more, for HTML forms.

Form support in Tapestry is deep and rich, more than can be covered in a single chapter. However, we can show the basics, including some very common development patterns. To get started, let's create a simple address book application.

We'll start with the entity data, a simple object to store the information we'll need. These classes go in an entities sub-package. Unlike the use of the pages sub-package (for page 

[CONF] Apache Tapestry Using Tapestry With Hibernate

2011-11-22 Thread confluence







Using Tapestry With Hibernate
Page edited by Howard M. Lewis Ship


Comment:
Fix package name


 Changes (1)
 




...
Below is the updated Address class, with the Hibernate annotations (as well as the Tapestry ones).  
{code:title=src/main/java/org/apache/tapestry5/tutorial/entities/Address.java} {code:title=src/main/java/com/example/tutorial/entities/Address.java} 
package com.example.tutorial.entities;  
...


Full Content

Using BeanEditForm To Create User FormsTapestry Tutorial

So, you fill in all the fields, submit the form (without validation errors) and voila: you get back the same form, blanked out. What happened, and where did the data go?

What happened is that we haven't told Tapestry what to do after the form is successfully submitted (by successful, we mean, with no validation errors). Tapestry's default behavior is to redisplay the active page, and that occurs in a new request, with a new instance of the Address object (because the address field is not a peristent field).

Well, since we're creating objects, we might as well store them somewhere ... in a database. We're going to quickly integrate Tapestry with Hibernate as the object/relational mapping layer, and ultimately store our data inside a HSQLDB database. HSQLDB is an embedded database engine and requires no installation  it will be pulled down as a dependency via maven.

Re-configuring the Project

We're going to bootstrap this project from a simple Tapestry project to one that uses Hibernate and HSQLDB.

Updating the Dependencies

First, we must update the POM to list a new set of dependencies, that includes Hibernate, the Tapestry/Hibernate integration library, and the HSQLDB JDBC driver:

src/pom.xml (partial)

dependencies
dependency
groupIdorg.apache.tapestry/groupId
artifactIdtapestry-hibernate/artifactId
version${tapestry-release-version}/version
/dependency

dependency
groupIdhsqldb/groupId
artifactIdhsqldb/artifactId
version1.8.0.7/version
/dependency

/dependencies



The tapestry-hibernate library includes, as transitive dependencies, Hibernate and tapestry-core. This means that you can simply replace "tapestry-core" with "tapestry-hibernate" inside the artifactId element.

Since Hibernate can work with so many different databases, we must explicitly add in the correct driver.

After changing the POM, you must re-execute the command mvn eclipse:eclipse -DdownloadSources=true. Then, inside Eclipse, right click on the project (in Package Explorer) and select the "Refresh" menu item. You should also stop Jetty.

Hibernate Configuration

Hibernate has a master configuration file used to store connection and other data.

src/main/resources/hibernate.cfg.xml

!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"
hibernate-configuration
session-factory
property name="hibernate.connection.driver_class"org.hsqldb.jdbcDriver/property
property name="hibernate.connection.url"jdbc:hsqldb:./target/work/t5_tutorial1;shutdown=true/property
property name="hibernate.dialect"org.hibernate.dialect.HSQLDialect/property
property name="hibernate.connection.username"sa/property
property name="hibernate.connection.password"/property
property name="hbm2ddl.auto"update/property
property name="hibernate.show_sql"true/property
property name="hibernate.format_sql"true/property
/session-factory
/hibernate-configuration



Most of the configuration is to identify the JDBC driver and connection URL.

Note the connection URL. We are instructing HSQLDB to store its database files within our project's target directory. We are also instructing HSQLDB to flush any data to these files at shutdown. This means that data will persist across different invocations of this project, but if the target directory is destroyed (e.g., via "mvn clean"), then all the database contents will be lost.

In addition, we are configuring Hibernate to update the database schema; when Hibernate initializes it will create or even modify tables to match the entities. Finally, we are configuring Hibernate to output any SQL it executes, which is very useful when initially building an application.

But what entities? Normally, the available entities are listed inside hibernate.cfg.xml, but that's not necessary with Tapestry; in another example of convention over configuration, Tapestry locates all entity classes inside the entities package and adds them to the configuration. Currently, that is just the 

[jira] [Updated] (TAP5-1753) Several Problems/BUGs on Tapestry 5 Tutorial

2011-11-22 Thread Howard M. Lewis Ship (Updated) (JIRA)

 [ 
https://issues.apache.org/jira/browse/TAP5-1753?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Howard M. Lewis Ship updated TAP5-1753:
---

Affects Version/s: (was: 5.0.19)
 Assignee: Howard M. Lewis Ship
   Labels: beginners tutorial  (was: beginners blocker bug tutorial)

Not a blocker bug: you were blocked, blocker bug has a different meaning.


 Several Problems/BUGs on Tapestry 5 Tutorial
 

 Key: TAP5-1753
 URL: https://issues.apache.org/jira/browse/TAP5-1753
 Project: Tapestry 5
  Issue Type: Bug
  Components: documentation
Reporter: Axel Werner
Assignee: Howard M. Lewis Ship
Priority: Blocker
  Labels: beginners, tutorial

 Hi there,
 im recently trying to learn tapestry5 from the ground up using the tutorial 
 provided at 
 http://tapestry.apache.org/using-beaneditform-to-create-user-forms.html .
 There i figgured (at least for me) some major Problems or Missing parts in 
 the Tutorial that do pretty much BLOCK me from continuing since i cannot 
 follow the tutorial from a certain point. I also added other suggestions to 
 improve the tutorial or to point you devs onto the missing point. the order 
 of the following ordered list is NOT IMPORTANT.
 1.
 basic projects starting using manualy installed maven and command line 
 interface. cool thing! but whats next? Do i have to start any new tapestry 
 project using the maven on command line now and import the thing into eclipse 
 ?? what about how to start a basic tapestry5 project from within eclipse? 
 ?? This point is completly missing in the tutorial. just a suggestion/feature 
 request for the tutorial.
 2.
 major problem here/BLOCKER:
 A tutorial should be linear/continuisly. so that one point leads into the 
 other, without breaks or missing stuff. I found a place where i miss at least 
 several realy important things that BLOCKS me yet from continuing the 
 tutorial.
 That is 
 http://tapestry.apache.org/using-beaneditform-to-create-user-forms.html , 
 especialy the section about adding validation.
 If you play through the tutorial step by step like i did, you will get lost 
 here!
 Some paragraph says: Update the getter methods for the lastName,... - but 
 WHERE?? No mention anywhere. You know it? Good! I dont, and i got lost here. 
 I assumed it may go into the address.java (struct style) class, but if you 
 do it, it will FAIL, since there are other important things to know or to do 
 first which are also NOT MENTIONED in the tutorial at this point. NEEDS 
 ATTENTION.
 3.
 There seem to be even more ERRORS/MISTAKES in this tutorial. At 
 http://tapestry.apache.org/using-tapestry-with-hibernate.html , there is 
 mentioned a file
 src/main/java/org/apache/tapestry5/tutorial/entities/Address.java
 which just DOES NOT MATCH the package path that is used in this tapestry5 
 tutorial! This may look easy to you, but for someone new like me which is all 
 new to the whole java world will have trouble fixing this error. 
 The correct tutorial packet path should be: 
 src/main/java/com/example/tutorial1/entities/address.java i guess.
 PLease re-check by following the whole tutorial step by step, and you will 
 run into these errors/blockings. 
 Some apreciation: till here the tutorial is quite good and i love it! pls 
 keep up the good work, complete/fix the tutorial and maybe even add some 
 additional chapters.
 Hopefully my report/suggestion will find its way to the author/maker of the 
 tutorial.
 Thanks n c u
 Axel Werner
 m...@awerner.homeip.net

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira




[jira] [Resolved] (TAP5-1753) Several Problems/BUGs on Tapestry 5 Tutorial

2011-11-22 Thread Howard M. Lewis Ship (Resolved) (JIRA)

 [ 
https://issues.apache.org/jira/browse/TAP5-1753?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Howard M. Lewis Ship resolved TAP5-1753.


Resolution: Not A Problem

Site has been updated to address your issues; however it does sound like you 
arrived at a page in the middle of the tutorial and ignored the navigation (top 
and bottom of each page) that would let you start from the beginning of the 
tutorial.



 Several Problems/BUGs on Tapestry 5 Tutorial
 

 Key: TAP5-1753
 URL: https://issues.apache.org/jira/browse/TAP5-1753
 Project: Tapestry 5
  Issue Type: Bug
  Components: documentation
Reporter: Axel Werner
Assignee: Howard M. Lewis Ship
Priority: Blocker
  Labels: beginners, tutorial

 Hi there,
 im recently trying to learn tapestry5 from the ground up using the tutorial 
 provided at 
 http://tapestry.apache.org/using-beaneditform-to-create-user-forms.html .
 There i figgured (at least for me) some major Problems or Missing parts in 
 the Tutorial that do pretty much BLOCK me from continuing since i cannot 
 follow the tutorial from a certain point. I also added other suggestions to 
 improve the tutorial or to point you devs onto the missing point. the order 
 of the following ordered list is NOT IMPORTANT.
 1.
 basic projects starting using manualy installed maven and command line 
 interface. cool thing! but whats next? Do i have to start any new tapestry 
 project using the maven on command line now and import the thing into eclipse 
 ?? what about how to start a basic tapestry5 project from within eclipse? 
 ?? This point is completly missing in the tutorial. just a suggestion/feature 
 request for the tutorial.
 2.
 major problem here/BLOCKER:
 A tutorial should be linear/continuisly. so that one point leads into the 
 other, without breaks or missing stuff. I found a place where i miss at least 
 several realy important things that BLOCKS me yet from continuing the 
 tutorial.
 That is 
 http://tapestry.apache.org/using-beaneditform-to-create-user-forms.html , 
 especialy the section about adding validation.
 If you play through the tutorial step by step like i did, you will get lost 
 here!
 Some paragraph says: Update the getter methods for the lastName,... - but 
 WHERE?? No mention anywhere. You know it? Good! I dont, and i got lost here. 
 I assumed it may go into the address.java (struct style) class, but if you 
 do it, it will FAIL, since there are other important things to know or to do 
 first which are also NOT MENTIONED in the tutorial at this point. NEEDS 
 ATTENTION.
 3.
 There seem to be even more ERRORS/MISTAKES in this tutorial. At 
 http://tapestry.apache.org/using-tapestry-with-hibernate.html , there is 
 mentioned a file
 src/main/java/org/apache/tapestry5/tutorial/entities/Address.java
 which just DOES NOT MATCH the package path that is used in this tapestry5 
 tutorial! This may look easy to you, but for someone new like me which is all 
 new to the whole java world will have trouble fixing this error. 
 The correct tutorial packet path should be: 
 src/main/java/com/example/tutorial1/entities/address.java i guess.
 PLease re-check by following the whole tutorial step by step, and you will 
 run into these errors/blockings. 
 Some apreciation: till here the tutorial is quite good and i love it! pls 
 keep up the good work, complete/fix the tutorial and maybe even add some 
 additional chapters.
 Hopefully my report/suggestion will find its way to the author/maker of the 
 tutorial.
 Thanks n c u
 Axel Werner
 m...@awerner.homeip.net

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira