【问题标题】:The checked values clear when the page is refreshed. in h:selectManyCheckbox刷新页面时清除选中的值。在 h:selectManyCheckbox
【发布时间】:2012-10-25 09:21:20
【问题描述】:

我在使用 h:selectManyCheckbox 时遇到问题。刷新页面时清除选中的值。
我用过 JSF 1.2

<h:selectManyCheckbox value="${dmsParticipantsForm.filterCompany}" style="text-align: left" class="companySelector" layout="pageDirection" > <f:selectItems value="${dmsActionForm.companies}" /> </h:selectManyCheckbox>

【问题讨论】:

  • 是否只有一种创建JS函数的方法,该函数将在重新加载后控制所选值的状态?

标签: selectmanycheckbox


【解决方案1】:

您是否将选定的值存储在某处(例如在会话中)? 如果是这样,您加载选定的值..

...

private List<Item> selectedItems = new ArrayList<>(); // getter-setter

@PostConstruct
public void prepare() {
    getSelectedItems().addAll(getSessionBeanOrOtherResource().getSelectedOrStoredValues());
}

【讨论】:

    猜你喜欢
    • 2012-12-11
    • 2017-06-03
    • 1970-01-01
    • 2015-09-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多