• 首页 首页 icon
  • 工具库 工具库 icon
    • IP查询 IP查询 icon
  • 内容库 内容库 icon
    • 快讯库 快讯库 icon
    • 精品库 精品库 icon
    • 问答库 问答库 icon
  • 更多 更多 icon
    • 服务条款 服务条款 icon

变量值从javascript传递把JSP

用户头像
it1352
帮助1

问题说明

我有以下情况

<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>

我应该如何传入此来源值JSP功能?
a.getResult() - 函数将返回下拉元素列表,并列出
我必须填入另一个 < option> tag。

How this source value should I pass in JSP function? a.getResult() - function will return me list of dropdown elements and that list I have to populate in another <option> tag.

正确答案

#1

你不能这样做。在JSP页面编译完成后,JavaScript在客户端执行,并以 response 的形式发送到浏览器。

You cannot do that. JavaScript executes on the client side after JSP page is already compiled and sent to the browser as response.

这篇好文章是转载于:学新通技术网

  • 版权申明: 本站部分内容来自互联网,仅供学习及演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,请提供相关证据及您的身份证明,我们将在收到邮件后48小时内删除。
  • 本站站名: 学新通技术网
  • 本文地址: /reply/detail/tanhcfkjja
系列文章
更多 icon
同类精品
更多 icon
继续加载