Reputation: 359
In one of my application i've set one variable (String) in a session. The detail code is below in one of my servlet.
HttpSession session = request.getSession();
String val1 = "http://abc.gmail.com/pp/hello.do?supplierId=894";
session.setAttribute("val1", val1);
Now i retrieved the value of the session attribute in one jsp by the below code.
<%
String val1 = (String) session.getAttribute("val1");
System.out.println("The value is-->>"+val1);
%>
But it's printing only "http://abc.gmail.com/pp/hello.do?supplierId"
Could you please help me fixing this error. I'm expecting the o/p to be "http://abc.gmail.com/pp/hello.do?supplierId=894"
Thanks, Sourav
Upvotes: 0
Views: 2059
Reputation: 328556
There are two possible reasons for this:
To find out which is which, you can:
System.out.println()
right after session.setAttribute()
to see the value that is actually put into the session.session.setAttribute()
. Might not be feasible when thousands of attributes are set.Upvotes: 1
Reputation:
I think you have problem with =
try following
I should work
Upvotes: 0