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 ErikVullings:
http://wiki.apache.org/tapestry/MoreFrequentlyAskedQuestions

------------------------------------------------------------------------------
+ == Where is the (some random HTML) component? (i.e. TD) ==
+ Any component that does not have a direct Tapestry component can be 
represented with the Tapestry ANY component.  For example, say you want to have 
Tapestry generate the background color for your table using a TD component you 
could use <td [EMAIL PROTECTED] bgcolor=”ognl:backgroundColor”></td>.
- <style>
- <!--
-  /* Font Definitions */
- @font-face
-       {font-family:Courier;
-       panose-1:0 0 0 0 0 0 0 0 0 0;
-       mso-font-charset:0;
-       mso-generic-font-family:modern;
-       mso-font-format:other;
-       mso-font-pitch:fixed;
-       mso-font-signature:3 0 0 0 1 0;}
-  /* Style Definitions */
- p.MsoNormal, li.MsoNormal, div.MsoNormal
-       {mso-style-parent:"";
-       margin:0in;
-       margin-bottom:.0001pt;
-       mso-pagination:widow-orphan;
-       font-size:12.0pt;
-       font-family:"Times New Roman";
-       mso-fareast-font-family:"Times New Roman";}
- h3
-       {mso-style-next:Normal;
-       margin-top:12.0pt;
-       margin-right:0in;
-       margin-bottom:3.0pt;
-       margin-left:0in;
-       mso-pagination:widow-orphan;
-       page-break-after:avoid;
-       mso-outline-level:3;
-       font-size:13.0pt;
-       font-family:Arial;}
- p.MsoIndex1, li.MsoIndex1, div.MsoIndex1
-       {mso-style-update:auto;
-       mso-style-next:Normal;
-       margin-top:0in;
-       margin-right:0in;
-       margin-bottom:0in;
-       margin-left:12.0pt;
-       margin-bottom:.0001pt;
-       text-indent:-12.0pt;
-       mso-pagination:widow-orphan;
-       font-size:12.0pt;
-       font-family:"Times New Roman";
-       mso-fareast-font-family:"Times New Roman";}
- p.MsoIndex2, li.MsoIndex2, div.MsoIndex2
-       {mso-style-update:auto;
-       mso-style-next:Normal;
-       margin-top:0in;
-       margin-right:0in;
-       margin-bottom:0in;
-       margin-left:24.0pt;
-       margin-bottom:.0001pt;
-       text-indent:-12.0pt;
-       mso-pagination:widow-orphan;
-       font-size:12.0pt;
-       font-family:"Times New Roman";
-       mso-fareast-font-family:"Times New Roman";}
- p.MsoIndex3, li.MsoIndex3, div.MsoIndex3
-       {mso-style-update:auto;
-       mso-style-next:Normal;
-       margin-top:0in;
-       margin-right:0in;
-       margin-bottom:0in;
-       margin-left:.5in;
-       margin-bottom:.0001pt;
-       text-indent:-12.0pt;
-       mso-pagination:widow-orphan;
-       font-size:12.0pt;
-       font-family:"Times New Roman";
-       mso-fareast-font-family:"Times New Roman";}
- p.MsoIndex4, li.MsoIndex4, div.MsoIndex4
-       {mso-style-update:auto;
-       mso-style-next:Normal;
-       margin-top:0in;
-       margin-right:0in;
-       margin-bottom:0in;
-       margin-left:48.0pt;
-       margin-bottom:.0001pt;
-       text-indent:-12.0pt;
-       mso-pagination:widow-orphan;
-       font-size:12.0pt;
-       font-family:"Times New Roman";
-       mso-fareast-font-family:"Times New Roman";}
- p.MsoIndex5, li.MsoIndex5, div.MsoIndex5
-       {mso-style-update:auto;
-       mso-style-next:Normal;
-       margin-top:0in;
-       margin-right:0in;
-       margin-bottom:0in;
-       margin-left:60.0pt;
-       margin-bottom:.0001pt;
-       text-indent:-12.0pt;
-       mso-pagination:widow-orphan;
-       font-size:12.0pt;
-       font-family:"Times New Roman";
-       mso-fareast-font-family:"Times New Roman";}
- p.MsoIndex6, li.MsoIndex6, div.MsoIndex6
-       {mso-style-update:auto;
-       mso-style-next:Normal;
-       margin-top:0in;
-       margin-right:0in;
-       margin-bottom:0in;
-       margin-left:1.0in;
-       margin-bottom:.0001pt;
-       text-indent:-12.0pt;
-       mso-pagination:widow-orphan;
-       font-size:12.0pt;
-       font-family:"Times New Roman";
-       mso-fareast-font-family:"Times New Roman";}
- p.MsoIndex7, li.MsoIndex7, div.MsoIndex7
-       {mso-style-update:auto;
-       mso-style-next:Normal;
-       margin-top:0in;
-       margin-right:0in;
-       margin-bottom:0in;
-       margin-left:84.0pt;
-       margin-bottom:.0001pt;
-       text-indent:-12.0pt;
-       mso-pagination:widow-orphan;
-       font-size:12.0pt;
-       font-family:"Times New Roman";
-       mso-fareast-font-family:"Times New Roman";}
- p.MsoIndex8, li.MsoIndex8, div.MsoIndex8
-       {mso-style-update:auto;
-       mso-style-next:Normal;
-       margin-top:0in;
-       margin-right:0in;
-       margin-bottom:0in;
-       margin-left:96.0pt;
-       margin-bottom:.0001pt;
-       text-indent:-12.0pt;
-       mso-pagination:widow-orphan;
-       font-size:12.0pt;
-       font-family:"Times New Roman";
-       mso-fareast-font-family:"Times New Roman";}
- p.MsoIndex9, li.MsoIndex9, div.MsoIndex9
-       {mso-style-update:auto;
-       mso-style-next:Normal;
-       margin-top:0in;
-       margin-right:0in;
-       margin-bottom:0in;
-       margin-left:1.5in;
-       margin-bottom:.0001pt;
-       text-indent:-12.0pt;
-       mso-pagination:widow-orphan;
-       font-size:12.0pt;
-       font-family:"Times New Roman";
-       mso-fareast-font-family:"Times New Roman";}
- p.MsoToc1, li.MsoToc1, div.MsoToc1
-       {mso-style-update:auto;
-       mso-style-next:Normal;
-       margin:0in;
-       margin-bottom:.0001pt;
-       mso-pagination:widow-orphan;
-       font-size:12.0pt;
-       font-family:"Times New Roman";
-       mso-fareast-font-family:"Times New Roman";}
- p.MsoToc2, li.MsoToc2, div.MsoToc2
-       {mso-style-update:auto;
-       mso-style-next:Normal;
-       margin-top:0in;
-       margin-right:0in;
-       margin-bottom:0in;
-       margin-left:12.0pt;
-       margin-bottom:.0001pt;
-       mso-pagination:widow-orphan;
-       font-size:12.0pt;
-       font-family:"Times New Roman";
-       mso-fareast-font-family:"Times New Roman";}
- p.MsoToc3, li.MsoToc3, div.MsoToc3
-       {mso-style-update:auto;
-       mso-style-next:Normal;
-       margin-top:0in;
-       margin-right:0in;
-       margin-bottom:0in;
-       margin-left:24.0pt;
-       margin-bottom:.0001pt;
-       mso-pagination:widow-orphan;
-       font-size:12.0pt;
-       font-family:"Times New Roman";
-       mso-fareast-font-family:"Times New Roman";}
- p.MsoToc4, li.MsoToc4, div.MsoToc4
-       {mso-style-update:auto;
-       mso-style-next:Normal;
-       margin-top:0in;
-       margin-right:0in;
-       margin-bottom:0in;
-       margin-left:.5in;
-       margin-bottom:.0001pt;
-       mso-pagination:widow-orphan;
-       font-size:12.0pt;
-       font-family:"Times New Roman";
-       mso-fareast-font-family:"Times New Roman";}
- p.MsoToc5, li.MsoToc5, div.MsoToc5
-       {mso-style-update:auto;
-       mso-style-next:Normal;
-       margin-top:0in;
-       margin-right:0in;
-       margin-bottom:0in;
-       margin-left:48.0pt;
-       margin-bottom:.0001pt;
-       mso-pagination:widow-orphan;
-       font-size:12.0pt;
-       font-family:"Times New Roman";
-       mso-fareast-font-family:"Times New Roman";}
- p.MsoToc6, li.MsoToc6, div.MsoToc6
-       {mso-style-update:auto;
-       mso-style-next:Normal;
-       margin-top:0in;
-       margin-right:0in;
-       margin-bottom:0in;
-       margin-left:60.0pt;
-       margin-bottom:.0001pt;
-       mso-pagination:widow-orphan;
-       font-size:12.0pt;
-       font-family:"Times New Roman";
-       mso-fareast-font-family:"Times New Roman";}
- p.MsoToc7, li.MsoToc7, div.MsoToc7
-       {mso-style-update:auto;
-       mso-style-next:Normal;
-       margin-top:0in;
-       margin-right:0in;
-       margin-bottom:0in;
-       margin-left:1.0in;
-       margin-bottom:.0001pt;
-       mso-pagination:widow-orphan;
-       font-size:12.0pt;
-       font-family:"Times New Roman";
-       mso-fareast-font-family:"Times New Roman";}
- p.MsoToc8, li.MsoToc8, div.MsoToc8
-       {mso-style-update:auto;
-       mso-style-next:Normal;
-       margin-top:0in;
-       margin-right:0in;
-       margin-bottom:0in;
-       margin-left:84.0pt;
-       margin-bottom:.0001pt;
-       mso-pagination:widow-orphan;
-       font-size:12.0pt;
-       font-family:"Times New Roman";
-       mso-fareast-font-family:"Times New Roman";}
- p.MsoToc9, li.MsoToc9, div.MsoToc9
-       {mso-style-update:auto;
-       mso-style-next:Normal;
-       margin-top:0in;
-       margin-right:0in;
-       margin-bottom:0in;
-       margin-left:96.0pt;
-       margin-bottom:.0001pt;
-       mso-pagination:widow-orphan;
-       font-size:12.0pt;
-       font-family:"Times New Roman";
-       mso-fareast-font-family:"Times New Roman";}
- p.MsoIndexHeading, li.MsoIndexHeading, div.MsoIndexHeading
-       {mso-style-next:"Index 1";
-       margin:0in;
-       margin-bottom:.0001pt;
-       mso-pagination:widow-orphan;
-       font-size:12.0pt;
-       font-family:"Times New Roman";
-       mso-fareast-font-family:"Times New Roman";}
- p.MsoBodyText, li.MsoBodyText, div.MsoBodyText
-       {margin-top:0in;
-       margin-right:0in;
-       margin-bottom:12.0pt;
-       margin-left:0in;
-       line-height:14.4pt;
-       mso-pagination:widow-orphan;
-       font-size:10.0pt;
-       font-family:Courier;
-       mso-fareast-font-family:"Times New Roman";
-       mso-bidi-font-family:Arial;
-       color:black;}
- p.MsoBodyText2, li.MsoBodyText2, div.MsoBodyText2
-       {margin-top:0in;
-       margin-right:0in;
-       margin-bottom:12.0pt;
-       margin-left:0in;
-       mso-pagination:widow-orphan;
-       font-size:12.0pt;
-       mso-bidi-font-size:10.0pt;
-       font-family:Courier;
-       mso-fareast-font-family:"Times New Roman";
-       mso-bidi-font-family:Arial;
-       color:black;}
- a:link, span.MsoHyperlink
-       {color:blue;
-       text-decoration:underline;
-       text-underline:single;}
- a:visited, span.MsoHyperlinkFollowed
-       {color:purple;
-       text-decoration:underline;
-       text-underline:single;}
- @page Section1
-       {size:8.5in 11.0in;
-       margin:1.0in 1.25in 1.0in 1.25in;
-       mso-header-margin:.5in;
-       mso-footer-margin:.5in;
-       mso-paper-source:0;}
- div.Section1
-       {page:Section1;}
- -->
- </style>
- </head>
  
