Warm tip: This article is reproduced from serverfault.com, please click

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

发布于 2020-12-02 12:21:43

I've a javascript through which I'm passing some values to a new jsp using window.open()

window.open("view.jsp?uname="+objid+"&pass="+ses,"","heightP0 ,widthP0");

I want to retrieve the uname and pass values in scriptlet.

I've tried something like this but obviously it's not working and I'm getting null pointer exception.

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

Is it possible to retrieve the values? Also, it is actually passing data from the javascript as I can see the values in the URL. Any idea to how to proceed here?

Thanks in advance.

Questioner
Zeus07
Viewed
0
Eldhose Abraham 2020-12-02 21:35:44

In your case the uname and pass are passed as request parameters. So to access them in JSP use <%= request.getParameter("uname") %> <%= request.getParameter("pass") %>