Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/jsf/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jsf 在自定义标记的操作侦听器事件中传递参数_Jsf_El - Fatal编程技术网

Jsf 在自定义标记的操作侦听器事件中传递参数

Jsf 在自定义标记的操作侦听器事件中传递参数,jsf,el,Jsf,El,在继续构建自定义标记的过程中,除了将参数传递给bean方法外,所有的过程都已经完成,并且都在准确地工作。我已经尝试过了,但是无法传递参数,下面是代码 web.xml <context-param> <param-name>facelets.LIBRARIES</param-name> <param-value>/WEB-INF/pinnacleTags.taglib.xml</param-value&g

在继续构建自定义标记的过程中,除了将参数传递给bean方法外,所有的过程都已经完成,并且都在准确地工作。我已经尝试过了,但是无法传递参数,下面是代码

web.xml

    <context-param>
        <param-name>facelets.LIBRARIES</param-name>
        <param-value>/WEB-INF/pinnacleTags.taglib.xml</param-value>
    </context-param>

facelets.LIBRARIES
/WEB-INF/pinnacleTags.taglib.xml
塔比卜


pinnacleTags/facelets
顶峰组合
buttonPanel.xhtml
textBoxValue
说明文字
BTN选项
文本框宽度
btnHeight
btnWidth
actionListenerBean
actionListenerBean
void actionListener(javax.faces.event.ActionEvent)
ActionListener方法
方法签名=“java.lang.String操作(javax.faces.event.ActionEvent)”
组件

        <ui:composition> 
            <div>
                <h:outputLabel value="#{caption}" />
                <p:inputText value="#{textBoxValue}" style="width: #{textBoxWidth}; " />
                <p:commandButton type = "submit" 
                                 value = "#{btnCaption}" 
                                 actionListener="#{actionListenerBean[actionListenerMethod]}"
                                 style="height: #{btnHeight}; width: #{btnWidth};" />
            </div>
        </ui:composition>

最后是用途

            <pt:PinnacleCombo id="clientID" 
                                textBoxValue="#{customTags.clientID}"
                                caption="Client ID: " 
                                textBoxWidth="150px" 
                                btnHeight="35px" 
                                btnCaption="Press"
                                actionListenerBean="#{customTags}"
                                actionListenerMethod="btnPressed"/>


我不知道如何将参数传递给menthod,请建议。

最后,正如@Selaron所建议的,使用omnifaces后的自定义标记是

        <ui:composition> 
            <h:outputLabel value="#{caption}" />
            <p:inputText value="#{textBoxValue}" style="width: #{textBoxWidth}; " />
            <o:methodParam name="method" value="#{actionListenerBeanMethod}" />
            <p:commandButton type = "submit" 
                             value = "#{btnCaption}" 
                             actionListener="#{method}"
                             style="height: #{btnHeight}; width: #{btnWidth};" />
        </ui:composition>

Thanx@Selaron寻求帮助。

这不是一个复合组件,而是一个自定义标记。Thanx为了更正,请建议如何将参数传递给方法???尝试删除
方法签名。bean应该是一个对象,而方法只是该方法的名称。@jasper de vries,正如你提到的,我试图删除它,但没有成功。你检查过吗?它允许传递带有参数的MethideExpression,但不确定它是否符合您的要求。
        <ui:composition> 
            <h:outputLabel value="#{caption}" />
            <p:inputText value="#{textBoxValue}" style="width: #{textBoxWidth}; " />
            <o:methodParam name="method" value="#{actionListenerBeanMethod}" />
            <p:commandButton type = "submit" 
                             value = "#{btnCaption}" 
                             actionListener="#{method}"
                             style="height: #{btnHeight}; width: #{btnWidth};" />
        </ui:composition>
actionListenerBeanMethod="#{customTags.btnPressed('Value Passed')}"