- <body lang=EN-US link=blue vlink=purple style='tab-interval:.5in'>
+ == Why isn’t Initialize setting my variables when the page is created? ==
  
- <div class=Section1>
+ Don’t worry; you aren’t the first person to make this mistake.  Initialize 
isn’t called when a page is created – it is called when a page is returned to 
the pool to be reused.  Initialize is not to be used to setup a page but 
instead return it to a pristine state so it can be recycled in the pool of 
available pages.  See the pageRenderListener interface if you want to setup 
state before a page is used.
  
+ == Where do I “initialize” values for a page? ==
- <p class=MsoToc3 style='tab-stops:right dotted 431.5pt'><!--[if 
supportFields]><span
- style='mso-element:field-begin'></span><span style="mso-spacerun:
- yes"> </span>TOC \o &quot;1-3&quot; \n \h \z <span 
style='mso-element:field-separator'></span><![endif]--><span
- class=MsoHyperlink><a href="#_Toc88480225">Where is the (some random HTML)
- component? (i.e. TD)</a></span><o:p></o:p></p>
  
+ You’ll probably want to use the pageRenderListener class to perform any work 
you need when the page is accessed.  Alternatively you can do some lazy 
initialization where objects are created the first time they are used.  This 
isn’t as clean as using Tapestry properties but it should work.  For example:
- <p class=MsoToc3 style='tab-stops:right dotted 431.5pt'><span
- class=MsoHyperlink><a href="#_Toc88480226">Why isn’t Initialize setting my
- variables when the page is created?</a></span><o:p></o:p></p>
  
