So providing a number like '4' is illegal because it would indicate a method get4() (valid) and a property name (a class member) '4', which of course is illegal. T5 is just following the established naming convention here, and this too is documented.
Chris Lewis-5 wrote: > > > Thats it you get it (almost), you are right but tapestry is not try for > yourself > <t:count end="3" stext="4">Ho!</t:count> > will go with no complains at all, and thats what cofused me! > > But let's forget it now ,I've read with interest your nice Blog, > congratulations, I'll like to have your opinion about DataBase burden, > where to go?. For me the bigest problem is the once in a time called > "Impedance Problem" that is :how to make to seeparate worlds talk, but my > priority is that if someone needs sudenly to add a field in a database, a > field that of course will show up in my website; then the number of files > I have to modify should be the minimal. > > Thanks you again and 1) I read the docs 2) I not allways understand them > at first > Have a nice day > > > > > > maxthesecond wrote: >> Completely right sire >> although you have to admit than having defined the field >> >> @Parameter(required = true) >> private String _stext; >> >> 1)<t:count end="3" stext="4">Ho!</t:count> will go along (I declare a >> parameter of type string but... >> >> 2)<t:count end="3" stext="mytext">Ho!</t:count> will fail (I declare the >> same....) >> >> In both cases my attemt is to set up a string parameter in a component >> >> In my humble opinion it will be easy for newcomers not to have default >> prefix at all or recomend not to use it the first days till you know what >> you do and again in 1) it asumes that there are no strings containing >> numbers? is it no prop the default binding? it should complain either no >> get4 property() <-nonsense or error trying to asingn number to string >> but >> not simply let it go. >> > No, because T5 assumes that page classes follow the bean naming > conventions. So if you say 'mytext', the assumption is that the page > provides the method getMytext(), which ultimately points to the property > 'mytext.' So providing a number like '4' is illegal because it would > indicate a method get4() (valid) and a property name (a class member) > '4', which of course is illegal. T5 is just following the established > naming convention here, and this too is documented. > > I can't argue that newbies get tripped up on this (they do), but if they > would read the docs on writing a component, which is a perfectly logical > expectation for someone writing a component, they would quickly > understand. Now whether having the default prefix as 'prop' vs 'literal' > is better is just an opinion, but I personally agree with prop as the > default because in a real application it's generally more likely that > values will be pulled from object properties as opposed to hard-coded > strings. Again, this is just my opinion. > > good luck > > chris >> In what 2) concerns totally agree with you no prefix prop prefix..... >> >> Reading page 3 of component parameters helps a lot but some some more >> complete samples will have save a lot of time like a component showing >> all >> diferent usage of the binding params >> >> Thanks a lot for your explanation. >> >> >> >> >> >> >> >> >> >> Chris Lewis-5 wrote: >> >>> Max, >>> >>> The reason is actually quite simple. When you pass in values to >>> component parameters, tapestry interprets their values in the context of >>> binding prefix. If you create your own component with parameters and do >>> not specify a the binding prefix under which the value is to be >>> interpreted, the default is 'prop:' which means tapestry will look in >>> the containing page object for a bean-style method. So in your example >>> where you passed 'mytext' tapestry looked in your page instance >>> (org.compramaestra.pages.TreeDemo) for a method 'getMytext()', didn't >>> find it, and told you precisely why it failed. When you create your own >>> components you have control over the default binding prefix - the tricky >>> part is understanding which prefix would be the most generally used. All >>> of this is clearly documented here: >>> >>> http://tapestry.apache.org/tapestry5/tapestry-core/guide/parameters.html >>> >>> Now that you know how tapestry interprets values, it should be quite >>> clear why it interprets numbers as numbers and strings as various >>> things. The reason is that a number can't be used for a java identifier >>> (variables or methods), and therefore would never represent a method >>> (and thus a page property). Strings on the other hand, and represent a >>> myriad of things - literal text (literal:), a localized message >>> (message:), a page property (prop:), etc. >>> >>> hope that helps >>> >>> chris >>> >>> maxthesecond wrote: >>> >>>> allegedly longs from >>>> http://tapestry.formos.com/nightly/tapestry5/tapestry-core/guide/coercion.html >>>> and then Vm will turn them Ints....if not the lord itself, but >>>> nevertheless >>>> still puzzled , specially if I commplete your sentence: 'tapestry can >>>> interprete numerics as integer' but not strings as strings....... >>>> >>>> Regards and thank's again (don't be fooled by the message just some >>>> humor) >>>> >>>> >>>> >>>> >>>> Sven Homburg wrote: >>>> >>>> >>>>> tapestry can interprete numerics as integer (or long, im not sure) >>>>> >>>>> 2008/4/26 maxthesecond <[EMAIL PROTECTED]>: >>>>> >>>>> >>>>> >>>>>> wunderbar >>>>>> But still I'm lost in the space:why? I mean why integer values >>>>>> doesen't >>>>>> subdue to this literal rule?..well I see they are not literate... >>>>>> Infinite thanks I'll read again once more the documentation and try >>>>>> get >>>>>> it >>>>>> right in my mind. >>>>>> Thanks again. >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> Sven Homburg wrote: >>>>>> >>>>>> >>>>>>> you should use "literal:mytext" for parameter stext >>>>>>> without "literal" tapestry tries to interpret "mytext" >>>>>>> >>>>>>> 2008/4/26 maxthesecond <[EMAIL PROTECTED]>: >>>>>>> >>>>>>> >>>>>>> >>>>>>>> In the count sample component >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>> http://tapestry.formos.com/nightly/tapestry5/tapestry-core/guide/parameters.html >>>>>> >>>>>> >>>>>>>> public class Count >>>>>>>> { >>>>>>>> @Parameter >>>>>>>> private int _start = 1; >>>>>>>> >>>>>>>> @Parameter(required = true) >>>>>>>> private int _end; >>>>>>>> >>>>>>>> >>>>>>>> //added by me >>>>>>>> @Parameter(required = true) >>>>>>>> private String _stext; >>>>>>>> >>>>>>>> @Parameter >>>>>>>> private int _value; >>>>>>>> >>>>>>>> private boolean _increment; >>>>>>>> >>>>>>>> @SetupRender >>>>>>>> void initializeValue() >>>>>>>> { >>>>>>>> _value = _start; >>>>>>>> >>>>>>>> _increment = _start < _end; >>>>>>>> } >>>>>>>> >>>>>>>> @AfterRender >>>>>>>> boolean next() >>>>>>>> { >>>>>>>> if (_increment) >>>>>>>> { >>>>>>>> int newValue = _value + 1; >>>>>>>> >>>>>>>> if (newValue <= _end) >>>>>>>> { >>>>>>>> _value = newValue; >>>>>>>> return false; >>>>>>>> } >>>>>>>> } >>>>>>>> else >>>>>>>> { >>>>>>>> int newValue = _value - 1; >>>>>>>> >>>>>>>> if (newValue >= _end) >>>>>>>> { >>>>>>>> _value = newValue; >>>>>>>> return false; >>>>>>>> } >>>>>>>> } >>>>>>>> >>>>>>>> return true; >>>>>>>> } >>>>>>>> >>>>>>>> I added the stext parameter for the sake of test,you don't need >>>>>>>> even >>>>>>>> >>>>>>>> >>>>>> to >>>>>> >>>>>> >>>>>>>> declare getter and setter for parameters, in the page that uses the >>>>>>>> component you write down simply: >>>>>>>> >>>>>>>> <t:count end="3" stext="4">Ho!</t:count> >>>>>>>> >>>>>>>> and both parameters 'end' and 'stext' will go on with no >>>>>>>> problems.... >>>>>>>> >>>>>>>> but if I write >>>>>>>> >>>>>>>> <t:count end="3" stext="mytext">Ho!</t:count> >>>>>>>> >>>>>>>> then I get the following enlighting message: >>>>>>>> >>>>>>>> "Could not convert 'mytext' into a component parameter binding: >>>>>>>> Class >>>>>>>> org.compramaestra.pages.TreeDemo does not contain a property named >>>>>>>> 'mytext' >>>>>>>> (within property expression 'mytext'). Available properties: class, >>>>>>>> componentResources, message, node, treeNodes." >>>>>>>> >>>>>>>> So what? the argument is supposed to be the parameter? I'm totally >>>>>>>> >>>>>>>> >>>>>> lost >>>>>> >>>>>> >>>>>>>> ,bear in mind that >>>>>>>> >>>>>>>> <t:count end="3" stext="4">Ho!</t:count> does not complain at all >>>>>>>> >>>>>>>> >>>>>>>> Thanks a lot if any can save me! >>>>>>>> >>>>>>>> tapestry 5.0.11 >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> -- >>>>>>>> View this message in context: >>>>>>>> >>>>>>>> >>>>>>>> >>>>>> http://www.nabble.com/T5-Component-question-based-on-the-Count-component-in-documentation-tp16917580p16917580.html >>>>>> >>>>>> >>>>>>>> Sent from the Tapestry - User mailing list archive at Nabble.com. >>>>>>>> >>>>>>>> >>>>>>>> --------------------------------------------------------------------- >>>>>>>> To unsubscribe, e-mail: [EMAIL PROTECTED] >>>>>>>> For additional commands, e-mail: [EMAIL PROTECTED] >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>> -- >>>>>>> with regards >>>>>>> Sven Homburg >>>>>>> http://tapestry5-components.googlecode.com >>>>>>> >>>>>>> >>>>>>> ----- >>>>>>> best regards >>>>>>> Sven >>>>>>> >>>>>>> >>>>>>> >>>>>> -- >>>>>> View this message in context: >>>>>> http://www.nabble.com/T5-Component-question-based-on-the-Count-component-in-documentation-tp16917580p16917700.html >>>>>> Sent from the Tapestry - User mailing list archive at Nabble.com. >>>>>> >>>>>> >>>>>> --------------------------------------------------------------------- >>>>>> To unsubscribe, e-mail: [EMAIL PROTECTED] >>>>>> For additional commands, e-mail: [EMAIL PROTECTED] >>>>>> >>>>>> >>>>>> >>>>>> >>>>> -- >>>>> with regards >>>>> Sven Homburg >>>>> http://tapestry5-components.googlecode.com >>>>> >>>>> >>>>> ----- >>>>> best regards >>>>> Sven >>>>> >>>>> >>>>> >>>> >>>> >>> -- >>> http://thegodcode.net >>> >>> >>> >>> >> >> > > -- > http://thegodcode.net > > > -- View this message in context: http://www.nabble.com/T5-Component-question-based-on-the-Count-component-in-documentation-tp16917580p16922808.html Sent from the Tapestry - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]