如何将javascript变量从index.html传递给index.jsp?

问题描述:

我能够在javascript和ajax中使用API​​获取客户国家/地区。如何将javascript变量从index.html传递给index.jsp?

但是现在我想把值发送给索引。 jsp

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

是否有任何方法通过url发送参数并在index.jsp中获取该变量值?

而且会索引。 jsp与索引冲突。 html ???

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

您可以通过URL你描述index.jsp?country=someinfo

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