+ AppointmentPage:
- <p class=MsoToc3 style='tab-stops:right dotted 431.5pt'><span
- class=MsoHyperlink><a href="#_Toc88480227">Where do I “initialize” values 
for a
- page?</a></span><o:p></o:p></p>
  
- <p class=MsoToc3 style='tab-stops:right dotted 431.5pt'><span
- class=MsoHyperlink><a href="#_Toc88480228">How do I use the pageRenderListener
- to setup my page before it is used?</a></span><o:p></o:p></p>
+ Protected Date date = null;
+ Public Date getEvent() {
+   if ( null == date ) {
+     date = new Date();
+   }
+   return date;
+ }
  
+ == How do I use the pageRenderListener to setup my page before it is used? ==
- <p class=MsoToc3 style='tab-stops:right dotted 431.5pt'><span
- class=MsoHyperlink><a href="#_Toc88480229">How do I pass information from page
- to page?</a></span><o:p></o:p></p>
  
+ Simply implement the PageRenderListener interface and override the 
pageBeginRender() routine.  Often times you can just call initialize() from 
pageBeginRender() to setup the page – your logic in both routines may be the 
same.
- <p class=MsoToc3 style='tab-stops:right dotted 431.5pt'><span
- class=MsoHyperlink><a href="#_Toc88480230">I just created a new page and now I
- get a 'class instantiation problem'.<span style="mso-spacerun: yes"> 
- </span>Why can’t it instantiate my class?</a></span><o:p></o:p></p>
  
