[英]Access added values through jQuery UI widget inside ui:repeat in JSF
XHTML XHTML
<ul id="keywordList">
<ui:repeat value="#{bean.selectedObject.keywords}" var="keyword">
<li><h:outputText value="#{keyword.name}" /></li>
</ui:repeat>
</ul>
Bean 豆角,扁豆
public class Bean implements Serializable {
private MyObject selectedObject;
}
Model 模型
public List<String> getKeywords() {
return keywords;
}
public void setKeywords(List<String> keywords) {
this.keywords = keywords;
}
Any idea, how i can access the values which are added to the UL-List? 任何想法,我如何访问添加到UL列表中的值? Thanks!
谢谢!
EDIT : The bean is session scoped 编辑 :bean是会话范围的
According to its documentation and demos the jQuery tag-it plugin autocreates a hidden input element with the (configureable) name syntax item[tags][]
. 根据其文档和演示 ,jQuery tag-it插件会自动创建一个具有(可配置)名称语法
item[tags][]
的隐藏输入元素。 You should be able to grab it from the HTTP request parameter values map by ExternalContext#getRequestParameterValuesMap()
in JSF as follows: 您应该能够通过JSF中的
ExternalContext#getRequestParameterValuesMap()
从HTTP请求参数值映射中获取它,如下所示:
String[] tags = FacesContext.getCurrentInstance().getExternalContext()
.getRequestParameterValuesMap().get("item[tags][]");
You could also set it as a managed property, but this requires the bean to be request scoped. 您也可以将其设置为托管属性,但这需要将bean限定在请求范围内。
@ManagedProperty("#{paramValues['item[tags][]']}")
private String[] tags;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.