You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by Sylvain Vieujot <sv...@apache.org> on 2004/11/08 21:28:56 UTC

New AliasBean component

I'm about to commit a new component that allows to make a library of
reusable generic subforms.

The aliasBean tag allows you to link a fictive bean to a real bean.

Let's suppose you have a subform you use often but with different beans.
The aliasBean allows you to design the subform with a fictive bean and
to include it in all the pages where you use it.
You just need to make an alias to the real bean named after the fictive
bean before invoking the fictive bean.

example :

In this example, the customerAddress bean is a managed bean, but the
address bean isn't defined anywhere.
After the aliasBean tag, we can use #{address.*} in place of
#{custommerAddress.*}, so making it possible to have a generic address
subforms (ok, this one it a bite simple form, but here is the idea).

				<h:form>
					<x:aliasBean sourceBean="#{customerAddress}" alias="#{address}"/>
					<f:subview id="simulatedIncludedSubform">
							<%-- The next tag could be inserted by an %@ include or
jsp:include --%>
	                        <h:inputText value="#{address}"/>
					</f:subview>

					<h:commandButton/>
				</h:form>

Thanks for your comments.

Sylvain.


Re: New AliasBean component

Posted by Manfred Geiler <ma...@apache.org>.
Bill Dudney wrote:
> How about having a close that removes the alias?
> 
> So you could do;
> 
> <x:aliasBean...>
> alias valid...
> </x:aliasBean>
> alias not valid...
> 
> So in encodeBegin(...) the alias is made and in encodeEnd(...) the alias 
> is removed.
> 
> Thoughts?


+1

Manfred



> 
> I personally like this approach better because it is more explicit and 
> if you have more than one subform on the same page the coming and going 
> of the alias would be explicit (probably helping me find bugs, or 
> preventing me from introducing them).
> 
> -bd-
> 
> On Nov 8, 2004, at 1:28 PM, Sylvain Vieujot wrote:
> 
>>  I'm about to commit a new component that allows to make a library of 
>> reusable generic subforms.
>>
>>  The aliasBean tag allows you to link a fictive bean to a real bean.
>>
>>  Let's suppose you have a subform you use often but with different beans.
>>  The aliasBean allows you to design the subform with a fictive bean 
>> and to include it in all the pages where you use it.
>>  You just need to make an alias to the real bean named after the 
>> fictive bean before invoking the fictive bean.
>>
>>  example :
>>
>>  In this example, the customerAddress bean is a managed bean, but the 
>> address bean isn't defined anywhere.
>>  After the aliasBean tag, we can use #{address.*} in place of 
>> #{custommerAddress.*}, so making it possible to have a generic address 
>> subforms (ok, this one it a bite simple form, but here is the idea).
>>
>>  <h:form>
>>  <x:aliasBean sourceBean="#{customerAddress}" alias="#{address}"/>
>>  <f:subview id="simulatedIncludedSubform">
>>  <%-- The next tag could be inserted by an %@ include or jsp:include --%>
>>                          <h:inputText value="#{address}"/>
>>  </f:subview>
>>
>>  <h:commandButton/>
>>  </h:form>
>>
>>  Thanks for your comments.
>>
>>
>>
>>  Sylvain.
>>
>>
>  
> 
> 

Re: New AliasBean component

Posted by Sylvain Vieujot <sv...@apache.org>.
Done.

On Wed, 2004-11-10 at 03:49 -0700, Bill Dudney wrote:

> How about having a close that removes the alias?
> 
> So you could do;
> 
> <x:aliasBean...>
> alias valid...
> </x:aliasBean>
> alias not valid...
> 
> So in encodeBegin(...) the alias is made and in encodeEnd(...) the 
> alias is removed.
> 
> Thoughts?
> 
> I personally like this approach better because it is more explicit and 
> if you have more than one subform on the same page the coming and going 
> of the alias would be explicit (probably helping me find bugs, or 
> preventing me from introducing them).
> 
> -bd-
> 
> On Nov 8, 2004, at 1:28 PM, Sylvain Vieujot wrote:
> 
> >  I'm about to commit a new component that allows to make a library of 
> > reusable generic subforms.
> >
> >  The aliasBean tag allows you to link a fictive bean to a real bean.
> >
> >  Let's suppose you have a subform you use often but with different 
> > beans.
> >  The aliasBean allows you to design the subform with a fictive bean 
> > and to include it in all the pages where you use it.
> >  You just need to make an alias to the real bean named after the 
> > fictive bean before invoking the fictive bean.
> >
> >  example :
> >
> >  In this example, the customerAddress bean is a managed bean, but the 
> > address bean isn't defined anywhere.
> >  After the aliasBean tag, we can use #{address.*} in place of 
> > #{custommerAddress.*}, so making it possible to have a generic address 
> > subforms (ok, this one it a bite simple form, but here is the idea).
> >
> >  <h:form>
> >  <x:aliasBean sourceBean="#{customerAddress}" alias="#{address}"/>
> >  <f:subview id="simulatedIncludedSubform">
> >  <%-- The next tag could be inserted by an %@ include or jsp:include 
> > --%>
> >                          <h:inputText value="#{address}"/>
> >  </f:subview>
> >
> >  <h:commandButton/>
> >  </h:form>
> >
> >  Thanks for your comments.
> >
> >
> >
> >  Sylvain.
> >
> >
>   

Re: New AliasBean component

Posted by Bill Dudney <bd...@mac.com>.
How about having a close that removes the alias?

So you could do;

<x:aliasBean...>
alias valid...
</x:aliasBean>
alias not valid...

So in encodeBegin(...) the alias is made and in encodeEnd(...) the 
alias is removed.

Thoughts?

I personally like this approach better because it is more explicit and 
if you have more than one subform on the same page the coming and going 
of the alias would be explicit (probably helping me find bugs, or 
preventing me from introducing them).

-bd-

On Nov 8, 2004, at 1:28 PM, Sylvain Vieujot wrote:

>  I'm about to commit a new component that allows to make a library of 
> reusable generic subforms.
>
>  The aliasBean tag allows you to link a fictive bean to a real bean.
>
>  Let's suppose you have a subform you use often but with different 
> beans.
>  The aliasBean allows you to design the subform with a fictive bean 
> and to include it in all the pages where you use it.
>  You just need to make an alias to the real bean named after the 
> fictive bean before invoking the fictive bean.
>
>  example :
>
>  In this example, the customerAddress bean is a managed bean, but the 
> address bean isn't defined anywhere.
>  After the aliasBean tag, we can use #{address.*} in place of 
> #{custommerAddress.*}, so making it possible to have a generic address 
> subforms (ok, this one it a bite simple form, but here is the idea).
>
>  <h:form>
>  <x:aliasBean sourceBean="#{customerAddress}" alias="#{address}"/>
>  <f:subview id="simulatedIncludedSubform">
>  <%-- The next tag could be inserted by an %@ include or jsp:include 
> --%>
>                          <h:inputText value="#{address}"/>
>  </f:subview>
>
>  <h:commandButton/>
>  </h:form>
>
>  Thanks for your comments.
>
>
>
>  Sylvain.
>
>