我有以下情形從JavaScript傳遞一個變量值到JSP
<select name="dropdown_Source" onchange="call()">
<% for (int i=0 ; i < a1.length; i++) { if (a1[i]==n ull) break; %>
<option value="<%=a1[i]%>">
<%=a1[i]%>
</option>
<% } %>
</select>
<script>
function call() {
var source = document.forms[0].dropdown_source.value;
// Now this 'source' value i have to pass to jsp function
<%
Admin a = new Admin(); //this is class defined
a.getResult(source); //but source is not resolved here
%>
}
</script>
這怎麼source
值我應該通過在JSP的功能? a.getResult()
- 函數將返回我的下拉列表元素列表和該列表 我必須填充另一個<option>
標記。
醜陋的代碼..我不知道jsp,但我相信這將無法正常工作,因爲jsp服務器端JavaScript客戶端..如果你可以得到與jsp的下拉值做它..與asp.net我可以得到價值我從javascript中設置其值的下拉列表。 – Mehmet 2013-05-11 12:33:31