简体   繁体   English

在p:outputLabel中显示p:selectOneMenu描述

[英]Show p:selectOneMenu description in p:outputLabel

I have a .xhtml file with p:selectOneMenu and p:outputLabel inside. 我有一个.xhtml文件,其中带有p:selectOneMenup:outputLabel p:selectOneMenu is populated from the bean with f:selectItems . p:selectOneMenu是使用f:selectItems从bean中填充的。 In the bean it is a List<SelectItem> where SelectItems have value, label and description. 在bean中,它是一个List<SelectItem> ,其中SelectItem具有值,标签和描述。
My goal is to show description of the selected item in the p:outputLabel without making an ajax call to the bean. 我的目标是在p:outputLabel显示所选项目的描述,而无需对bean进行ajax调用。 I can only find values in the DOM tree. 我只能在DOM树中找到值。 I believe it is stored somewhere and I can access it with JS or use some JSF tools. 我相信它存储在某个地方,我可以使用JS或使用一些JSF工具来访问它。

在此列表的方法中,可以声明一个String变量,您可以捕获所选数据,然后可以调用XHTML的标签

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM