0

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.

Zeus07
  • 168
  • 1
  • 5
  • 17

1 Answers1

0

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

Eldhose Abraham
  • 551
  • 3
  • 8
  • That is what I tried but I'm getting null pointer exception. – Zeus07 Dec 02 '20 at 13:46
  • https://stackoverflow.com/questions/1890438/how-to-get-parameters-from-the-url-with-jsp Could you please refer this post. Many options are listed there apart from above. – Eldhose Abraham Dec 02 '20 at 13:57