【问题标题】:How to pass javascript variables from index.html to index.jsp?如何将 javascript 变量从 index.html 传递到 index.jsp?
【发布时间】:2017-09-24 16:36:07
【问题描述】:

我能够在 javascript 和 ajax 中使用 api 获取客户所在的国家/地区。

但现在我想将值发送到 index.jsp

如何重写 url 或使用 index.jsp?country=someinfo 发送?

有什么方法可以通过 url 发送参数并在 index.jsp 中获取该变量值吗?

还有index.jsp会和index.html冲突吗???

【问题讨论】:

    标签: html jsp url-rewriting parameter-passing


    【解决方案1】:

    index.jsp 不会与 index.html 冲突,它们是不同的文件。

    你可以按照你描述的index.jsp?country=someinfo通过URL发送参数

    但您也可以使用<form action = "index.jsp" method = "GET"> 发送它,在表单内每个输入为<input name="country" value="someinfo"/> 的参数也会被发送,参见more details

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-10-23
      • 2011-04-02
      • 2010-11-02
      • 2021-12-30
      • 2015-02-03
      • 1970-01-01
      相关资源
      最近更新 更多