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 <[EMAIL PROTECTED]> 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 <[EMAIL PROTECTED]> 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 <[EMAIL PROTECTED]> 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: [EMAIL PROTECTED] > >>>>>>> For additional commands, e-mail: [EMAIL PROTECTED] > >>>>>>> > >>>>>>> > >>>>>>> > >>>>>>> > >>>>>> -- > >>>>>> 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: [EMAIL PROTECTED] > >>>>>> For additional commands, e-mail: [EMAIL PROTECTED] > >>>>>> > >>>>>> > >>>>>> > >>>>> -- > >>>>> -- > >>>>> 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: [EMAIL PROTECTED] > >>>> For additional commands, e-mail: [EMAIL PROTECTED] > >>>> > >>>> > >>>> > >>> -- > >>> -- > >>> 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.