Spot on! Now I also understand why the .tml passing didn't work. This is
a great 'a-ha' moment for me!

-J.
On Fri, 2008-04-18 at 17:03 +0200, Chris Lewis wrote:
> Ok I think I see the problem. In your layout replace this:
> 
> t:breadCrumbs="${basePage.breadCrumbHolder.model}"
> 
> with this:
> 
> t:breadCrumbs="basePage.breadCrumbHolder.model"
> 
> Notice the lack of ${}. ${} is trying to convert it to a string, which
> it's not. When passing params to components you don't use expansions,
> what you want is the object property from the class. The default binding
> prefix for params is "prop" which is what you want in this case.
> 
> Jan Vissers wrote:
> > I think I'm getting a bit further now - sorry to spam this list by the
> > way...
> >
> > If I pass the breadCrumb model in the Component class instead via the
> > Component Template something is happening.
> >
> > So instead of:
> > <t:heading t:id="heading"
> > t:breadCrumbs="${basePage.breadCrumbHolder.model}" />
> >
> > I do in .java
> > @Component(inheritInformalParameters = true, parameters =
> > { 
> > "loginPage=inherit:loginPage","breadCrumbs=basePage.breadCrumbHolder.model" 
> > })
> >
> >
> >
> > On Fri, 2008-04-18 at 16:47 +0200, Jan Vissers wrote:
> >   
> >> The layout component that passes in the 'breadCrumb' model to the
> >> 'heading' component which should render the breadcrumbs...
> >>
> >>
> >> <?xml version="1.0" encoding="utf-8"?>
> >> <!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
> >> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";>
> >> <html xmlns="http://www.w3.org/1999/xhtml";
> >> xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd";>
> >>     <head>
> >>         <meta http-equiv="Content-Type"
> >> content="text/html;charset=utf-8" />
> >>         <link rel="shortcut icon" href="favicon.ico" />
> >>         <title>${title}</title>
> >>     </head>
> >>     <body>
> >>         <div id="container">
> >>             <t:branding t:id="branding" />
> >>             <t:heading t:id="heading"
> >> t:breadCrumbs="${basePage.breadCrumbHolder.model}" />
> >>             <t:body />
> >>             <t:copyright t:id="copyright" />
> >>         </div>
> >>     </body>
> >> </html>
> >>
> >> On Fri, 2008-04-18 at 16:43 +0200, Chris Lewis wrote:
> >>     
> >>> And that is the part I want to see, from the template code which you
> >>> still haven't shared ;-). What I'm referring to is your .tml file where
> >>> you use this component.
> >>>
> >>> Jan Vissers wrote:
> >>>       
> >>>> In the snippet below if I change:
> >>>>     public List<BreadcrumbBean> getBreadCrumbs()
> >>>>
> >>>> and let it return a freshly created list. The loop construct works.
> >>>> However via the @Parameter (passing it it) doesn't.
> >>>>
> >>>> -J.
> >>>>
> >>>>
> >>>> On Fri, 2008-04-18 at 16:27 +0200, Jan Vissers wrote:
> >>>>   
> >>>>         
> >>>>> Here it is:
> >>>>>
> >>>>> import java.util.List;
> >>>>>
> >>>>> import org.apache.log4j.Logger;
> >>>>> import org.apache.tapestry.annotations.Parameter;
> >>>>>
> >>>>> import com.philips.lighting.guidecontrol.view.BreadcrumbBean;
> >>>>>
> >>>>> /**
> >>>>>  * The heading component holds the following pieces of Heading
> >>>>> information.
> >>>>>  * 
> >>>>>  * <pre>
> >>>>>  *    &lt;div id=&quot;heading&quot;&gt;
> >>>>>  *      &lt;ul id=&quot;breadcrumbs&quot;&gt;
> >>>>>  *           &lt;li
> >>>>> id=&quot;prefix&quot;&gt;[ &amp;aposyou-are-here&amp;apos ]&gt;/li&gt;
> >>>>>  *           { when loginPage }
> >>>>>  *               &lt;li&gt;&amp;aposlogin-page&amp;apos&lt;/li&gt;
> >>>>>  *           { when not loginPage }
> >>>>>  *               { for all crumbs }
> >>>>>  *                   { if crumb is last }
> >>>>>  *                       &lt;li&gt;[ crumb text ]&lt;/li&gt;
> >>>>>  *                   { if crumb is not last }
> >>>>>  *                       &lt;li&gt;&lt;a href=&quot;[ crumb
> >>>>> link ]&quot;&gt;[ crumb text ]&lt;/a&gt; &gt; &lt;/li&gt;
> >>>>>  *      &lt;/ul&gt;
> >>>>>  *    &lt;/div&gt;
> >>>>>  * </pre>
> >>>>>  * 
> >>>>>  * @author Cumquat Information Technology
> >>>>>  * 
> >>>>>  */
> >>>>> public class Heading {
> >>>>>     private static final Logger logger =
> >>>>> Logger.getLogger(Heading.class);
> >>>>>     
> >>>>>     @Parameter
> >>>>>     private boolean loginPage = false;
> >>>>>
> >>>>>     @Parameter
> >>>>>     private List<BreadcrumbBean> breadCrumbs;
> >>>>>
> >>>>>     private int index;
> >>>>>
> >>>>>     private BreadcrumbBean crumb;
> >>>>>
> >>>>>     public boolean isLoginPage() {
> >>>>>         return loginPage;
> >>>>>     }
> >>>>>
> >>>>>     public List<BreadcrumbBean> getBreadCrumbs() {
> >>>>>         return breadCrumbs;
> >>>>>     }
> >>>>>
> >>>>>     public void setBreadCrumbs(List<BreadcrumbBean> breadCrumbs) {
> >>>>>         logger.debug("Setting breadcrumbs: "+breadCrumbs);
> >>>>>         this.breadCrumbs = breadCrumbs;
> >>>>>     }
> >>>>>
> >>>>>     public int getIndex() {
> >>>>>         return index;
> >>>>>     }
> >>>>>
> >>>>>     public void setIndex(int index) {
> >>>>>         this.index = index;
> >>>>>     }
> >>>>>
> >>>>>     public BreadcrumbBean getCrumb() {
> >>>>>         return crumb;
> >>>>>     }
> >>>>>
> >>>>>     public void setCrumb(BreadcrumbBean crumb) {
> >>>>>         this.crumb = crumb;
> >>>>>     }
> >>>>>
> >>>>>     public boolean isLastCrumb() {
> >>>>>         return (index == breadCrumbs.size() - 1);
> >>>>>     }
> >>>>>     
> >>>>> }
> >>>>>
> >>>>> On Fri, 2008-04-18 at 16:22 +0200, Chris Lewis wrote:
> >>>>>     
> >>>>>           
> >>>>>> We still haven't seen your template code, where you declare this
> >>>>>> component and pass it the model. I can't be sure but perhaps it will
> >>>>>> shed some light...
> >>>>>>
> >>>>>> Jan Vissers wrote:
> >>>>>>       
> >>>>>>             
> >>>>>>> The problem is somehow related to the way my page and component are
> >>>>>>> hooked up/working.
> >>>>>>>
> >>>>>>> For testing purposes I now create the Breadcrumb list in the component
> >>>>>>> itself, simply returning a created list on the fly whenever
> >>>>>>> getBreadCrumbs() is called. This works as expected!!!
> >>>>>>>
> >>>>>>> Strange thing is that via passing the 'model' to the component via a
> >>>>>>> page binding the same thing doesn't work. This must be a bug?!
> >>>>>>>
> >>>>>>> -J.
> >>>>>>>
> >>>>>>> On Fri, 2008-04-18 at 15:59 +0200, Chris Lewis wrote:
> >>>>>>>   
> >>>>>>>         
> >>>>>>>               
> >>>>>>>> That looks good to me. I don't have an example I can look at with a
> >>>>>>>> loop, but I do have one with a t:grid in which I reference a bean
> >>>>>>>> property of a custom class. It's possible that the two are vastly
> >>>>>>>> different, but I wouldn't think that.
> >>>>>>>>
> >>>>>>>> Jan Vissers wrote:
> >>>>>>>>     
> >>>>>>>>           
> >>>>>>>>                 
> >>>>>>>>> On the component I have:
> >>>>>>>>>
> >>>>>>>>>     @Parameter
> >>>>>>>>>     private List<BreadcrumbBean> breadCrumbs;
> >>>>>>>>>
> >>>>>>>>> This is passed in via the containg (base)page.
> >>>>>>>>> And in the same component class I have:
> >>>>>>>>>
> >>>>>>>>>     private BreadcrumbBean crumb;
> >>>>>>>>>
> >>>>>>>>>     public BreadcrumbBean getCrumb() {
> >>>>>>>>>         return crumb;
> >>>>>>>>>     }
> >>>>>>>>>
> >>>>>>>>>     public void setCrumb(BreadcrumbBean crumb) {
> >>>>>>>>>         this.crumb = crumb;
> >>>>>>>>>     }
> >>>>>>>>>
> >>>>>>>>> This should be right, right?
> >>>>>>>>>
> >>>>>>>>> -J.
> >>>>>>>>>
> >>>>>>>>> On Fri, 2008-04-18 at 14:00 +0100, nicholas Krul wrote:
> >>>>>>>>>   
> >>>>>>>>>       
> >>>>>>>>>             
> >>>>>>>>>                   
> >>>>>>>>>> ? is your crumb property of type BreadCrumbBean, or is it type 
> >>>>>>>>>> String?
> >>>>>>>>>> should be same as breadCrumbs<?TYPE>
> >>>>>>>>>>
> >>>>>>>>>> On Fri, Apr 18, 2008 at 1:56 PM, Chris Lewis <[EMAIL PROTECTED]>
> >>>>>>>>>> wrote:
> >>>>>>>>>>
> >>>>>>>>>>     
> >>>>>>>>>>         
> >>>>>>>>>>               
> >>>>>>>>>>                     
> >>>>>>>>>>> I can't speak about your t:if bit because I don't know what 
> >>>>>>>>>>> "LastCrumb"
> >>>>>>>>>>> would be, but assuming that your page class has getters/setters 
> >>>>>>>>>>> (or the
> >>>>>>>>>>> property is annotated with @Property) for the "crumb" property, a 
> >>>>>>>>>>> getter
> >>>>>>>>>>> for your "breadCrumbs," and your crumb bean defines a "getName" 
> >>>>>>>>>>> method,
> >>>>>>>>>>> you *should* be good.
> >>>>>>>>>>>
> >>>>>>>>>>> It would be helpful if you can include the exception, 
> >>>>>>>>>>> specifically the
> >>>>>>>>>>> line it references, etc.
> >>>>>>>>>>>
> >>>>>>>>>>> chris
> >>>>>>>>>>>
> >>>>>>>>>>> PS the list is good, the IRC channel (irc.freenode.net #tapestry) 
> >>>>>>>>>>> is
> >>>>>>>>>>> better ;-)
> >>>>>>>>>>>
> >>>>>>>>>>> Jan Vissers wrote:
> >>>>>>>>>>>       
> >>>>>>>>>>>           
> >>>>>>>>>>>                 
> >>>>>>>>>>>                       
> >>>>>>>>>>>> Yep, sure, I may I add - This mailing list is great and Tapestry 
> >>>>>>>>>>>> rocks!
> >>>>>>>>>>>>
> >>>>>>>>>>>>  <t:loop source="breadCrumbs" value="crumb" index="index">
> >>>>>>>>>>>>     <t:if test="LastCrumb">
> >>>>>>>>>>>>        ${crumb.name}
> >>>>>>>>>>>>        <t:parameter name="else">
> >>>>>>>>>>>>            <a href="#"
> >>>>>>>>>>>> t:type="pageLink" ....>${crumb.name}</a>
> >>>>>>>>>>>>               >
> >>>>>>>>>>>>        </t:parameter>
> >>>>>>>>>>>>     </t:if>
> >>>>>>>>>>>> </t:loop>
> >>>>>>>>>>>>
> >>>>>>>>>>>> -J.
> >>>>>>>>>>>>
> >>>>>>>>>>>> On Fri, 2008-04-18 at 14:34 +0200, Chris Lewis wrote:
> >>>>>>>>>>>>
> >>>>>>>>>>>>         
> >>>>>>>>>>>>             
> >>>>>>>>>>>>                   
> >>>>>>>>>>>>                         
> >>>>>>>>>>>>> Can you share some code? At least the relevant part from 
> >>>>>>>>>>>>> template would
> >>>>>>>>>>>>> be helpful.
> >>>>>>>>>>>>>
> >>>>>>>>>>>>> chris
> >>>>>>>>>>>>>
> >>>>>>>>>>>>> Jan Vissers wrote:
> >>>>>>>>>>>>>
> >>>>>>>>>>>>>           
> >>>>>>>>>>>>>               
> >>>>>>>>>>>>>                     
> >>>>>>>>>>>>>                           
> >>>>>>>>>>>>>> Hi,
> >>>>>>>>>>>>>>
> >>>>>>>>>>>>>> Just to make sure I'm not missing something.
> >>>>>>>>>>>>>>
> >>>>>>>>>>>>>> In T4 when I wrote a @For construct I could use value="..." as 
> >>>>>>>>>>>>>> long as
> >>>>>>>>>>>>>>             
> >>>>>>>>>>>>>>                 
> >>>>>>>>>>>>>>                       
> >>>>>>>>>>>>>>                             
> >>>>>>>>>>> I
> >>>>>>>>>>>       
> >>>>>>>>>>>           
> >>>>>>>>>>>                 
> >>>>>>>>>>>                       
> >>>>>>>>>>>>>> provided a setter|getter pair for the class involved - in this 
> >>>>>>>>>>>>>> case
> >>>>>>>>>>>>>> BreadcrumbBean. I want to iterate over a list of beans and use 
> >>>>>>>>>>>>>> each
> >>>>>>>>>>>>>> instance individually. Now T5 throws up on me with this nice 
> >>>>>>>>>>>>>> coercion
> >>>>>>>>>>>>>> message. Does this mean I need to contribute my own coercion - 
> >>>>>>>>>>>>>> or is
> >>>>>>>>>>>>>> there a more simple way? In my case BreadcrumbBean is a simple 
> >>>>>>>>>>>>>> class
> >>>>>>>>>>>>>> holding three String members.
> >>>>>>>>>>>>>>
> >>>>>>>>>>>>>> Thanks (again :-))
> >>>>>>>>>>>>>> -J.
> >>>>>>>>>>>>>>
> >>>>>>>>>>>>>>
> >>>>>>>>>>>>>> ---------------------------------------------------------------------
> >>>>>>>>>>>>>> To unsubscribe, e-mail: [EMAIL PROTECTED]
> >>>>>>>>>>>>>> For additional commands, e-mail: [EMAIL PROTECTED]
> >>>>>>>>>>>>>>
> >>>>>>>>>>>>>>
> >>>>>>>>>>>>>>
> >>>>>>>>>>>>>>
> >>>>>>>>>>>>>>             
> >>>>>>>>>>>>>>                 
> >>>>>>>>>>>>>>                       
> >>>>>>>>>>>>>>                             
> >>>>>>>>>>>> ---------------------------------------------------------------------
> >>>>>>>>>>>> To unsubscribe, e-mail: [EMAIL PROTECTED]
> >>>>>>>>>>>> For additional commands, e-mail: [EMAIL PROTECTED]
> >>>>>>>>>>>>
> >>>>>>>>>>>>
> >>>>>>>>>>>>
> >>>>>>>>>>>>         
> >>>>>>>>>>>>             
> >>>>>>>>>>>>                   
> >>>>>>>>>>>>                         
> >>>>>>>>>>> --
> >>>>>>>>>>> http://thegodcode.net
> >>>>>>>>>>>
> >>>>>>>>>>>
> >>>>>>>>>>>       
> >>>>>>>>>>>           
> >>>>>>>>>>>                 
> >>>>>>>>>>>                       
> >>>>>>>>> ---------------------------------------------------------------------
> >>>>>>>>> To unsubscribe, e-mail: [EMAIL PROTECTED]
> >>>>>>>>> For additional commands, e-mail: [EMAIL PROTECTED]
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>   
> >>>>>>>>>       
> >>>>>>>>>             
> >>>>>>>>>                   
> >>>>>>> ---------------------------------------------------------------------
> >>>>>>> To unsubscribe, e-mail: [EMAIL PROTECTED]
> >>>>>>> For additional commands, e-mail: [EMAIL PROTECTED]
> >>>>>>>
> >>>>>>>
> >>>>>>>   
> >>>>>>>         
> >>>>>>>               
> >>>>> ---------------------------------------------------------------------
> >>>>> To unsubscribe, e-mail: [EMAIL PROTECTED]
> >>>>> For additional commands, e-mail: [EMAIL PROTECTED]
> >>>>>
> >>>>>
> >>>>>     
> >>>>>           
> >>>> ---------------------------------------------------------------------
> >>>> To unsubscribe, e-mail: [EMAIL PROTECTED]
> >>>> For additional commands, e-mail: [EMAIL PROTECTED]
> >>>>
> >>>>
> >>>>   
> >>>>         
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: [EMAIL PROTECTED]
> >> For additional commands, e-mail: [EMAIL PROTECTED]
> >>
> >>
> >>     
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
> >   
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to