我正在用Java转发HTTP,我想将一些额外的参数传递给静态页面“ demo.html”,所以我尝试了以下方法:
request.getRequestDispatcher("demo.html?para=123").forward(request, response);
但是“ demo.html”中的javascript函数无法获取该参数。当我使用时:
window.location.search.substring(1)
在查询之前我只有参数。
我应该如何追溯“ demo.html”中的“ para = 123”?
答案 0 :(得分:0)
找到了另一种方法:使用cookie。
有更好的解决方案吗?