How to use pageContext to setAttribute for a session
843835Aug 13 2002 — edited Aug 13 2002Hi,
I am new to pageContext.
I want to store value on pageContext so that it can be retrived through out session. Can anybody help me out how to proceed further.
I did in this way but when i am accessing the value set in the pageContext i am getting null value. Pls let me know if i am wrong somewhere. Even i have set session="true" during jsp initialization.
Do we require to set
session=request.getSession(true);
Even i tried it still its giving null value.
pageContext.setAttribute("userid","sachin",pageContext.SESSION_SCOPE);
pageContext.setAttribute("userpwd","abc123",pageContext.SESSION_SCOPE);
String uid=(String)pageContext.getAttribute("userid");
String pwd=(String)pageContext.getAttribute("userpwd");
when i print them it gives null values. Pls help me out. Its very very urgent.
thanks a lot,
sachin