You are getting so close, expect the "Aha!" any moment.

Your Home.html includes the following:

     <span  jwcid="date">12-Nov-1999</span>

That means there's a component called date.  The name is arbitrary, it could
be "fred" as far as Tapestry is concerned.  The 12-Nob-1999 in the middle is
window dressing, and the fact that you used a <span> element is
inconsiquetal ... again, just window dressing.

Let's make the "date" component do something:  Add to the Home.jwc:

<component id="date" type="Insert">
  <binding name="value" property-path="date"/>
</component>

What this says to Tapestry is create an Insert component, and hook its value
parameter (which is the value it will write into the response page) up to a
property of the page ... in this case, the "date" property.

Side note:  I would have called this component "insertDate"; that is, try to
use a mneumonic name for what it does.

At runtime, when the Insert component renders, Tapestry will invoke
getDate() on the Home page (on the instance of Home.java) and provide that
value to the Insert component, which will write it into the response.

The other thing you are missing is that class Home should extends class
BasePage, not BaseComponent.  BasePage (that is,
net.sf.tapestry.html.BasePage in release 2.0.4) implements IComponent and
IPage.

Hope this gets you started; I would suggest going a little ways and then
exploring the Tutorials and Vlib in more detail.

----- Original Message -----
From: "Craig Gregory" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, May 30, 2002 2:51 PM
Subject: [Tapestry-developer] Accessing Component Properties


> I am trying to develop a component that will be the outermost
> wrapper/container in a web-application design:
>
>
> - ApplicationWrapper.jwc -
>
> <specification  class="_cwg$ais._JWC.ApplicationWrapper"
> allow-informal-parameters="no">
>
>     <parameter  name="title"  java-type="String"  required="yes">
>       <description>Application Title</description>
>     </parameter>
>
>     <component  id="tapestryInsertWrapped"  type="InsertWrapped" />
>
> </specification>
>
>
> - ApplicationWrapper.html -
>
> <span  jwcid="tapestryInsertWrapped" />
>
>
> - ApplicationWrapper.java -
>
> package _cwg$ais._JWC ;
>
> import com.primix.tapestry.BaseComponent ;
>
> public class ApplicationWrapper extends
> com.primix.tapestry.BaseComponent {
>
>     public java.util.Date getDate () {
>         return ( new java.util.Date () ) ;
>     }
> }
>
>
> And I am using this component in my "Home" page:
>
> - Home.jwc -
>
> <specification  class="_cwg$ais.CWDED.editor.Home" >
>
> <!-- -->
>
>     <component  id="jwcApplicationWrapper"  type="JWCApplicationWrapper"
> >
>         <static-binding  name="title">CWDED Editor</static-binding>
>     </component>
>
>     <component  id="jwcPageWrapper"  type="JWCPageWrapper" ></component>
>
> </specification>
>
>
>
>
> - Home.html -
>
> <span  jwcid="jwcApplicationWrapper">
> <span  jwcid="jwcPageWrapper">
>
>     CWDED Editor
>
> <!-- The problem -->
>     <span  jwcid="date">12-Nov-1999</span>
> <!-- -->
>
> </span>
> </span>
>
>
>
> - Home.java -
>
> package _cwg$ais.CWDED.editor ;
>
> import com.primix.tapestry.BaseComponent ;
>
> public class Homeextends com.primix.tapestry.BaseComponent {
> }
>
>
>
> ApplicationWrapper defines a JavaBeans property (getDate) right ?
>
> What do I place in ApplicationWrapper.jwc and/or Home.jwc to "bind" the
> property to the jwcid date ?
>
>
>
>
> Craig J. Gregory
> Dir. of Information Srevices
> Blue Mountain Community College
> PO Box 100
> 2411 NW Carden Av.
> Pendleton, OR 97801
> (541) 278-5825
>


_______________________________________________________________

Don't miss the 2002 Sprint PCS Application Developer's Conference
August 25-28 in Las Vegas -- http://devcon.sprintpcs.com/adp/index.cfm

_______________________________________________
Tapestry-developer mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/tapestry-developer

Reply via email to