【问题标题】:How to deselect h:selectManyListbox after submit提交后如何取消选择 h:selectManyListbox
【发布时间】:2013-01-25 08:56:28
【问题描述】:

我正在用 jsf 和richfaces 做一个项目。有一个selectManyList。在 selectmanylist 中选择并保存后,SelectManyList 会再次打开。最后选择的项目在列表中被默认选择。但是我想阻止最后选择的项目。我该怎么办?

                     <td valign="top">
                        <h:panelGroup id="ajaxAvailableProductPanel2">
                           <h:selectManyListbox
                            size="#{pc_ExternalProviderFrag.callServerBackingBean.availableProductsSelectItemsSize}"
                            id="availableProductsListbox2"
                            style="width: 100%;"
                            valueChangeListener="#{pc_ExternalProviderFrag.callServerBackingBean.handleAvailableProductsListboxValueChange}">
                            <f:selectItems
                                value="#{pc_ExternalProviderFrag.callServerBackingBean.availableProductsSelectItems}" />
                           </h:selectManyListbox>
                        </h:panelGroup>
                     </td>

【问题讨论】:

    标签: jsf richfaces selectmanylistbox


    【解决方案1】:

    只需在action方法中清除组件的值即可。

    所以,给定一个

    <h:selectManyListbox value="#{bean.selectedItems}">
    

    您可以在操作方法中执行此操作:

    public void submit() {
        // ...
    
        selectedItems = null;
    }
    

    顺便说一句,我的印象是valueChangeListener 根本不属于那里,但这是一个不同的问题/问题。

    【讨论】:

    • 谢谢,但我正在混淆一个项目。我无法直接看到其他代码。不过我尽量做到你说的
    猜你喜欢
    • 1970-01-01
    • 2014-05-27
    • 1970-01-01
    • 2013-01-04
    • 2013-01-20
    • 1970-01-01
    • 2018-11-21
    • 2014-05-25
    • 1970-01-01
    相关资源
    最近更新 更多