Hmmm, I worry about this will not solve my problem.
I understand the t:aliasBean to use like this:
page.jsp begin ------------------------------
<t:aliasBean alias="#{foo}" value="#{foo1}" />
<beans:foo />
<t:aliasBean alias="#{foo}" value="#{foo2}" />
<beans:foo />
page.jsp end ------------------------------
and use <h:inputText value="#{foo.firstName}" /> in the custom tag.
So far, so good.
But, I want to use, of course, the tobago layout manager for layouting:
<t:panel>
<f:facet name="layout"><t:gridLayout ... ></f:facet>
<t:aliasBean alias="#{foo}" value="#{foo1}" />
<beans:foo />
<t:aliasBean alias="#{foo}" value="#{foo2}" />
<beans:foo />
</t:panel>
The layout manager has to know all of its containers children to make an
appropriate layout. So the panel has rendersChilden=true, and all the
tags will be parsed before rendering.
In the moment where #{foo.firstname} will be evaluated by the renderer
(2 times), the value of #{foo} equals #{foo2}, because it will be done
at the end tag of the panel (</t:panel>).
regards
Udo
Martin Marinschek wrote:
Well, there is a way in MyFaces to do so.
check out the t:aliasBean!
regards,
Martin
On 8/26/05, Udo Schnurpfeil <[EMAIL PROTECTED]> wrote:
* The fact that you can use a value binding expression on nearly
every attribute makes using rt expressions redundant ... you can
do anything you need with a value binding anyway.
A very powerful feature in JSP 2.0 are "Custom Tags".
Having a bean Foo in your application with several instances.
Now you write some code to edit this bean. If you put this code
into a custom tag like
WEB-INF/tags/beans/foo.tag begin ------------------------------
<%@ attribute name="bean" %>
<h:outputLabel value="here comes my bean: " />
<h:inputText value="#{${bean}.firstName}" />
<h:inputText value="#{${bean}.secondName}" />
foo.tag end --------------------------------
you can use this snip many times on your jsp like
page.jsp begin ------------------------------
<%@ taglib tagdir="/WEB-INF/tags/beans" prefix="beans" %>
<beans:foo bean="foo1" />
<beans:foo bean="foo2" />
<beans:foo bean="foo3" />
page.jsp end --------------------------------
Unfortunately this does not work. Because of the rtexpression=false.
In tobago we decided to enable the feature, to make such things work.
Is there a way in JSF 1.2 / JSP 2.1 to make such sniplets run without
dublicating code?
Udo
In JSF 1.2 / JSP 2.1, the concepts are getting unified ... but in the
mean time (when the JSP container doesn't know what a value binding
expression is) this was the decision made at the JSF spec level.
Craig
--
Dipl.-Math. Udo Schnurpfeil - Executive Officer - Atanion GmbH
Software Development - Bismarckstraße 13 - 26122 Oldenburg - Germany
phone +49 441 4082310 - mobile +49 174 9784746 - fax +49 441 4082333
mailto:[EMAIL PROTECTED] - http://www.atanion.com