You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by ronaldlee <yi...@hotmail.com> on 2007/11/12 23:15:09 UTC
T5: How to access user-defined component's properties
Hi,
I wrote a simple component which contain a check list (using checkboxes). I
put it in a page where it has a function to listen to the submit event.
Inside my onSuccess function, how can I access that component's check list
that user has set?
thx.
Ronald
--
View this message in context: http://www.nabble.com/T5%3A-How-to-access-user-defined-component%27s-properties-tf4794190.html#a13715461
Sent from the Tapestry - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: T5: How to access user-defined component's properties
Posted by ronaldlee <yi...@hotmail.com>.
I just changed back to use my custom data struct and now seems to be
working, don't see those coercion exception anymore.. I believe it is caused
by me passing a Persist("flash") variable to the component's @Parameter. Now
I am returning a deep copy of that and is working now. Sorry for the false
alarm.
thx!
Ronald
Josh Canfield-2 wrote:
>
> No, that doesn't sound right. I pass other objects using @Parameter and
> have
> not had this problem. There shouldn't be a coercion when you are passing
> the
> parameter so my guess is that there is something else going on.
>
> Ronald, can you give us a small code example that shows the problem?
> Josh
> On Nov 13, 2007 11:08 AM, Chris Lewis <ch...@bellsouth.net> wrote:
>
>> That doesn't sound right. I haven't done this before, but surely you
>> don't have to do it like that. Can anyone chime in on this?
>>
>> ronaldlee wrote:
>> > I found out the issue. The getter function has to return "Object"
>> instead of
>> > my custom data type to work, in order words, @Parameter can only handle
>> > "Object", after that I can cast it back to my data type..
>> >
>> > Ronald
>> >
>> >
>> > ronaldlee wrote:
>> >
>> >> But when I tried to pass my own data structure, it throws an exception
>> >> like this:
>> >> ..
>> >> Could not find a coercion from type java.lang.String to type
>> >> com.xxx...MyDataStructure.
>> >>
>> >> Actually, MyDataStructure is quite complex, it contains some primitive
>> >> data types (byte,int,boolean), another custom data structure which
>> stores
>> >> a byte, and a list of yet another custom data structure, storing a
>> string
>> >> and a boolean. Not only that, MyDataStructure also extends a more
>> generic
>> >> data structure which has its own attributes as well...
>> >>
>> >> I think I tried the @Component approach, but the component doesn't
>> seem
>> to
>> >> have the stuff passed from the user when I try to access them in the
>> >> onSuccess function.. I will try again.
>> >>
>> >> thx!
>> >> Ronald
>> >>
>> >>
>> >> Josh Canfield-2 wrote:
>> >>
>> >>> Sorry, I was unclear in my cut and paste of your question.
>> >>>
>> >>> You can pass anything as a parameter.
>> >>>
>> >>> If you want to get access to your component in your page then define
>> an
>> >>> attribute with the right type and use the @Component annotation. Add
>> a
>> >>> getter to your component if you want to get something back out of it.
>> >>>
>> >>> @Component
>> >>> private MyComponent _component;
>> >>>
>> >>> Josh
>> >>> On Nov 12, 2007 4:00 PM, ronaldlee <yi...@hotmail.com> wrote:
>> >>>
>> >>>
>> >>>> So the @Parameter can only be used to passed user-defined data
>> structure
>> >>>> to
>> >>>> the custom component...
>> >>>>
>> >>>> Is there a way such that the page that displays the custom component
>> can
>> >>>> have access to the componet's properties (public getter functions)
>> in
>> >>>> order
>> >>>> to retrieve the user-defined data structure? For example, in the
>> page's
>> >>>> onSuccess method, I want to retrieve a List<MyDataStructure> from my
>> >>>> custom
>> >>>> component, how can I do that?
>> >>>>
>> >>>> thx!
>> >>>> Ronald
>> >>>>
>> >>>>
>> >>>> Josh Canfield-2 wrote:
>> >>>>
>> >>>>>> For @Parameter attributes of custom components, can it be
>> >>>>>>
>> >>>> user-defined
>> >>>>
>> >>>>>> data
>> >>>>>> structure? Or it has to be simple java-defined ones?
>> >>>>>>
>> >>>>>>
>> >>>>> Yes.
>> >>>>>
>> >>>>> <t:mycustomcomponent data="${customDataStructure}"/>
>> >>>>>
>> >>>>> Yes, but you don't need the ${}, the default binding is property
>> >>>>>
>> >>>>> <t:mycustomcomponent data="customDataStructure"/>
>> >>>>>
>> >>>>>
>> >>>>> Josh
>> >>>>>
>> >>>>> On Nov 12, 2007 3:01 PM, ronaldlee <yi...@hotmail.com> wrote:
>> >>>>>
>> >>>>>
>> >>>>>> For @Parameter attributes of custom components, can it be
>> >>>>>>
>> >>>> user-defined
>> >>>>
>> >>>>>> data
>> >>>>>> structure? Or it has to be simple java-defined ones?
>> >>>>>>
>> >>>>>> For example, can I have this in my custom component:
>> >>>>>>
>> >>>>>> @Parameter
>> >>>>>> MyOwnDataStructure data
>> >>>>>>
>> >>>>>> And in my main page I will feed that param using the page's
>> property
>> >>>>>> function
>> >>>>>>
>> >>>>>> <t:mycustomcomponent data="${customDataStructure}"/>
>> >>>>>>
>> >>>>>> where "getCustomDataStructure" of that page will return an
>> instance
>> >>>>>>
>> >>>> of
>> >>>>
>> >>>>>> MyOwnDataStructure?
>> >>>>>>
>> >>>>>> thx!
>> >>>>>> Ronald
>> >>>>>>
>> >>>>>>
>> >>>>>> Chris Lewis-5 wrote:
>> >>>>>>
>> >>>>>>> Ronald,
>> >>>>>>>
>> >>>>>>> Tapestry receives input (and fires events) using its Form
>> >>>>>>>
>> >>>> component,
>> >>>>
>> >>>>>>> which is used for creating html forms. Checkboxes are themselves
>> >>>>>>> components and are tied to boolean properties of the containing
>> >>>>>>>
>> >>>> page
>> >>>>
>> >>>>>> (or
>> >>>>>>
>> >>>>>>> component in your case). If you have declared the checkboxes as
>> >>>>>>>
>> >>>> 'raw'
>> >>>>
>> >>>>>>> html tags, you must first change those to proper tapestry
>> >>>>>>>
>> >>>> components
>> >>>>
>> >>>>>>> (
>> >>>>>>>
>> >>>>
>> http://tapestry.apache.org/tapestry5/tapestry-core/component-parameters.html#orgapachetapestrycorelibcomponentscheckbox
>> >>>>
>> >>>>>> ).
>> >>>>>>
>> >>>>>>> When you declare checkbox components you specify the value to
>> which
>> >>>>>>>
>> >>>> it
>> >>>>
>> >>>>>>> is tied. So if you have the following in your template:
>> >>>>>>>
>> >>>>>>> <input t:type="checkbox" value="wantsMail"/>
>> >>>>>>>
>> >>>>>>> Then you must have a boolean property named 'wantsMail' in your
>> >>>>>>> component/page class, with appropriate getters/setters
>> >>>>>>>
>> >>>> (getWantsMail,
>> >>>>
>> >>>>>>> setWantsMail).
>> >>>>>>>
>> >>>>>>> chris
>> >>>>>>>
>> >>>>>>> ronaldlee wrote:
>> >>>>>>>
>> >>>>>>>> Hi,
>> >>>>>>>>
>> >>>>>>>> I wrote a simple component which contain a check list (using
>> >>>>>>>>
>> >>>>>> checkboxes).
>> >>>>>>
>> >>>>>>>> I
>> >>>>>>>> put it in a page where it has a function to listen to the submit
>> >>>>>>>>
>> >>>>>> event.
>> >>>>>>
>> >>>>>>>> Inside my onSuccess function, how can I access that component's
>> >>>>>>>>
>> >>>> check
>> >>>>
>> >>>>>>>> list
>> >>>>>>>> that user has set?
>> >>>>>>>>
>> >>>>>>>> thx.
>> >>>>>>>> Ronald
>> >>>>>>>>
>> >>>>>>>>
>> >>>>>>>
>> >>>>>>>
>> >>>>
>> ---------------------------------------------------------------------
>> >>>>
>> >>>>>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> >>>>>>> For additional commands, e-mail: users-help@tapestry.apache.org
>> >>>>>>>
>> >>>>>>>
>> >>>>>>>
>> >>>>>>>
>> >>>>>> --
>> >>>>>> View this message in context:
>> >>>>>>
>> >>>>>>
>> >>>>
>> http://www.nabble.com/T5%3A-How-to-access-user-defined-component%27s-properties-tf4794190.html#a13716244
>> >>>>
>> >>>>>> Sent from the Tapestry - User mailing list archive at
>> >>>>>>
>> >>>> Nabble.com <http://nabble.com/><http://nabble.com/>
>> >>>> .
>> >>>>
>> >>>>>>
>> ---------------------------------------------------------------------
>> >>>>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> >>>>>> For additional commands, e-mail: users-help@tapestry.apache.org
>> >>>>>>
>> >>>>>>
>> >>>>>>
>> >>>>> --
>> >>>>> --
>> >>>>> TheDailyTube.com. Sign up and get the best new videos on the
>> internet
>> >>>>> delivered fresh to your inbox.
>> >>>>>
>> >>>>>
>> >>>>>
>> >>>> --
>> >>>> View this message in context:
>> >>>>
>> http://www.nabble.com/T5%3A-How-to-access-user-defined-component%27s-properties-tf4794190.html#a13717098
>> >>>> Sent from the Tapestry - User mailing list archive at
>> >>>> Nabble.com <http://nabble.com/><http://nabble.com/>
>> >>>> .
>> >>>>
>> >>>>
>> >>>>
>> ---------------------------------------------------------------------
>> >>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> >>>> For additional commands, e-mail: users-help@tapestry.apache.org
>> >>>>
>> >>>>
>> >>>>
>> >>> --
>> >>> --
>> >>> TheDailyTube.com. Sign up and get the best new videos on the internet
>> >>> delivered fresh to your inbox.
>> >>>
>> >>>
>> >>>
>> >>
>> >
>> >
>>
>>
>
>
> --
> --
> TheDailyTube.com. Sign up and get the best new videos on the internet
> delivered fresh to your inbox.
>
>
--
View this message in context: http://www.nabble.com/T5%3A-How-to-access-user-defined-component%27s-properties-tf4794190.html#a13737634
Sent from the Tapestry - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: T5: How to access user-defined component's properties
Posted by Josh Canfield <jo...@thedailytube.com>.
No, that doesn't sound right. I pass other objects using @Parameter and have
not had this problem. There shouldn't be a coercion when you are passing the
parameter so my guess is that there is something else going on.
Ronald, can you give us a small code example that shows the problem?
Josh
On Nov 13, 2007 11:08 AM, Chris Lewis <ch...@bellsouth.net> wrote:
> That doesn't sound right. I haven't done this before, but surely you
> don't have to do it like that. Can anyone chime in on this?
>
> ronaldlee wrote:
> > I found out the issue. The getter function has to return "Object"
> instead of
> > my custom data type to work, in order words, @Parameter can only handle
> > "Object", after that I can cast it back to my data type..
> >
> > Ronald
> >
> >
> > ronaldlee wrote:
> >
> >> But when I tried to pass my own data structure, it throws an exception
> >> like this:
> >> ..
> >> Could not find a coercion from type java.lang.String to type
> >> com.xxx...MyDataStructure.
> >>
> >> Actually, MyDataStructure is quite complex, it contains some primitive
> >> data types (byte,int,boolean), another custom data structure which
> stores
> >> a byte, and a list of yet another custom data structure, storing a
> string
> >> and a boolean. Not only that, MyDataStructure also extends a more
> generic
> >> data structure which has its own attributes as well...
> >>
> >> I think I tried the @Component approach, but the component doesn't seem
> to
> >> have the stuff passed from the user when I try to access them in the
> >> onSuccess function.. I will try again.
> >>
> >> thx!
> >> Ronald
> >>
> >>
> >> Josh Canfield-2 wrote:
> >>
> >>> Sorry, I was unclear in my cut and paste of your question.
> >>>
> >>> You can pass anything as a parameter.
> >>>
> >>> If you want to get access to your component in your page then define
> an
> >>> attribute with the right type and use the @Component annotation. Add
> a
> >>> getter to your component if you want to get something back out of it.
> >>>
> >>> @Component
> >>> private MyComponent _component;
> >>>
> >>> Josh
> >>> On Nov 12, 2007 4:00 PM, ronaldlee <yi...@hotmail.com> wrote:
> >>>
> >>>
> >>>> So the @Parameter can only be used to passed user-defined data
> structure
> >>>> to
> >>>> the custom component...
> >>>>
> >>>> Is there a way such that the page that displays the custom component
> can
> >>>> have access to the componet's properties (public getter functions) in
> >>>> order
> >>>> to retrieve the user-defined data structure? For example, in the
> page's
> >>>> onSuccess method, I want to retrieve a List<MyDataStructure> from my
> >>>> custom
> >>>> component, how can I do that?
> >>>>
> >>>> thx!
> >>>> Ronald
> >>>>
> >>>>
> >>>> Josh Canfield-2 wrote:
> >>>>
> >>>>>> For @Parameter attributes of custom components, can it be
> >>>>>>
> >>>> user-defined
> >>>>
> >>>>>> data
> >>>>>> structure? Or it has to be simple java-defined ones?
> >>>>>>
> >>>>>>
> >>>>> Yes.
> >>>>>
> >>>>> <t:mycustomcomponent data="${customDataStructure}"/>
> >>>>>
> >>>>> Yes, but you don't need the ${}, the default binding is property
> >>>>>
> >>>>> <t:mycustomcomponent data="customDataStructure"/>
> >>>>>
> >>>>>
> >>>>> Josh
> >>>>>
> >>>>> On Nov 12, 2007 3:01 PM, ronaldlee <yi...@hotmail.com> wrote:
> >>>>>
> >>>>>
> >>>>>> For @Parameter attributes of custom components, can it be
> >>>>>>
> >>>> user-defined
> >>>>
> >>>>>> data
> >>>>>> structure? Or it has to be simple java-defined ones?
> >>>>>>
> >>>>>> For example, can I have this in my custom component:
> >>>>>>
> >>>>>> @Parameter
> >>>>>> MyOwnDataStructure data
> >>>>>>
> >>>>>> And in my main page I will feed that param using the page's
> property
> >>>>>> function
> >>>>>>
> >>>>>> <t:mycustomcomponent data="${customDataStructure}"/>
> >>>>>>
> >>>>>> where "getCustomDataStructure" of that page will return an instance
> >>>>>>
> >>>> of
> >>>>
> >>>>>> MyOwnDataStructure?
> >>>>>>
> >>>>>> thx!
> >>>>>> Ronald
> >>>>>>
> >>>>>>
> >>>>>> Chris Lewis-5 wrote:
> >>>>>>
> >>>>>>> Ronald,
> >>>>>>>
> >>>>>>> Tapestry receives input (and fires events) using its Form
> >>>>>>>
> >>>> component,
> >>>>
> >>>>>>> which is used for creating html forms. Checkboxes are themselves
> >>>>>>> components and are tied to boolean properties of the containing
> >>>>>>>
> >>>> page
> >>>>
> >>>>>> (or
> >>>>>>
> >>>>>>> component in your case). If you have declared the checkboxes as
> >>>>>>>
> >>>> 'raw'
> >>>>
> >>>>>>> html tags, you must first change those to proper tapestry
> >>>>>>>
> >>>> components
> >>>>
> >>>>>>> (
> >>>>>>>
> >>>>
> http://tapestry.apache.org/tapestry5/tapestry-core/component-parameters.html#orgapachetapestrycorelibcomponentscheckbox
> >>>>
> >>>>>> ).
> >>>>>>
> >>>>>>> When you declare checkbox components you specify the value to
> which
> >>>>>>>
> >>>> it
> >>>>
> >>>>>>> is tied. So if you have the following in your template:
> >>>>>>>
> >>>>>>> <input t:type="checkbox" value="wantsMail"/>
> >>>>>>>
> >>>>>>> Then you must have a boolean property named 'wantsMail' in your
> >>>>>>> component/page class, with appropriate getters/setters
> >>>>>>>
> >>>> (getWantsMail,
> >>>>
> >>>>>>> setWantsMail).
> >>>>>>>
> >>>>>>> chris
> >>>>>>>
> >>>>>>> ronaldlee wrote:
> >>>>>>>
> >>>>>>>> Hi,
> >>>>>>>>
> >>>>>>>> I wrote a simple component which contain a check list (using
> >>>>>>>>
> >>>>>> checkboxes).
> >>>>>>
> >>>>>>>> I
> >>>>>>>> put it in a page where it has a function to listen to the submit
> >>>>>>>>
> >>>>>> event.
> >>>>>>
> >>>>>>>> Inside my onSuccess function, how can I access that component's
> >>>>>>>>
> >>>> check
> >>>>
> >>>>>>>> list
> >>>>>>>> that user has set?
> >>>>>>>>
> >>>>>>>> thx.
> >>>>>>>> Ronald
> >>>>>>>>
> >>>>>>>>
> >>>>>>>
> >>>>>>>
> >>>> ---------------------------------------------------------------------
> >>>>
> >>>>>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> >>>>>>> For additional commands, e-mail: users-help@tapestry.apache.org
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>> --
> >>>>>> View this message in context:
> >>>>>>
> >>>>>>
> >>>>
> http://www.nabble.com/T5%3A-How-to-access-user-defined-component%27s-properties-tf4794190.html#a13716244
> >>>>
> >>>>>> Sent from the Tapestry - User mailing list archive at
> >>>>>>
> >>>> Nabble.com <http://nabble.com/><http://nabble.com/>
> >>>> .
> >>>>
> >>>>>>
> ---------------------------------------------------------------------
> >>>>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> >>>>>> For additional commands, e-mail: users-help@tapestry.apache.org
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>> --
> >>>>> --
> >>>>> TheDailyTube.com. Sign up and get the best new videos on the
> internet
> >>>>> delivered fresh to your inbox.
> >>>>>
> >>>>>
> >>>>>
> >>>> --
> >>>> View this message in context:
> >>>>
> http://www.nabble.com/T5%3A-How-to-access-user-defined-component%27s-properties-tf4794190.html#a13717098
> >>>> Sent from the Tapestry - User mailing list archive at
> >>>> Nabble.com <http://nabble.com/><http://nabble.com/>
> >>>> .
> >>>>
> >>>>
> >>>> ---------------------------------------------------------------------
> >>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> >>>> For additional commands, e-mail: users-help@tapestry.apache.org
> >>>>
> >>>>
> >>>>
> >>> --
> >>> --
> >>> TheDailyTube.com. Sign up and get the best new videos on the internet
> >>> delivered fresh to your inbox.
> >>>
> >>>
> >>>
> >>
> >
> >
>
>
--
--
TheDailyTube.com. Sign up and get the best new videos on the internet
delivered fresh to your inbox.
Re: T5: How to access user-defined component's properties
Posted by Chris Lewis <ch...@bellsouth.net>.
That doesn't sound right. I haven't done this before, but surely you
don't have to do it like that. Can anyone chime in on this?
ronaldlee wrote:
> I found out the issue. The getter function has to return "Object" instead of
> my custom data type to work, in order words, @Parameter can only handle
> "Object", after that I can cast it back to my data type..
>
> Ronald
>
>
> ronaldlee wrote:
>
>> But when I tried to pass my own data structure, it throws an exception
>> like this:
>> ..
>> Could not find a coercion from type java.lang.String to type
>> com.xxx...MyDataStructure.
>>
>> Actually, MyDataStructure is quite complex, it contains some primitive
>> data types (byte,int,boolean), another custom data structure which stores
>> a byte, and a list of yet another custom data structure, storing a string
>> and a boolean. Not only that, MyDataStructure also extends a more generic
>> data structure which has its own attributes as well...
>>
>> I think I tried the @Component approach, but the component doesn't seem to
>> have the stuff passed from the user when I try to access them in the
>> onSuccess function.. I will try again.
>>
>> thx!
>> Ronald
>>
>>
>> Josh Canfield-2 wrote:
>>
>>> Sorry, I was unclear in my cut and paste of your question.
>>>
>>> You can pass anything as a parameter.
>>>
>>> If you want to get access to your component in your page then define an
>>> attribute with the right type and use the @Component annotation. Add a
>>> getter to your component if you want to get something back out of it.
>>>
>>> @Component
>>> private MyComponent _component;
>>>
>>> Josh
>>> On Nov 12, 2007 4:00 PM, ronaldlee <yi...@hotmail.com> wrote:
>>>
>>>
>>>> So the @Parameter can only be used to passed user-defined data structure
>>>> to
>>>> the custom component...
>>>>
>>>> Is there a way such that the page that displays the custom component can
>>>> have access to the componet's properties (public getter functions) in
>>>> order
>>>> to retrieve the user-defined data structure? For example, in the page's
>>>> onSuccess method, I want to retrieve a List<MyDataStructure> from my
>>>> custom
>>>> component, how can I do that?
>>>>
>>>> thx!
>>>> Ronald
>>>>
>>>>
>>>> Josh Canfield-2 wrote:
>>>>
>>>>>> For @Parameter attributes of custom components, can it be
>>>>>>
>>>> user-defined
>>>>
>>>>>> data
>>>>>> structure? Or it has to be simple java-defined ones?
>>>>>>
>>>>>>
>>>>> Yes.
>>>>>
>>>>> <t:mycustomcomponent data="${customDataStructure}"/>
>>>>>
>>>>> Yes, but you don't need the ${}, the default binding is property
>>>>>
>>>>> <t:mycustomcomponent data="customDataStructure"/>
>>>>>
>>>>>
>>>>> Josh
>>>>>
>>>>> On Nov 12, 2007 3:01 PM, ronaldlee <yi...@hotmail.com> wrote:
>>>>>
>>>>>
>>>>>> For @Parameter attributes of custom components, can it be
>>>>>>
>>>> user-defined
>>>>
>>>>>> data
>>>>>> structure? Or it has to be simple java-defined ones?
>>>>>>
>>>>>> For example, can I have this in my custom component:
>>>>>>
>>>>>> @Parameter
>>>>>> MyOwnDataStructure data
>>>>>>
>>>>>> And in my main page I will feed that param using the page's property
>>>>>> function
>>>>>>
>>>>>> <t:mycustomcomponent data="${customDataStructure}"/>
>>>>>>
>>>>>> where "getCustomDataStructure" of that page will return an instance
>>>>>>
>>>> of
>>>>
>>>>>> MyOwnDataStructure?
>>>>>>
>>>>>> thx!
>>>>>> Ronald
>>>>>>
>>>>>>
>>>>>> Chris Lewis-5 wrote:
>>>>>>
>>>>>>> Ronald,
>>>>>>>
>>>>>>> Tapestry receives input (and fires events) using its Form
>>>>>>>
>>>> component,
>>>>
>>>>>>> which is used for creating html forms. Checkboxes are themselves
>>>>>>> components and are tied to boolean properties of the containing
>>>>>>>
>>>> page
>>>>
>>>>>> (or
>>>>>>
>>>>>>> component in your case). If you have declared the checkboxes as
>>>>>>>
>>>> 'raw'
>>>>
>>>>>>> html tags, you must first change those to proper tapestry
>>>>>>>
>>>> components
>>>>
>>>>>>> (
>>>>>>>
>>>> http://tapestry.apache.org/tapestry5/tapestry-core/component-parameters.html#orgapachetapestrycorelibcomponentscheckbox
>>>>
>>>>>> ).
>>>>>>
>>>>>>> When you declare checkbox components you specify the value to which
>>>>>>>
>>>> it
>>>>
>>>>>>> is tied. So if you have the following in your template:
>>>>>>>
>>>>>>> <input t:type="checkbox" value="wantsMail"/>
>>>>>>>
>>>>>>> Then you must have a boolean property named 'wantsMail' in your
>>>>>>> component/page class, with appropriate getters/setters
>>>>>>>
>>>> (getWantsMail,
>>>>
>>>>>>> setWantsMail).
>>>>>>>
>>>>>>> chris
>>>>>>>
>>>>>>> ronaldlee wrote:
>>>>>>>
>>>>>>>> Hi,
>>>>>>>>
>>>>>>>> I wrote a simple component which contain a check list (using
>>>>>>>>
>>>>>> checkboxes).
>>>>>>
>>>>>>>> I
>>>>>>>> put it in a page where it has a function to listen to the submit
>>>>>>>>
>>>>>> event.
>>>>>>
>>>>>>>> Inside my onSuccess function, how can I access that component's
>>>>>>>>
>>>> check
>>>>
>>>>>>>> list
>>>>>>>> that user has set?
>>>>>>>>
>>>>>>>> thx.
>>>>>>>> Ronald
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>>
>>>> ---------------------------------------------------------------------
>>>>
>>>>>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>>>>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>> --
>>>>>> View this message in context:
>>>>>>
>>>>>>
>>>> http://www.nabble.com/T5%3A-How-to-access-user-defined-component%27s-properties-tf4794190.html#a13716244
>>>>
>>>>>> Sent from the Tapestry - User mailing list archive at
>>>>>>
>>>> Nabble.com<http://nabble.com/>
>>>> .
>>>>
>>>>>> ---------------------------------------------------------------------
>>>>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>>>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>>>>
>>>>>>
>>>>>>
>>>>> --
>>>>> --
>>>>> TheDailyTube.com. Sign up and get the best new videos on the internet
>>>>> delivered fresh to your inbox.
>>>>>
>>>>>
>>>>>
>>>> --
>>>> View this message in context:
>>>> http://www.nabble.com/T5%3A-How-to-access-user-defined-component%27s-properties-tf4794190.html#a13717098
>>>> Sent from the Tapestry - User mailing list archive at
>>>> Nabble.com<http://nabble.com/>
>>>> .
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>>
>>>>
>>>>
>>> --
>>> --
>>> TheDailyTube.com. Sign up and get the best new videos on the internet
>>> delivered fresh to your inbox.
>>>
>>>
>>>
>>
>
>
Re: T5: How to access user-defined component's properties
Posted by ronaldlee <yi...@hotmail.com>.
I found out the issue. The getter function has to return "Object" instead of
my custom data type to work, in order words, @Parameter can only handle
"Object", after that I can cast it back to my data type..
Ronald
ronaldlee wrote:
>
> But when I tried to pass my own data structure, it throws an exception
> like this:
> ..
> Could not find a coercion from type java.lang.String to type
> com.xxx...MyDataStructure.
>
> Actually, MyDataStructure is quite complex, it contains some primitive
> data types (byte,int,boolean), another custom data structure which stores
> a byte, and a list of yet another custom data structure, storing a string
> and a boolean. Not only that, MyDataStructure also extends a more generic
> data structure which has its own attributes as well...
>
> I think I tried the @Component approach, but the component doesn't seem to
> have the stuff passed from the user when I try to access them in the
> onSuccess function.. I will try again.
>
> thx!
> Ronald
>
>
> Josh Canfield-2 wrote:
>>
>> Sorry, I was unclear in my cut and paste of your question.
>>
>> You can pass anything as a parameter.
>>
>> If you want to get access to your component in your page then define an
>> attribute with the right type and use the @Component annotation. Add a
>> getter to your component if you want to get something back out of it.
>>
>> @Component
>> private MyComponent _component;
>>
>> Josh
>> On Nov 12, 2007 4:00 PM, ronaldlee <yi...@hotmail.com> wrote:
>>
>>>
>>>
>>> So the @Parameter can only be used to passed user-defined data structure
>>> to
>>> the custom component...
>>>
>>> Is there a way such that the page that displays the custom component can
>>> have access to the componet's properties (public getter functions) in
>>> order
>>> to retrieve the user-defined data structure? For example, in the page's
>>> onSuccess method, I want to retrieve a List<MyDataStructure> from my
>>> custom
>>> component, how can I do that?
>>>
>>> thx!
>>> Ronald
>>>
>>>
>>> Josh Canfield-2 wrote:
>>> >
>>> >> For @Parameter attributes of custom components, can it be
>>> user-defined
>>> >> data
>>> >> structure? Or it has to be simple java-defined ones?
>>> >>
>>> >
>>> > Yes.
>>> >
>>> > <t:mycustomcomponent data="${customDataStructure}"/>
>>> >>
>>> >
>>> > Yes, but you don't need the ${}, the default binding is property
>>> >
>>> > <t:mycustomcomponent data="customDataStructure"/>
>>> >
>>> >
>>> > Josh
>>> >
>>> > On Nov 12, 2007 3:01 PM, ronaldlee <yi...@hotmail.com> wrote:
>>> >
>>> >>
>>> >>
>>> >> For @Parameter attributes of custom components, can it be
>>> user-defined
>>> >> data
>>> >> structure? Or it has to be simple java-defined ones?
>>> >>
>>> >> For example, can I have this in my custom component:
>>> >>
>>> >> @Parameter
>>> >> MyOwnDataStructure data
>>> >>
>>> >> And in my main page I will feed that param using the page's property
>>> >> function
>>> >>
>>> >> <t:mycustomcomponent data="${customDataStructure}"/>
>>> >>
>>> >> where "getCustomDataStructure" of that page will return an instance
>>> of
>>> >> MyOwnDataStructure?
>>> >>
>>> >> thx!
>>> >> Ronald
>>> >>
>>> >>
>>> >> Chris Lewis-5 wrote:
>>> >> >
>>> >> > Ronald,
>>> >> >
>>> >> > Tapestry receives input (and fires events) using its Form
>>> component,
>>> >> > which is used for creating html forms. Checkboxes are themselves
>>> >> > components and are tied to boolean properties of the containing
>>> page
>>> >> (or
>>> >> > component in your case). If you have declared the checkboxes as
>>> 'raw'
>>> >> > html tags, you must first change those to proper tapestry
>>> components
>>> >> > (
>>> >>
>>> http://tapestry.apache.org/tapestry5/tapestry-core/component-parameters.html#orgapachetapestrycorelibcomponentscheckbox
>>> >> ).
>>> >> > When you declare checkbox components you specify the value to which
>>> it
>>> >> > is tied. So if you have the following in your template:
>>> >> >
>>> >> > <input t:type="checkbox" value="wantsMail"/>
>>> >> >
>>> >> > Then you must have a boolean property named 'wantsMail' in your
>>> >> > component/page class, with appropriate getters/setters
>>> (getWantsMail,
>>> >> > setWantsMail).
>>> >> >
>>> >> > chris
>>> >> >
>>> >> > ronaldlee wrote:
>>> >> >> Hi,
>>> >> >>
>>> >> >> I wrote a simple component which contain a check list (using
>>> >> checkboxes).
>>> >> >> I
>>> >> >> put it in a page where it has a function to listen to the submit
>>> >> event.
>>> >> >> Inside my onSuccess function, how can I access that component's
>>> check
>>> >> >> list
>>> >> >> that user has set?
>>> >> >>
>>> >> >> thx.
>>> >> >> Ronald
>>> >> >>
>>> >> >
>>> >> >
>>> >> >
>>> ---------------------------------------------------------------------
>>> >> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>> >> > For additional commands, e-mail: users-help@tapestry.apache.org
>>> >> >
>>> >> >
>>> >> >
>>> >>
>>> >> --
>>> >> View this message in context:
>>> >>
>>> http://www.nabble.com/T5%3A-How-to-access-user-defined-component%27s-properties-tf4794190.html#a13716244
>>> >> Sent from the Tapestry - User mailing list archive at
>>> Nabble.com<http://nabble.com/>
>>> .
>>> >>
>>> >>
>>> >> ---------------------------------------------------------------------
>>> >> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>> >> For additional commands, e-mail: users-help@tapestry.apache.org
>>> >>
>>> >>
>>> >
>>> >
>>> > --
>>> > --
>>> > TheDailyTube.com. Sign up and get the best new videos on the internet
>>> > delivered fresh to your inbox.
>>> >
>>> >
>>>
>>> --
>>> View this message in context:
>>> http://www.nabble.com/T5%3A-How-to-access-user-defined-component%27s-properties-tf4794190.html#a13717098
>>> Sent from the Tapestry - User mailing list archive at
>>> Nabble.com<http://nabble.com/>
>>> .
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>
>>>
>>
>>
>> --
>> --
>> TheDailyTube.com. Sign up and get the best new videos on the internet
>> delivered fresh to your inbox.
>>
>>
>
>
--
View this message in context: http://www.nabble.com/T5%3A-How-to-access-user-defined-component%27s-properties-tf4794190.html#a13732234
Sent from the Tapestry - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: T5: How to access user-defined component's properties
Posted by ronaldlee <yi...@hotmail.com>.
But when I tried to pass my own data structure, it throws an exception like
this:
..
Could not find a coercion from type java.lang.String to type
com.xxx...MyDataStructure.
Actually, MyDataStructure is quite complex, it contains some primitive data
types (byte,int,boolean), another custom data structure which stores a byte,
and a list of yet another custom data structure, storing a string and a
boolean. Not only that, MyDataStructure also extends a more generic data
structure which has its own attributes as well...
I think I tried the @Component approach, but the component doesn't seem to
have the stuff passed from the user when I try to access them in the
onSuccess function.. I will try again.
thx!
Ronald
Josh Canfield-2 wrote:
>
> Sorry, I was unclear in my cut and paste of your question.
>
> You can pass anything as a parameter.
>
> If you want to get access to your component in your page then define an
> attribute with the right type and use the @Component annotation. Add a
> getter to your component if you want to get something back out of it.
>
> @Component
> private MyComponent _component;
>
> Josh
> On Nov 12, 2007 4:00 PM, ronaldlee <yi...@hotmail.com> wrote:
>
>>
>>
>> So the @Parameter can only be used to passed user-defined data structure
>> to
>> the custom component...
>>
>> Is there a way such that the page that displays the custom component can
>> have access to the componet's properties (public getter functions) in
>> order
>> to retrieve the user-defined data structure? For example, in the page's
>> onSuccess method, I want to retrieve a List<MyDataStructure> from my
>> custom
>> component, how can I do that?
>>
>> thx!
>> Ronald
>>
>>
>> Josh Canfield-2 wrote:
>> >
>> >> For @Parameter attributes of custom components, can it be user-defined
>> >> data
>> >> structure? Or it has to be simple java-defined ones?
>> >>
>> >
>> > Yes.
>> >
>> > <t:mycustomcomponent data="${customDataStructure}"/>
>> >>
>> >
>> > Yes, but you don't need the ${}, the default binding is property
>> >
>> > <t:mycustomcomponent data="customDataStructure"/>
>> >
>> >
>> > Josh
>> >
>> > On Nov 12, 2007 3:01 PM, ronaldlee <yi...@hotmail.com> wrote:
>> >
>> >>
>> >>
>> >> For @Parameter attributes of custom components, can it be user-defined
>> >> data
>> >> structure? Or it has to be simple java-defined ones?
>> >>
>> >> For example, can I have this in my custom component:
>> >>
>> >> @Parameter
>> >> MyOwnDataStructure data
>> >>
>> >> And in my main page I will feed that param using the page's property
>> >> function
>> >>
>> >> <t:mycustomcomponent data="${customDataStructure}"/>
>> >>
>> >> where "getCustomDataStructure" of that page will return an instance of
>> >> MyOwnDataStructure?
>> >>
>> >> thx!
>> >> Ronald
>> >>
>> >>
>> >> Chris Lewis-5 wrote:
>> >> >
>> >> > Ronald,
>> >> >
>> >> > Tapestry receives input (and fires events) using its Form component,
>> >> > which is used for creating html forms. Checkboxes are themselves
>> >> > components and are tied to boolean properties of the containing page
>> >> (or
>> >> > component in your case). If you have declared the checkboxes as
>> 'raw'
>> >> > html tags, you must first change those to proper tapestry components
>> >> > (
>> >>
>> http://tapestry.apache.org/tapestry5/tapestry-core/component-parameters.html#orgapachetapestrycorelibcomponentscheckbox
>> >> ).
>> >> > When you declare checkbox components you specify the value to which
>> it
>> >> > is tied. So if you have the following in your template:
>> >> >
>> >> > <input t:type="checkbox" value="wantsMail"/>
>> >> >
>> >> > Then you must have a boolean property named 'wantsMail' in your
>> >> > component/page class, with appropriate getters/setters
>> (getWantsMail,
>> >> > setWantsMail).
>> >> >
>> >> > chris
>> >> >
>> >> > ronaldlee wrote:
>> >> >> Hi,
>> >> >>
>> >> >> I wrote a simple component which contain a check list (using
>> >> checkboxes).
>> >> >> I
>> >> >> put it in a page where it has a function to listen to the submit
>> >> event.
>> >> >> Inside my onSuccess function, how can I access that component's
>> check
>> >> >> list
>> >> >> that user has set?
>> >> >>
>> >> >> thx.
>> >> >> Ronald
>> >> >>
>> >> >
>> >> >
>> >> >
>> ---------------------------------------------------------------------
>> >> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> >> > For additional commands, e-mail: users-help@tapestry.apache.org
>> >> >
>> >> >
>> >> >
>> >>
>> >> --
>> >> View this message in context:
>> >>
>> http://www.nabble.com/T5%3A-How-to-access-user-defined-component%27s-properties-tf4794190.html#a13716244
>> >> Sent from the Tapestry - User mailing list archive at
>> Nabble.com<http://nabble.com/>
>> .
>> >>
>> >>
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> >> For additional commands, e-mail: users-help@tapestry.apache.org
>> >>
>> >>
>> >
>> >
>> > --
>> > --
>> > TheDailyTube.com. Sign up and get the best new videos on the internet
>> > delivered fresh to your inbox.
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/T5%3A-How-to-access-user-defined-component%27s-properties-tf4794190.html#a13717098
>> Sent from the Tapestry - User mailing list archive at
>> Nabble.com<http://nabble.com/>
>> .
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
>
>
> --
> --
> TheDailyTube.com. Sign up and get the best new videos on the internet
> delivered fresh to your inbox.
>
>
--
View this message in context: http://www.nabble.com/T5%3A-How-to-access-user-defined-component%27s-properties-tf4794190.html#a13717604
Sent from the Tapestry - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: T5: How to access user-defined component's properties
Posted by Josh Canfield <jo...@thedailytube.com>.
Sorry, I was unclear in my cut and paste of your question.
You can pass anything as a parameter.
If you want to get access to your component in your page then define an
attribute with the right type and use the @Component annotation. Add a
getter to your component if you want to get something back out of it.
@Component
private MyComponent _component;
Josh
On Nov 12, 2007 4:00 PM, ronaldlee <yi...@hotmail.com> wrote:
>
>
> So the @Parameter can only be used to passed user-defined data structure
> to
> the custom component...
>
> Is there a way such that the page that displays the custom component can
> have access to the componet's properties (public getter functions) in
> order
> to retrieve the user-defined data structure? For example, in the page's
> onSuccess method, I want to retrieve a List<MyDataStructure> from my
> custom
> component, how can I do that?
>
> thx!
> Ronald
>
>
> Josh Canfield-2 wrote:
> >
> >> For @Parameter attributes of custom components, can it be user-defined
> >> data
> >> structure? Or it has to be simple java-defined ones?
> >>
> >
> > Yes.
> >
> > <t:mycustomcomponent data="${customDataStructure}"/>
> >>
> >
> > Yes, but you don't need the ${}, the default binding is property
> >
> > <t:mycustomcomponent data="customDataStructure"/>
> >
> >
> > Josh
> >
> > On Nov 12, 2007 3:01 PM, ronaldlee <yi...@hotmail.com> wrote:
> >
> >>
> >>
> >> For @Parameter attributes of custom components, can it be user-defined
> >> data
> >> structure? Or it has to be simple java-defined ones?
> >>
> >> For example, can I have this in my custom component:
> >>
> >> @Parameter
> >> MyOwnDataStructure data
> >>
> >> And in my main page I will feed that param using the page's property
> >> function
> >>
> >> <t:mycustomcomponent data="${customDataStructure}"/>
> >>
> >> where "getCustomDataStructure" of that page will return an instance of
> >> MyOwnDataStructure?
> >>
> >> thx!
> >> Ronald
> >>
> >>
> >> Chris Lewis-5 wrote:
> >> >
> >> > Ronald,
> >> >
> >> > Tapestry receives input (and fires events) using its Form component,
> >> > which is used for creating html forms. Checkboxes are themselves
> >> > components and are tied to boolean properties of the containing page
> >> (or
> >> > component in your case). If you have declared the checkboxes as 'raw'
> >> > html tags, you must first change those to proper tapestry components
> >> > (
> >>
> http://tapestry.apache.org/tapestry5/tapestry-core/component-parameters.html#orgapachetapestrycorelibcomponentscheckbox
> >> ).
> >> > When you declare checkbox components you specify the value to which
> it
> >> > is tied. So if you have the following in your template:
> >> >
> >> > <input t:type="checkbox" value="wantsMail"/>
> >> >
> >> > Then you must have a boolean property named 'wantsMail' in your
> >> > component/page class, with appropriate getters/setters (getWantsMail,
> >> > setWantsMail).
> >> >
> >> > chris
> >> >
> >> > ronaldlee wrote:
> >> >> Hi,
> >> >>
> >> >> I wrote a simple component which contain a check list (using
> >> checkboxes).
> >> >> I
> >> >> put it in a page where it has a function to listen to the submit
> >> event.
> >> >> Inside my onSuccess function, how can I access that component's
> check
> >> >> list
> >> >> that user has set?
> >> >>
> >> >> thx.
> >> >> Ronald
> >> >>
> >> >
> >> >
> >> > ---------------------------------------------------------------------
> >> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> >> > For additional commands, e-mail: users-help@tapestry.apache.org
> >> >
> >> >
> >> >
> >>
> >> --
> >> View this message in context:
> >>
> http://www.nabble.com/T5%3A-How-to-access-user-defined-component%27s-properties-tf4794190.html#a13716244
> >> Sent from the Tapestry - User mailing list archive at Nabble.com<http://nabble.com/>
> .
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> >> For additional commands, e-mail: users-help@tapestry.apache.org
> >>
> >>
> >
> >
> > --
> > --
> > TheDailyTube.com. Sign up and get the best new videos on the internet
> > delivered fresh to your inbox.
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/T5%3A-How-to-access-user-defined-component%27s-properties-tf4794190.html#a13717098
> Sent from the Tapestry - User mailing list archive at Nabble.com<http://nabble.com/>
> .
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
--
--
TheDailyTube.com. Sign up and get the best new videos on the internet
delivered fresh to your inbox.
Re: T5: How to access user-defined component's properties
Posted by ronaldlee <yi...@hotmail.com>.
So the @Parameter can only be used to passed user-defined data structure to
the custom component...
Is there a way such that the page that displays the custom component can
have access to the componet's properties (public getter functions) in order
to retrieve the user-defined data structure? For example, in the page's
onSuccess method, I want to retrieve a List<MyDataStructure> from my custom
component, how can I do that?
thx!
Ronald
Josh Canfield-2 wrote:
>
>> For @Parameter attributes of custom components, can it be user-defined
>> data
>> structure? Or it has to be simple java-defined ones?
>>
>
> Yes.
>
> <t:mycustomcomponent data="${customDataStructure}"/>
>>
>
> Yes, but you don't need the ${}, the default binding is property
>
> <t:mycustomcomponent data="customDataStructure"/>
>
>
> Josh
>
> On Nov 12, 2007 3:01 PM, ronaldlee <yi...@hotmail.com> wrote:
>
>>
>>
>> For @Parameter attributes of custom components, can it be user-defined
>> data
>> structure? Or it has to be simple java-defined ones?
>>
>> For example, can I have this in my custom component:
>>
>> @Parameter
>> MyOwnDataStructure data
>>
>> And in my main page I will feed that param using the page's property
>> function
>>
>> <t:mycustomcomponent data="${customDataStructure}"/>
>>
>> where "getCustomDataStructure" of that page will return an instance of
>> MyOwnDataStructure?
>>
>> thx!
>> Ronald
>>
>>
>> Chris Lewis-5 wrote:
>> >
>> > Ronald,
>> >
>> > Tapestry receives input (and fires events) using its Form component,
>> > which is used for creating html forms. Checkboxes are themselves
>> > components and are tied to boolean properties of the containing page
>> (or
>> > component in your case). If you have declared the checkboxes as 'raw'
>> > html tags, you must first change those to proper tapestry components
>> > (
>> http://tapestry.apache.org/tapestry5/tapestry-core/component-parameters.html#orgapachetapestrycorelibcomponentscheckbox
>> ).
>> > When you declare checkbox components you specify the value to which it
>> > is tied. So if you have the following in your template:
>> >
>> > <input t:type="checkbox" value="wantsMail"/>
>> >
>> > Then you must have a boolean property named 'wantsMail' in your
>> > component/page class, with appropriate getters/setters (getWantsMail,
>> > setWantsMail).
>> >
>> > chris
>> >
>> > ronaldlee wrote:
>> >> Hi,
>> >>
>> >> I wrote a simple component which contain a check list (using
>> checkboxes).
>> >> I
>> >> put it in a page where it has a function to listen to the submit
>> event.
>> >> Inside my onSuccess function, how can I access that component's check
>> >> list
>> >> that user has set?
>> >>
>> >> thx.
>> >> Ronald
>> >>
>> >
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> > For additional commands, e-mail: users-help@tapestry.apache.org
>> >
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/T5%3A-How-to-access-user-defined-component%27s-properties-tf4794190.html#a13716244
>> Sent from the Tapestry - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
>
>
> --
> --
> TheDailyTube.com. Sign up and get the best new videos on the internet
> delivered fresh to your inbox.
>
>
--
View this message in context: http://www.nabble.com/T5%3A-How-to-access-user-defined-component%27s-properties-tf4794190.html#a13717098
Sent from the Tapestry - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: T5: How to access user-defined component's properties
Posted by Josh Canfield <jo...@thedailytube.com>.
> For @Parameter attributes of custom components, can it be user-defined
> data
> structure? Or it has to be simple java-defined ones?
>
Yes.
<t:mycustomcomponent data="${customDataStructure}"/>
>
Yes, but you don't need the ${}, the default binding is property
<t:mycustomcomponent data="customDataStructure"/>
Josh
On Nov 12, 2007 3:01 PM, ronaldlee <yi...@hotmail.com> wrote:
>
>
> For @Parameter attributes of custom components, can it be user-defined
> data
> structure? Or it has to be simple java-defined ones?
>
> For example, can I have this in my custom component:
>
> @Parameter
> MyOwnDataStructure data
>
> And in my main page I will feed that param using the page's property
> function
>
> <t:mycustomcomponent data="${customDataStructure}"/>
>
> where "getCustomDataStructure" of that page will return an instance of
> MyOwnDataStructure?
>
> thx!
> Ronald
>
>
> Chris Lewis-5 wrote:
> >
> > Ronald,
> >
> > Tapestry receives input (and fires events) using its Form component,
> > which is used for creating html forms. Checkboxes are themselves
> > components and are tied to boolean properties of the containing page (or
> > component in your case). If you have declared the checkboxes as 'raw'
> > html tags, you must first change those to proper tapestry components
> > (
> http://tapestry.apache.org/tapestry5/tapestry-core/component-parameters.html#orgapachetapestrycorelibcomponentscheckbox
> ).
> > When you declare checkbox components you specify the value to which it
> > is tied. So if you have the following in your template:
> >
> > <input t:type="checkbox" value="wantsMail"/>
> >
> > Then you must have a boolean property named 'wantsMail' in your
> > component/page class, with appropriate getters/setters (getWantsMail,
> > setWantsMail).
> >
> > chris
> >
> > ronaldlee wrote:
> >> Hi,
> >>
> >> I wrote a simple component which contain a check list (using
> checkboxes).
> >> I
> >> put it in a page where it has a function to listen to the submit event.
> >> Inside my onSuccess function, how can I access that component's check
> >> list
> >> that user has set?
> >>
> >> thx.
> >> Ronald
> >>
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > For additional commands, e-mail: users-help@tapestry.apache.org
> >
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/T5%3A-How-to-access-user-defined-component%27s-properties-tf4794190.html#a13716244
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
--
--
TheDailyTube.com. Sign up and get the best new videos on the internet
delivered fresh to your inbox.
Re: T5: How to access user-defined component's properties
Posted by ronaldlee <yi...@hotmail.com>.
For @Parameter attributes of custom components, can it be user-defined data
structure? Or it has to be simple java-defined ones?
For example, can I have this in my custom component:
@Parameter
MyOwnDataStructure data
And in my main page I will feed that param using the page's property
function
<t:mycustomcomponent data="${customDataStructure}"/>
where "getCustomDataStructure" of that page will return an instance of
MyOwnDataStructure?
thx!
Ronald
Chris Lewis-5 wrote:
>
> Ronald,
>
> Tapestry receives input (and fires events) using its Form component,
> which is used for creating html forms. Checkboxes are themselves
> components and are tied to boolean properties of the containing page (or
> component in your case). If you have declared the checkboxes as 'raw'
> html tags, you must first change those to proper tapestry components
> (http://tapestry.apache.org/tapestry5/tapestry-core/component-parameters.html#orgapachetapestrycorelibcomponentscheckbox).
> When you declare checkbox components you specify the value to which it
> is tied. So if you have the following in your template:
>
> <input t:type="checkbox" value="wantsMail"/>
>
> Then you must have a boolean property named 'wantsMail' in your
> component/page class, with appropriate getters/setters (getWantsMail,
> setWantsMail).
>
> chris
>
> ronaldlee wrote:
>> Hi,
>>
>> I wrote a simple component which contain a check list (using checkboxes).
>> I
>> put it in a page where it has a function to listen to the submit event.
>> Inside my onSuccess function, how can I access that component's check
>> list
>> that user has set?
>>
>> thx.
>> Ronald
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
>
--
View this message in context: http://www.nabble.com/T5%3A-How-to-access-user-defined-component%27s-properties-tf4794190.html#a13716244
Sent from the Tapestry - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: T5: How to access user-defined component's properties
Posted by Chris Lewis <ch...@bellsouth.net>.
Ronald,
Tapestry receives input (and fires events) using its Form component,
which is used for creating html forms. Checkboxes are themselves
components and are tied to boolean properties of the containing page (or
component in your case). If you have declared the checkboxes as 'raw'
html tags, you must first change those to proper tapestry components
(http://tapestry.apache.org/tapestry5/tapestry-core/component-parameters.html#orgapachetapestrycorelibcomponentscheckbox).
When you declare checkbox components you specify the value to which it
is tied. So if you have the following in your template:
<input t:type="checkbox" value="wantsMail"/>
Then you must have a boolean property named 'wantsMail' in your
component/page class, with appropriate getters/setters (getWantsMail,
setWantsMail).
chris
ronaldlee wrote:
> Hi,
>
> I wrote a simple component which contain a check list (using checkboxes). I
> put it in a page where it has a function to listen to the submit event.
> Inside my onSuccess function, how can I access that component's check list
> that user has set?
>
> thx.
> Ronald
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org