+ public abstract class AppointmentPage extends BasePage implements 
PageRenderListener {
- <p class=MsoToc3 style='tab-stops:right dotted 431.5pt'><span
- class=MsoHyperlink><a href="#_Toc88480231">How can I share data across two
- Tapestry applications?</a></span><o:p></o:p></p>
  
- <p class=MsoToc3 style='tab-stops:right dotted 431.5pt'><span
- class=MsoHyperlink><a href="#_Toc88480232">What is 
Spindle?</a></span><o:p></o:p></p>
+ private Date date;
+ // this is called by Tapestry when the page is called up
+ public void pageBeginRender(PageEvent event) {
+       // do all your pre page processing here
+       date = new Date();
+ }
  
- <p class=MsoToc3 style='tab-stops:right dotted 431.5pt'><span
- class=MsoHyperlink><a href="#_Toc88480233">What are the jwcid=$content$ tags
- that Spindle places into my HTML files?</a></span><o:p></o:p></p>
+ // this is called by Tapestry before it is return to the pool for reuse
+ public void initialize() {
+       date = new Date();
+ }
  
+ == How do I pass information from page to page? ==
- <p class=MsoToc3 style='tab-stops:right dotted 431.5pt'><span
- class=MsoHyperlink><a href="#_Toc88480234">When would I use the $remove$ 
tag?</a></span><o:p></o:p></p>
  
+ You can use a Visit object to keep state from page to page but this is 
probably overkill and cumbersome if you just want to pass some information from 
one page to the next.  Instead you will want to create an instance of the next 
page, pass the parameter and then call (activate) the next page.  Here is some 
sample code:
- <p class=MsoToc3 style='tab-stops:right dotted 431.5pt'><span
- class=MsoHyperlink><a href="#_Toc88480235">Why is my Visit object always null
- or throws NoClassDefFound?</a></span><o:p></o:p></p>
  
- <p class=MsoToc3 style='tab-stops:right dotted 431.5pt'><span
- class=MsoHyperlink><a href="#_Toc88480236">How do I make a property in a
- Component persistent?</a></span><o:p></o:p></p>
+ Calling Page Java:
+ public void submitAction(IRequestCycle cycle) {
+   // The next page we want to go to is the Result page
+   AppointmentPage next_page = (AppointmentPage)cycle.getPage("Appointment");
+   next_page.setDate(new Date());
+   next_page.setEvent(“Birthday Party”);
+   cycle.activate(next_page);
+ }
  
- <p class=MsoNormal><!--[if supportFields]><span 
style='mso-element:field-end'></span><![endif]--><![if 
!supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>
+ Appointment Page:
+ <property-specification name="date" type="java.lang.Date" persistent="yes"/>
+ <property-specification name="event" type="java.lang.String" 
persistent="yes"/>
  
- <p class=MsoNormal><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>
+ Appointment Page Java:
+ public void setDate(Date date);
+ public void setEvent(String event); 
  
+ == I just created a new page and now I get a 'class instantiation problem'.  
Why can’t it instantiate my class? ==
- <h3><a name="_Toc88480213"></a><a name="_Toc88480225"><span 
style='mso-bookmark:
- _Toc88480213'>Where is the (some random HTML) component? (i.e. 
TD)</span></a></h3>
  
- <p class=MsoNormal><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>
+ Most likely you created your class abstract when it didn’t need to be.  
Tapestry doesn’t create an enhanced subclass if there are no 
<property-specification> elements.  A concrete class is never created by 
Tapestry in this case and since abstract classes cannot be instantiated, this 
exception pops up.  You either need to create a <property-specification> 
element or make your class concrete by removing the abstract identifier.
  
+ == How can I share data across two Tapestry applications? ==
- <p class=MsoNormal>Any component that does not have a direct Tapestry 
component
- can be represented with the Tapestry ANY component.<span style="mso-spacerun:
- yes">  </span>For example, say you want to have Tapestry generate the
- background color for your table using a TD component you could use &lt;td
- [EMAIL PROTECTED] bgcolor=”ognl:backgroundColor”&gt;&lt;/td&gt;.</p>
  
- <p class=MsoNormal><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>
+ Even if you’re running two Tapestry applications within the same Application 
Server (i.e. Tomcat) you can’t share data between them within the Application 
Server.  You can merge the two applications together into one application and 
then share data through singleton objects within the Application Server.  
Alternatively the two applications can share data at a lower level common 
level, i.e. the operating system (message passing) or a database.
  
+ == What is Spindle? ==
- <h3><a name="_Toc88480214"></a><a name="_Toc88480226"><span 
style='mso-bookmark:
- _Toc88480214'>Why isn’t Initialize setting my variables when the page is
- created?</span></a> </h3>
  
+ Spindle is a plugin for the Eclipse IDE.  Eclipse is available at 
www.eclipse.org and Spindle is available at spindle.sourceforge.net.  The 
Spindle adds intelligence about Tapestry into Eclipse.  The end result is an 
IDE that is aware of Tapestry Components and Pages by providing Wizard 
interfaces and navigation widgets for the creation and viewing of Tapestry 
Components and Pages.  It is well worth a look if you intend on developing with 
Tapestry.  Download Eclipse first and then install Spindle through the auto 
update feature of Eclipse.
- <p class=MsoNormal>Don’t worry; you aren’t the first person to make this
- mistake.<span style="mso-spacerun: yes">  </span>Initialize isn’t called 
when a
- page is created – it is called when a page is returned to the pool to be
- reused.<span style="mso-spacerun: yes">  </span>Initialize is not to be used 
to
- setup a page but instead return it to a pristine state so it can be recycled 
in
- the pool of available pages.<span style="mso-spacerun: yes">  </span>See the
- pageRenderListener interface if you want to setup state before a page is 
used.</p>
  
- <p class=MsoNormal><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>
+ == What are the jwcid=$content$ tags that Spindle places into my HTML files? 
==
  
+ Tapestry does not process any text outside of a <span 
jwcid=”$content$”></span>.  This allows a developer to place documentation, 
header files or static HTML (that should not be rendered by the Tapestry 
engine).  Spindle places these tags into the HTML out of convenience.  The can 
be deleted without any problems.
- <h3><a name="_Toc88480215"></a><a name="_Toc88480227"><span 
style='mso-bookmark:
- _Toc88480215'>Where do I “initialize” values for a page?</span></a></h3>
  
+ == When would I use the $remove$ tag? ==
- <p class=MsoNormal>You’ll probably want to use the pageRenderListener class 
to
- perform any work you need when the page is accessed.<span style="mso-spacerun:
- yes">  </span>Alternatively you can do some lazy initialization where objects
- are created the first time they are used.<span style="mso-spacerun: yes"> 
- </span>This isn’t as clean as using Tapestry properties but it should
- work.<span style="mso-spacerun: yes">  </span>For example:</p>
  
- <p class=MsoNormal><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>
+ The $remove$ tag is used as an aid to view static HTML pages.  The Tapestry 
Engine removes the tag and any text insert within when the page is rendered.  
This is useful when the text would otherwise be generated dynamically and an 
HTML designer needs to mock up the pages statically.  In the following example, 
three lines would be displayed when the page is statically viewed while the 
Tapestry Engine would render the one line dynamically when it is iterated 
through the Foreach component.
  
- <p class=MsoNormal>AppointmentPage:</p>
+ <table>
+ <tr jwcid=”employeeForeach”>
+   <td><span jwcid=”employeeName”>Jane</span></td>
+   <span jwcid=”$remove$”>
+   <td>Sally</td>
+   <td>Sue</td>
+   <span/>
+ </tr>
+ </table>
  
- <p class=MsoNormal><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>
+ == Why is my Visit object always null or throws NoClassDefFound? ==
  
- <p class=MsoNormal>Protected Date date = null;</p>
+ You might want to check that your Visit class is defined in the application 
specification.  If it is not defined you will run into problems when calling 
page.getVisit().  Make sure you put a fully qualified class name in the 
property.
  
- <p class=MsoNormal>Public Date getEvent() {</p>
+ MyApp.application:
+ <property name="org.apache.tapestry.visit-class" value="some.example.Visit" />
  
- <p class=MsoNormal><span style="mso-spacerun: yes">  </span>if ( null == 
date )
- {</p>
+ AppointmentPage.java:
+ Public void submit() {
+       // getVisit() will need to be casted to the defined Visit class
+       Some.example.Visit visit = (Some.example.Visit)getPage().getVisit();
+ }
  
+ == How do I make a property in a Component persistent? ==
- <p class=MsoNormal><span style="mso-spacerun: yes">    </span>date = new
- Date();</p>
  
- <p class=MsoNormal><span style="mso-spacerun: yes">  </span>}</p>
+ Pages support persistent properties so place the persistent property in the 
encompassing Page and pass it into the Component.  The property will remain 
persistent and be passed into the Component as a parameter.  The Component will 
need not know, or care, that the property is persistent.
  
- <p class=MsoNormal><span style="mso-spacerun: yes">  </span>return date;</p>
- 
- <p class=MsoNormal>}</p>
- 
- <p class=MsoNormal><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>
- 
- <h3><a name="_Toc88480216"></a><a name="_Toc88480228"><span 
style='mso-bookmark:
- _Toc88480216'>How do I use the pageRenderListener to setup my page before it 
is
- used?</span></a></h3>
- 
- <p class=MsoNormal>Simply implement the PageRenderListener interface and
- override the pageBeginRender() routine.<span style="mso-spacerun: yes"> 
- </span>Often times you can just call initialize() from pageBeginRender() to
- setup the page – your logic in both routines may be the same.</p>
- 
- <p class=MsoNormal><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>
- 
- <p class=MsoNormal>public abstract class AppointmentPage extends BasePage
- implements PageRenderListener {</p>
- 
- <p class=MsoNormal><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>
- 
- <p class=MsoNormal>private Date date;</p>
- 
- <p class=MsoNormal>// this is called by Tapestry when the page is called 
up</p>
- 
- <p class=MsoNormal>public void pageBeginRender(PageEvent event) {</p>
- 
- <p class=MsoNormal><span style='mso-tab-count:1'>            
</span>// do all
- your pre page processing here</p>
- 
- <p class=MsoNormal><span style='mso-tab-count:1'>            
</span>date = new
- Date();</p>
- 
- <p class=MsoNormal>}</p>
- 
- <p class=MsoNormal><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>
- 
- <p class=MsoNormal>// this is called by Tapestry before it is return to the
- pool for reuse</p>
- 
- <p class=MsoNormal>public void initialize() {</p>
- 
- <p class=MsoNormal><span style='mso-tab-count:1'>            
</span>date = new
- Date();</p>
- 
- <p class=MsoNormal>}</p>
- 
- <p class=MsoNormal><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>
- 
- <h3><a name="_Toc88480217"></a><a name="_Toc88480229"><span 
style='mso-bookmark:
- _Toc88480217'>How do I pass information from page to page?</span></a></h3>
- 
- <p class=MsoNormal>You can use a Visit object to keep state from page to page
- but this is probably overkill and cumbersome if you just want to pass some
- information from one page to the next.<span style="mso-spacerun: yes"> 
- </span>Instead you will want to create an instance of the next page, pass the
- parameter and then call (activate) the next page.<span style="mso-spacerun:
- yes">  </span>Here is some sample code:</p>
- 
- <p class=MsoNormal><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>
- 
- <p class=MsoNormal>Calling Page Java:</p>
- 
- <p class=MsoNormal>public void submitAction(IRequestCycle cycle) {</p>
- 
- <p class=MsoNormal>&nbsp; // The next page we want to go to is the Result 
page</p>
- 
- <p class=MsoNormal><span style="mso-spacerun: yes">  </span>AppointmentPage
- next_page = (AppointmentPage)cycle.getPage(&quot;Appointment&quot;);<br>
- &nbsp; next_page.setDate(new Date());</p>
- 
- <p class=MsoNormal><span style="mso-spacerun: yes"> 
- </span>next_page.setEvent(“Birthday Party”);</p>
- 
- <p class=MsoNormal><span style="mso-spacerun: yes"> 
- </span>cycle.activate(next_page);</p>
- 
- <p class=MsoNormal>}</p>
- 
- <p class=MsoNormal><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>
- 
- <p class=MsoNormal>Appointment Page:</p>
- 
- <p class=MsoNormal>&lt;property-specification name=&quot;date&quot;
- type=&quot;java.lang.Date&quot; persistent=&quot;yes&quot;/&gt;</p>
- 
- <p class=MsoNormal>&lt;property-specification name=&quot;event&quot;
- type=&quot;java.lang.String&quot; persistent=&quot;yes&quot;/&gt;</p>
- 
- <p class=MsoNormal><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>
- 
- <p class=MsoNormal>Appointment Page Java:</p>
- 
- <p class=MsoNormal>public void setDate(Date date);</p>
- 
- <p class=MsoNormal>public void setEvent(String event); </p>
- 
- <p class=MsoNormal><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>
- 
- <h3><a name="_Toc88480218"></a><a name="_Toc88480230"><span 
style='mso-bookmark:
- _Toc88480218'>I just created a new page and now I get a 'class instantiation
- problem'.<span style="mso-spacerun: yes">  </span>Why can’t it instantiate 
my
- class?</span></a></h3>
- 
- <p class=MsoNormal>Most likely you created your class abstract when it didn’t
- need to be.<span style="mso-spacerun: yes">  </span>Tapestry doesn’t create 
an
- enhanced subclass if there are no <span style='font-size:11.0pt;font-family:
- Arial;color:black'>&lt;property-specification&gt; elements.<span
- style="mso-spacerun: yes">  </span>A concrete class is never created by
- Tapestry in this case and since abstract classes cannot be instantiated, this
- exception pops up.<span style="mso-spacerun: yes">  </span>You either need to
- create a &lt;property-specification&gt; element or make your class concrete by
- removing the abstract identifier.<o:p></o:p></span></p>
- 
- <p class=MsoNormal><span 
style='font-size:11.0pt;font-family:Arial;color:black'><![if 
!supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></span></p>
- 
- <h3><a name="_Toc88480219"></a><a name="_Toc88480231"><span 
style='mso-bookmark:
- _Toc88480219'>How can I share data across two Tapestry 
applications?</span></a></h3>
- 
- <p class=MsoNormal>Even if you’re running two Tapestry applications within 
the
- same Application Server (i.e. Tomcat) you can’t share data between them 
within
- the Application Server.<span style="mso-spacerun: yes">  </span>You can merge
- the two applications together into one application and then share data through
- singleton objects within the Application Server.<span style="mso-spacerun:
- yes">  </span>Alternatively the two applications can share data at a lower
- level common level, i.e. the operating system (message passing) or a 
database.</p>
- 
- <p class=MsoNormal><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>
- 
- <h3><a name="_Toc88480220"></a><a name="_Toc88480232"><span 
style='mso-bookmark:
- _Toc88480220'>What is Spindle?</span></a></h3>
- 
- <p class=MsoNormal>Spindle is a plugin for the Eclipse IDE.<span
- style="mso-spacerun: yes">  </span>Eclipse is available at <a
- href="http://www.eclipse.org/";>www.eclipse.org</a> and Spindle is available at
- spindle.sourceforge.net.<span style="mso-spacerun: yes">  </span>The Spindle
- adds intelligence about Tapestry into Eclipse.<span style="mso-spacerun: 
yes"> 
- </span>The end result is an IDE that is aware of Tapestry Components and Pages
- by providing Wizard interfaces and navigation widgets for the creation and
- viewing of Tapestry Components and Pages.<span style="mso-spacerun: yes"> 
- </span>It is well worth a look if you intend on developing with Tapestry.<span
- style="mso-spacerun: yes">  </span>Download Eclipse first and then install
- Spindle through the auto update feature of Eclipse.</p>
- 
- <p class=MsoNormal><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>
- 
- <h3><a name="_Toc88480221"></a><a name="_Toc88480233"><span 
style='mso-bookmark:
- _Toc88480221'>What are the jwcid=$content$ tags that Spindle places into my
- HTML files?</span></a></h3>
- 
- <p class=MsoNormal>Tapestry does not process any text outside of a &lt;span
- jwcid=”$content$”&gt;&lt;/span&gt;.<span style="mso-spacerun: yes"> 
- </span>This allows a developer to place documentation, header files or static
- HTML (that should not be rendered by the Tapestry engine).<span
- style="mso-spacerun: yes">  </span>Spindle places these tags into the HTML 
out
- of convenience.<span style="mso-spacerun: yes">  </span>The can be deleted
- without any problems.</p>
- 
- <p class=MsoNormal><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>
- 
- <h3><a name="_Toc88480222"></a><a name="_Toc88480234"><span 
style='mso-bookmark:
- _Toc88480222'>When would I use the $remove$ tag?</span></a></h3>
- 
- <p class=MsoNormal>The $remove$ tag is used as an aid to view static HTML
- pages.<span style="mso-spacerun: yes">  </span>The Tapestry Engine removes 
the
- tag and any text insert within when the page is rendered.<span
- style="mso-spacerun: yes">  </span>This is useful when the text would 
otherwise
- be generated dynamically and an HTML designer needs to mock up the pages
- statically.<span style="mso-spacerun: yes">  </span>In the following example,
- three lines would be displayed when the page is statically viewed while the
- Tapestry Engine would render the one line dynamically when it is iterated
- through the Foreach component.</p>
- 
- <p class=MsoNormal><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>
- 
- <p class=MsoNormal>&lt;table&gt;</p>
- 
- <p class=MsoNormal>&lt;tr jwcid=”employeeForeach”&gt;</p>
- 
- <p class=MsoNormal><span style="mso-spacerun: yes">  
</span>&lt;td&gt;&lt;span
- jwcid=”employeeName”&gt;Jane&lt;/span&gt;&lt;/td&gt;</p>
- 
- <p class=MsoNormal><span style="mso-spacerun: yes">  </span>&lt;span
- jwcid=”$remove$”&gt;</p>
- 
- <p class=MsoNormal><span style="mso-spacerun: yes"> 
- </span>&lt;td&gt;Sally&lt;/td&gt;</p>
- 
- <p class=MsoNormal><span style="mso-spacerun: yes"> 
- </span>&lt;td&gt;Sue&lt;/td&gt;</p>
- 
- <p class=MsoNormal><span style="mso-spacerun: yes">  </span>&lt;span/&gt;</p>
- 
- <p class=MsoNormal>&lt;/tr&gt;</p>
- 
- <p class=MsoNormal>&lt;/table&gt;</p>
- 
- <p class=MsoNormal><span style="mso-spacerun: yes"> </span></p>
- 
- <h3><a name="_Toc88480223"></a><a name="_Toc88480235"><span 
style='mso-bookmark:
- _Toc88480223'>Why is my Visit object always null or throws 
NoClassDefFound?</span></a></h3>
- 
- <p class=MsoNormal>You might want to check that your Visit class is defined in
- the application specification.<span style="mso-spacerun: yes">  </span>If it 
is
- not defined you will run into problems when calling page.getVisit().<span
- style="mso-spacerun: yes">  </span>Make sure you put a fully qualified class
- name in the property.</p>
- 
- <p class=MsoNormal><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>
- 
- <p class=MsoNormal>MyApp.application:</p>
- 
- <p class=MsoNormal>&lt;property
- name=&quot;org.apache.tapestry.visit-class&quot; 
value=&quot;some.example.Visit&quot;
- /&gt;</p>
- 
- <p class=MsoNormal><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>
- 
- <p class=MsoNormal>AppointmentPage.java:</p>
- 
- <p class=MsoNormal>Public void submit() {</p>
- 
- <p class=MsoNormal><span style='mso-tab-count:1'>            
</span>//
- getVisit() will need to be casted to the defined Visit class</p>
- 
- <p class=MsoNormal><span style='mso-tab-count:1'>            
</span>Some.example.Visit
- visit = (Some.example.Visit)getPage().getVisit();</p>
- 
- <p class=MsoNormal>}</p>
- 
- <p class=MsoNormal><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>
- 
- <h3><a name="_Toc88480224"></a><a name="_Toc88480236"><span 
style='mso-bookmark:
- _Toc88480224'>How do I make a property in a Component 
persistent?</span></a></h3>
- 
- <p class=MsoNormal>Pages support persistent properties so place the persistent
- property in the encompassing Page and pass it into the Component.<span
- style="mso-spacerun: yes">  </span>The property will remain persistent and be
- passed into the Component as a parameter.<span style="mso-spacerun: yes"> 
- </span>The Component will need not know, or care, that the property is
- persistent.</p>
- 
- <p class=MsoNormal><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>
- 
- </div>
- 

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to