[英]Get arrayList populated on event values from backing bean
i populate my arrayList on onDrop event, now when I try to retrieve it via javascript, it does not have any value 我在onDrop事件中填充了arrayList,现在当我尝试通过javascript检索它时,它没有任何值
backing bean: 支持豆:
List<String> arr..
public void onDrop(DragDropEvent event) {
arr.add(event.getDragId());
}
jsf code: jsf代码:
<h:inputHidden id="hidden" value=#{bean.arr}/>
javascript function: javascript功能:
function get(){
var a = document.getElementById("hidden");
alert(a.value);
}
alert returns []
but I have now a populated arrayList after onDrop is fired several times but it seems that it does not get the values. alert返回[]
但在onDrop触发几次后,我现在有一个填充的arrayList,但似乎无法获取值。 how can i retrieve those values in the arrayList? 我如何在arrayList中检索这些值?
EDIT: 编辑:
here's the one using the onDrop event 这是一个使用onDrop事件的事件
<p:outputPanel id="op" ... >
<p:droppable ... >
<p:ajax ... listener="#{bean.onDrop}"/>
try declaring its Getters and Setters, sometimes value is not reached because of that even if variable, string or array does exist 尝试声明其Getter和Setters,有时即使没有变量,字符串或数组也无法达到该值
//Getter
//public List<String> getArr...
// return arr...
//Setter
//public void setArr...
// this.arr =...
If you're using NetBeans just use Refactor... 如果您使用的是NetBeans,则只需使用Refactor ...
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.