Hi Walter,

thanks for the fast answer.
I tried it like that and it worked at once:


I defined a custom control in a file 'schalterpanel.xhtml'


<span xmlns="http://www.w3.org/1999/xhtml";
        xmlns:ui="http://java.sun.com/jsf/facelets";
        xmlns:f="http://java.sun.com/jsf/core";
        xmlns:h="http://java.sun.com/jsf/html";
        xmlns:c="http://java.sun.com/jsp/jstl/core";
        xmlns:t="http://myfaces.apache.org/tomahawk";>

        <ui:composition>
                <t:commandButton value="#{BtnName1}"
                                disabled="#{BtnDisabled1}"      
                                rendered="#{BtnVis1}"
                                action="#{BackingBean1[Action1]}">
                </t:commandButton>
        </ui:composition>

</span>

Then I defined the custom control like this:

        <tag>
                <tag-name>schalterpanel</tag-name>
                <source>../pages/schalterpanel.xhtml</source>
        </tag>

And then I can use my custom control like this:


<safir:schalterpanel    BtnName1="save"
                        BtnVis1="true"
                        BtnDisabled1="#{mbBean.btnVis}"
                        BackingBean1="#{mbBean}"
                        Action1="save"/>


Now my button is displayed and clicking the button the action
mbBean.save() is performed!


Maybe You are right, it is a bit ugly, but it is sufficient for me. It
is a pity that i don't really understand why
action="#{BackingBean1[Action1]}" is resolved into mbBean.save()...

Thanks a lot!
Cheers

Georg

2010/4/12 Walter Mourão <walter.mou...@gmail.com>:
> Hi, Georg,
>
> yes, there are some (quite ugly) solutions:
> http://www.ibm.com/developerworks/java/library/j-facelets2.html
>
> Component with the same problem/solution:
> http://code.google.com/p/trinidadcomponents
>
> Cheers,
>
> Walter Mourão
> http://waltermourao.com.br
> http://arcadian.com.br
> http://oriens.com.br
>
>
>
> On Mon, Apr 12, 2010 at 8:56 AM, Georg Füchsle <giofy...@googlemail.com>wrote:
>
>> Hallo,
>>
>> I use JSF 1.2 with Facelets and Tomahawk.
>>
>> Now I would like to make a facelets custom component for a navigation
>> / toolkit bar (button panel) that looks the same in every page. This
>> component should exist of a number of <t:commandButtons that can be
>> defined by calling this custom component.
>>
>> I thougt about something like this:
>>
>> In a file 'btnPanel.xhtml':
>> <span xmlns="http://www.w3.org/1999/xhtml";
>>          xmlns:f="http://java.sun.com/jsf/core";
>>          xmlns:h="http://java.sun.com/jsf/html";
>>          xmlns:ui="http://java.sun.com/jsf/facelets";
>>          xmlns:t="http://myfaces.apache.org/tomahawk";
>>          xmlns:c="http://java.sun.com/jstl/core";>
>>
>>        <ui:composition>
>>        <ui:param name="btn1Value" value="#{btn1Value}"/>
>>        <ui:param name="btn1Action" value="#{btn1Action}"/>
>>
>> .....
>>
>> </span>
>>
>>
>> I would define this as a custom tag:
>>
>>        <tag>
>>                <tag-name>btnPanel</tag-name>
>>                <source>../pages/btnPanel.xhtml</source>
>>        </tag>
>>
>>
>> Finally I want to call this control in my xhtml-pages like this:
>>
>> <safir:btnPanel btn1Value="save" btn1Action="#{mbBean.save}"/>
>>
>> But I realised that it is not possible to define a variable action for
>> my custom control like this. Actually this way JSF looks for a method
>> mbBean.getSave() instead of performing the action mbBean.save()
>>
>>
>> Is there another way to do that?
>>
>> Thanks in advance
>>
>>
>> Georg
>>
>

Reply via email to