Skip to content
Advertisement

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

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.

Advertisement

Answer

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”) %>

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement