struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <hermod.opstv...@dnbnor.no>
Subject RE: [shale] Clayforeach tag
Date Wed, 08 Feb 2006 13:11:44 GMT
Hi

I tested it and I am getting a weird result: My main page gets rendered several times and
the block for the clayForEach is not rendered.

The set up is a working Clay template with the following block in it:
....
<span jsfid="clayForEach" bodyJsfid="news" var="myvar" allowBody="false" value="#{@managed-bean-name.otherTopNews}#>
  <div class="story">
    <h3>Story Title</h3>
    <p>Story body - reduced for simplicity</p>
  </div>
</span>
....

a clay template htmlfile news.html:
<div class="story">
    <h3><span jsfid="outputText" value="#{@managed-bean-name.header}" />Story
Title</h3>
    <p><span jsfid="outputText" value="#{@managed-bean-name.body}" />Story body</p>
</div>

and in my clay-config.xml:
    <component jsfid="news" extends="clay" id="news">
		<attributes>
			<set name="clayJsfid" value="/pages/news.html" />
		</attributes>
    </component>

the method signature for otherTopNews is :  public List getOtherTopNews()

Debugging this, I have added an extra catch in the ClayAmalgam.clayForEach method, catching
the case where vi is null at the end. Here I print out the type of valueList (which should
equal the returnvalue of otherTopNews i.e List). It states that it is of type String!!

I have tried to figure out where it changes from a List to a String, but I am at a loss.

Hermod


-----Original Message-----
From: Gary VanMatre [mailto:gvanmatre@comcast.net]
Sent: Tuesday, February 07, 2006 3:30 PM
To: Struts Users Mailing List
Subject: RE: [shale] Clayforeach tag



>From: <hermod.opstvedt@dnbnor.no> 
>
> Hi 
> 
> So in the case where bodyJsfid is a html template, I could do something like 
> this: 
> 
>
>template jsdid=/news.xml:
><h3><span jsfid="outputText" value="#{myvar.head}" /><h3>
><p><span jsfid="outputText" value="#{myvar.body}" /><p>
>

Oh, right.  I forgot the other half of the story.  The snippet will use the 
managed-bean-name symbol.  So, you should code:

template jsdid=/news.xml:
<h3><span jsfid="outputText" value="#{@managed-bean-name.head}" /><h3>
<p><span jsfid="outputText" value="#{@managed-bean-name.body}" /><p>


><span jsfid="clayForeach" bodyJsfid="/news.xml" var="myvar" >allowBody="false">
>bla bla
></span>

You will need a "value" attribtue to bind to which can be a List, Map or Array types.  This
is a ValueBinding expression.

<span jsfid="clayForeach" bodyJsfid="/news.xml" var="myvar" value="#{@managed-bean-name.news}"
allowBody="false">
  


Gary


>and then do something like this:
>
><span jsfid="clayForeach" bodyJsfid="/news.xml" var="myvar" >allowBody="false">
>bla bla
></span>
>



> -----Original Message----- 
> From: Gary VanMatre [mailto:gvanmatre@comcast.net] 
> Sent: Tuesday, February 07, 2006 2:30 PM 
> To: Struts Users Mailing List 
> Subject: Re: [shale] Clayforeach tag 
> 
> 
> >From: 
> < 
> > Hi 
> > 
> > I was wondering about the usage of this tag. I see it has a shapeValidator,but 
> I 
> > was wondering what the intended syntax for this tag is, and if the current var 
> > value is somehow passed along to it? 
> > 
> 
> The clayForEach uses the "var" attribute like the JSTL var. But, in this case, 
> it's the name of a Map placed in session scope. This component (Clay) pulls the 
> data from the "value" expression and loads a map. The bodyJsfid is the content 
> that is repeated for each item. The "bodyJsfid" can be a html template or XML 
> configuration. The row is a naming container so you can add update able fields 
> and the reason the map is stored in session scope. I thought it would be 
> important to be able to name the session scoped variable since you have to 
> cleanup yourself. 
> 
> The component uses the clay shapeValidator callback event to create the beans 
> that define the shape of the subtree. This callback has the same method 
> signature as the "validator" method binding event but is not associated with the 
> validation phase. I't invoked for the rendering phase. 
> 
> The "clayForEach" shapeValidator event is bound to a managed bean that is loaded 
> in the faces-config from the Clay jar. 
> 
> The "validator" term seemed to work because it validates the shape of the Clay 
> component. The basic idea of this method binding event is to create the Clay 
> subtree at runtime from model data instead of a XML or HTML static configuration 
> file. 
> 
> The tomahawk "dataList" component will do the same thing with more style. 
> 
> 
> 
> 
> 
> > Hermod 
> > 
> > 
> > * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 
> > 
> > This email with attachments is solely for the use of the individual or 
> > entity to whom it is addressed. Please also be aware that the DnB NOR Group 
> > cannot accept any payment orders or other legally binding correspondence with 
> > customers as a part of an email. 
> > 
> > This email message has been virus checked by the virus programs used 
> > in the DnB NOR Group. 
> > 
> > * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 
> > 
> > 
> > --------------------------------------------------------------------- 
> > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org 
> > For additional commands, e-mail: user-help@struts.apache.org 
> > 
> 
> --------------------------------------------------------------------- 
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org 
> For additional commands, e-mail: user-help@struts.apache.org 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message