如何在新的 jsp 页面中检索 window.open() 的参数值(在 scriptlet 内)

How to retrieve parameter values of window.open() in a new jsp page (inside scriptlet)

我有一个 javascript,通过它我使用 window.open()

将一些值传递给新的 jsp
window.open("view.jsp?uname="+objid+"&pass="+ses,"","heightP0 ,widthP0");

我想在 scriptlet 中检索 uname 和传递值。

我已经尝试过类似的方法,但显然它不起作用,并且出现空指针异常。

IDfSession session2 = (IDfSession) request.getAttribute("pass"); 
String obj = (String)request.getAttribute("uname");

是否可以检索值?此外,它实际上是从 javascript 传递数据,因为我可以看到 URL 中的值。知道如何在这里进行吗?

提前致谢。

在您的情况下,uname 和 pass 作为请求参数传递。所以要在 JSP 中访问它们,请使用 <%= request.getParameter("uname") %> <%= request.getParameter("通过") %>