【发布时间】:2012-02-17 17:54:07
【问题描述】:
我正在尝试从 javascript 方法访问 javascript 变量值,并在提交时访问 jsf 支持 bean 值和访问控制器?感谢您的时间
function formValue(){
var e = document.getElementById("formid:dropdownlist1id");
var val = e.options[e.selectedIndex].value;
var e1 = document.getElementById("formid:dropdownlist2id");
var val1 = e1.options[e1.selectedIndex].value;
var result = document.write(val + ',' + val1);
return result;
}
jsp页面:
<h:commandButton styleClass="submitButton" value="search"
action="#{rController.method();}">
<h:inputHidden id="hiddentext" value="#{rController.formidinput}"/> </h:commandButton>
【问题讨论】:
-
为什么不将两个下拉列表的值绑定到一个支持 bean 属性?您似乎完全忽略了 JSF 的意义,并使用不必要的附加代码来解决它。
标签: javascript jsf