Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / March 2007

Tip: Looking for answers? Try searching our database.

session value in java

Thread view: 
sinhak.alok@gmail.com - 13 Mar 2007 12:18 GMT
First, I send user id from jsp page to servlet.  That value received
on servlet page like this :-
String username = request.getParameter("user");
Then creating the session true on servlet like this:-
HttpSession session = request.getSession(true);
After that I set the value using setAttribute method
session.setAttribute("user_id", username);
When I receiving session value using getAttribute method it display
null on jsp page. my code is:-
String usercode = (String) session.getAttribute("user_id");
I am using Oracle JDeveloper 10g Relaese 2 as Editor.
Lew - 13 Mar 2007 14:16 GMT
> When I receiving session value using getAttribute method it display
> null on jsp page. my code is:-
> String usercode = (String) session.getAttribute("user_id");

Eschew scriptlet in JSPs. Consider using ${ user_id } instead.

I have seen firewall software prevent establishment of a session, although I'm
not sure how it did that. Updated firewall policies fixed that problem.

You don't show the part that displays the value. The one line of code you
posted for session retrieval doesn't show the source of the problem.

Are you able to see the session variable through the debugger?

-- Lew


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.