我有一个要求,其中一个州的下拉列表填充城市。所以我在statedropdown上使用了autosubmit &一个使用部分触发器的valuechangeListener来引用城市下拉列表,因为我希望我的值在客户端,所以我在state下拉列表上使用了valuepassthru,但这阻止了我的valluechange侦听器被调用。
如果我将valuepassthru属性设置为false,则会调用valuechange侦听器,但我需要将valuepassthru设置为true才能访问客户端javascript上的值。
我在状态上绑定的对象是一个字符串,选项是selectItems列表,所以我认为这可能是一个问题,并使用了客户转换器,但这也不起作用
有没有想过没有使用自动提交和valuepassthrough=true触发reason的原因是什么?在这方面的任何帮助都是非常感谢的
我正在为dropdown和Jsf1.1使用千里得组件,谢谢
发布于 2012-08-26 17:08:14
您是只需要选定的值,还是需要访问所有值?如果您只需要选定的值,则可以在bean的值更改侦听器中添加一些Javascript:
FacesContext context = FacesContext.getCurrentInstance();
ExtendedRenderKitService erks = Service.getRenderKitService(
context
, ExtendedRenderKitService.class
);
String jsValue = StringEscapeUtils.escapeJavaScript(value);
erks.addScript(context, "alert('"+ jsValue +"');");https://stackoverflow.com/questions/10354691
复制相似问题