问题标签 [selectmanymenu]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
13595 浏览

jsf - 如何从 selectManyListbox / selectManyMenu / selectManyCheckbox 中获取所有选定的值?

如何从 UISelectMany 组件中收集所有选定的值,例如支持 bean 中的 h:selectManyListbox、h:selectManyMenu、h:selectManyCheckbox、p:selectManyListbox、p:selectManyMenu、p:selectManyCheckbox 等?

如果有人可以举个例子,那真的很有帮助。

0 投票
1 回答
3949 浏览

jsf - Primefaces SelectManyMenu 转换器未转换

我在整个系统中使用了一个转换器,它使用以下注释:

这工作正常,除了 SelectManyMenu 似乎没有发生转换。我的 SelectManyMenu 定义如下

SelectMenyMenu 呈现正常,但是当我选择项目时,它们作为字符串而不是对象返回。

如果我将转换器注释更改为

并将我的 SelectManyMenu 标记更改为包括

然后它按预期工作。

这是 JSF/Primefaces 中的错误吗?

我正在使用:Primefaces 3.5 Tomcat 7

谢谢

0 投票
0 回答
791 浏览

jsf - 组合内的 selectManyMenu 选择值

我创建了一个包含 PrimeFaces 的复合材料selectManyMenu。我正在尝试将绑定的选择值传递给组合,但它失败了。

复合代码:

查看代码:

查看bean代码:

在上面的代码中,值selectedUsers是有问题的值。selectManyMenu我传递了包含'value属性选择的视图/支持 bean 的 List 值。这在复合之外或者我像这样传递视图 bean 时效果很好......

...

所以,我的问题是,我如何将selectManyMenu'value属性的适当绑定值传递给组合?

非常感谢。如果我需要解释更多,请告诉我。

0 投票
1 回答
440 浏览

validation - Is there a way to prevent JSF from displaying previous/outdated content in h:selectManyMenu after validation error?

I have a form with, say a text field and a multi-select field.

On submit, both get validated, and if validation is successful, the relevant variables in the backing bean are updated. Fair enough.

The problem happens when the validation (of the multi-select) is NOT successful. In my Bean, I have (particularly for the List<String>s allStrings and selStrings)...

...so that the multi-select has one pre-selected option. If the user unselects that option (i.e. no options chosen), the validation will -of course- fail, an error message will be displayed...

...but the multiselect will not be empty. It will show the content from the bean, i.e. "a" selected. This is confusing to the user - getting an error message "input required", and being shown a filled-out field.

This appears to be a feature of JSF's lifecycle, see this article by BalusC:

"When JSF renders input components, then it will first test if the submitted value is not null and then display it, else if the local value is not null and then display it, else it will display the model value."

This works fine for the text field text3, because it submits as an empty string, not null.

The problem is that zero selected options from a multi-select means that the submitted value is null, that the local copy (I guess, since it's the first submit) is null, so that the model value ("a" selected) is displayed.

I do not want that.

How can I force JSF to use the null value it got submitted when rendering the validation response?

Thanks in advance
Antares42

0 投票
1 回答
711 浏览

java - 使用带有 JSF 的 SelectManyMenu 的 Hashmap

在 WebApp(带有 Primefaces 的 JSF 2.1)中,我想使用 HashMap 来填充 SelectManyMenu(带有复选框)。HashMap 使用一些值进行初始化,并将键设置为 false。当用户选择复选框时,我希望将键设置为 true。

这是可能的还是我必须考虑另一种解决方案?

在此先感谢,蒂姆

0 投票
1 回答
1157 浏览

java - 如何将 ajax 事件绑定到 primefaces 中的 selectManyMenu 组件

我可以修改 SelectManyMenu 组件,例如 primefaces 中的 autoComplete 组件吗?详细地说,我想根据用户的输入(字母)来获取数据,而不是一次将所有数据提取到 SelectManyMenu 组件。我想以惰性模式获取数据。

下面的代码不起作用...“Key up”事件未被捕获。

提前致谢。

0 投票
1 回答
116 浏览

java - 如何通过对象列表

我不是java新手,但今天我被一个问题吸了1个小时,我不知道为什么。

我的代码如下所示:

我的数组列表:

我的循环:

当我尝试执行下面的代码时,我收到了这个异常

我从例外中了解到 selectedTheme 是 String ,这对我来说很奇怪。

请注意,当我执行此代码时:

它正常显示列表的对象。

编辑

我不确定这段代码是否与我的问题有关:它是 与我的 ArrayList 相关的SelectManyMenu

jsfClient 是 ManagedBean。请任何帮助,谢谢。

0 投票
2 回答
3224 浏览

jsf - com.sun.faces.renderkit.html_basic.MenuRenderer.convertSelectManyValuesForModel 处的 org.hibernate.LazyInitializationException

尽管有FetchType.EAGERJOIN FETCH,但我还是有一段时间通过 JSF组件LazyInitalizationException将一些对象添加到集合中,例如在我的例子中是.@ManyToManyUISelectMany<p:selectManyMenu>

,@Entity IdentUserFetchType.EAGER:

,@Entity CompanyFetchType.EAGER:

JPQL,具有JOIN FETCH

UISelectMany提交时导致异常 的 JSF组件:

堆栈跟踪的相关部分:

这是如何引起的,我该如何解决?

0 投票
1 回答
1119 浏览

jsf - 根据 h:selectOneRadio 值有条件地启用/禁用 p:selectManyMenu

我有 2 个单选按钮,一个启用和禁用。如果我单击启用,则应禁用所有 selectmanymenu 标签,反之亦然。请你帮助我好吗。我附上了下面的代码。

单选按钮代码:

豆子代码:

0 投票
1 回答
902 浏览

jsf - UISelectOne 和 UISelectMany 组件如何在 f:selectItems 中预选默认值

我知道如何预选<p:selectOneMenu>,在 selected 中value应该是来自的对象之一<f:selectItems>,但是这个组件如何在幕后工作,我可以改变这种行为吗?

在我的情况下,我有一个重复的对象,实际上这是两个具有相同值但创建了两次的对象,并且所选对象<p:selectOneMenu>与对象不同<f:selectItems>,它无法识别它。很可能我会改变我的设计,它会指向同一个对象,但如果由于遗留代码等原因我无法做到这一点,我该如何改变<p:selectOneMenu>它将比较对象的行为id

我认为这是converter造成它的原因,但是当它渲染时它不仅仅进入getAsObject方法getAsString,所以我想有一些不同的东西,但是什么?

谢谢