The root object for bindings is the page that contains the block, not
the page that renders the block. That is, pageA contains the
RenderBlock. pageB contains the Block to be rendered (below); testValue
is a property in pageB.
So, how does your block in pageB access values from pageA?
Via the "Inserter" parameter of the Block component. For instance:
<!-- part of pageA -->
<div jwcid="@RenderBlock" block="ognl:components.myBlock" foo="ognl:bar" />
<!-- part of pageB. Note that "components" refers to the "components"
property of pageB. -->
<div jwcid="[EMAIL PROTECTED]">
<span jwcid="@Insert"
value="ognl:components.MyBlock.inserter.bindings['foo'].value" />
</div>
Ugly? Yes. But it works.
I highly recommend moving the property path to java, so you'd have:
value="ognl:theValue"
in the template, and:
.java
public Object getTheValue() {
return
((Block)getComponent("MyBlock")).getInserter().getBinding("foo").getValue();
}
Robert
PS: Note that I'm still very much a tap3 user; there's probably some
pretty way to inject the value in tap4 that I'm entirely unaware of. :)
Karthik N wrote:
Hi Navin,
You are right. That is exactly my doubt/question. How do OGNL bindings
work for nested components inside a Block that is a part of a different
page
and NOT the page that is currently being rendered.
Thanks, Karthik
On 11/9/06, B.S.Navin <[EMAIL PROTECTED]> wrote:
Hi Firas,
I think, what Karthik meant by point 2 is something like below:
<span jwcid="[EMAIL PROTECTED]">
<span jwcid="@Insert" value="ognl:testValue"/>
</span>
Here you can see that the content of the block has a binding to a
property "testValue". So, which page will this binding be pointing to?
- Navin
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]