When i say page, i mean page object which implements the IPage
interface. This object embeds your component. So, you need to have
something like that :
In your page java code, you need to declare a property which will be
persistent to store the information between different calls :
@Persist
public abstract void setMyProperty(Object myProperty)
public abstract Object getMyProperty()
(I've put a property of generic type Object but, of course, it could be
of any type.)
In your component java code, you have to declare your parameter :
@Parameter
public abstract void setMyParameter(Object myParameter)
public abstract Object getMyParameter()
The last thing you need to do is to bind the persistent property of your
page in the parameter of your component. That can be done in your html
page, in the .page file or inthe java code using annotations. Let's say
your component is called MyComponent, you should have for instance in
your .page file, somthing like that :
<component id="myComponent" type="MyComponent">
<binding name="myParameter" value="ognl:myProperty"/>
</component>
Hope that will help you
--
Stéphane Decleire
Ken nashua a écrit :
Stephanie, where in the docs does it explain this?
Are you referring to the template or a *.page file? please clarify.
Also, if my component is the originating source of these attributes
(FileUpload.filename which means, there is no page to generate them or
model to acquire this from) then how do you rationalize this usage as
you described?
The problem with the binding is that the data members of the object
have no where to live. @Persist accomplishes this.
Best regards
Ken in nashua
ou should not use <at> Persist in your component : <at> Persist
should be used n the page and passed to the component as a parameter !
-
téphane Decleire
----Original Message Follows----
From: "Ken nashua" <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED], users@tapestry.apache.org
Subject: RE: tapestry-4.0.2 @Parameter : required = true (template
binding)
Date: Tue, 23 Jan 2007 12:21:35 -0500
Thanks, @Persist binded my properties to the session as they had no
where to be stored.
Not sure how useful @Parameter will be. The cache attribute was
misleading.... When would you want to use this annotation?
Best regards
Ken in nashua
----Original Message Follows----
From: "Ken nashua" <[EMAIL PROTECTED]>
To: users@tapestry.apache.org
CC: [EMAIL PROTECTED]
Subject: tapestry-4.0.2 @Parameter : required = true (template binding)
Date: Tue, 23 Jan 2007 10:43:55 -0500
Folks,
I created a component.
TEMPLATE
<span jwcid="$content$">
<input jwcid="@Upload" file="ognl:file" type="file" displayName="File"
fileName="ognl:fileName" />
</span>
CLASS
public abstract class MyComponent extends BaseComponent {
@Parameter(required = true, cache = true)
public abstract String getFileName();
public abstract void setFileName(String fileName);
}
SPEC
<component-specification class="org.MyComponent"
allow-body="yes"
allow-informal-parameters="yes"/>
But I continue to receive this...
org.apache.hivemind.ApplicationRuntimeException
Required parameter fileName of component
trails:Editors/blobFields.$TrailsUpload is not bound.
My pom.xml uses
<dependency>
<groupId>tapestry</groupId>
<artifactId>tapestry</artifactId>
<version>4.0.2</version>
</dependency>
<dependency>
<groupId>tapestry</groupId>
<artifactId>tapestry-annotations</artifactId>
<version>4.0.2</version>
</dependency>
I defined fileName as ognl binding in the template...
Can someone explain this?
Best regards
Ken in nashua
_________________________________________________________________
The MSN Entertainment Guide to Golden Globes is here. Get all the
scoop. http://tv.msn.com/tv/globes2007/?icid=nctagline2
_________________________________________________________________
Valentine's Day -- Shop for gifts that spell L-O-V-E at MSN Shopping
http://shopping.msn.com/content/shp/?ctId=8323,ptnrid=37,ptnrdata=24095&tcode=wlmtagline
_________________________________________________________________
Get in the mood for Valentine's Day. View photos, recipes and more on
your Live.com page.
http://www.live.com/?addTemplate=ValentinesDay&ocid=T001MSN30A0701
_________________________________________________________________
Type your favorite song. Get a customized station. Try MSN Radio
powered by Pandora. http://radio.msn.com/?icid=T002MSN03A07001
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]