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 使用actionListener写入inputText_Jsf_Primefaces_Actionlistener - Fatal编程技术网

Jsf 使用actionListener写入inputText

Jsf 使用actionListener写入inputText,jsf,primefaces,actionlistener,Jsf,Primefaces,Actionlistener,我最近使用primefaces和jsf在xhtml中编程;现在感觉有点不舒服;希望你能帮助我。我的第一个问题 我的问题是:我有一个输入文本,然后是一个p:对话框,显示一个有两列的panelgrid:一列包含代码,另一列包含按钮。如何将所选代码写入输入文本?在按钮上使用actionListener?还是 <p:inputText id="codice_tributo_1" size="5"></p:inputText> <p:commandButton id="sh

我最近使用primefaces和jsf在xhtml中编程;现在感觉有点不舒服;希望你能帮助我。我的第一个问题

我的问题是:我有一个输入文本,然后是一个p:对话框,显示一个有两列的panelgrid:一列包含代码,另一列包含按钮。如何将所选代码写入输入文本?在按钮上使用actionListener?还是

<p:inputText id="codice_tributo_1" size="5"></p:inputText>

<p:commandButton id="showDialogButton" type="button" value="Show"
                onclick="PF('dlg').show()" />

            <p:dialog header="Codici" widgetVar="dlg" appendToBody="true"
                resizable="false">
                <h:form id="form">

                    <p:panelGrid>

                        <p:row>
                            <p:column>
                                <p:outputLabel  id="codice1">34567890</p:outputLabel>
                            </p:column>
                            <p:column>
                                <p:commandButton icon="ui-icon-carat-1-w" oncomplete="PF('dlg').hide();"></p:commandButton>
                            </p:column>
                        </p:row>

                        <p:row>
                            <p:column>
                                <p:outputLabel>3twgehrdnftg</p:outputLabel>
                            </p:column>
                            <p:column>
                                <p:commandButton icon="ui-icon-carat-1-w" oncomplete="PF('dlg').hide();"></p:commandButton>
                            </p:column>
                        </p:row>                

                    </p:panelGrid>


                </h:form>
            </p:dialog>

34567890
3TWGEHRNDFTG

我也是JSF新手,但以下是我将尝试的:

  • inputText
    字段的值绑定到支持bean
  • actionListener
    添加到
    commandButtons
    ,并使用它调用支持bean上的方法,将代码作为参数传入
  • 在该方法中,将参数值复制到
    inputText
    字段备份值中
  • update
    属性添加到
    commandButtons
    ,并使用它更新
    inputText
    组件
  • 您可能更喜欢只使用JavaScript来实现这一点,类似于,因为没有理由与服务器通信