File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes Session problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Session problem" Watch "Session problem" New topic
Author

Session problem

shaf maff
Ranch Hand

Joined: Sep 07, 2008
Posts: 180
Hi Guys

I am working on a session for my site but I keep getting errors on compile. See code below:


Error:
Omar Al Kababji
Ranch Hand

Joined: Jan 13, 2009
Posts: 357
try casting to a Long instead of a long.


Omar Al Kababji - Electrical & Computer Engineer
[SCJP - 90% - Story] [SCWCD - 94% - Story] [SCBCD - 80% - Story] | My Blog
ujjwal soni
Ranch Hand

Joined: Mar 28, 2007
Posts: 403
Hi,

Try this



Cheers!!!
Ujjwal B Soni <baroda, gujarat, india> <+919909981973>
"Helping hands are better than praying lips......"
Vadim Vararu
Ranch Hand

Joined: Jan 03, 2009
Posts: 147
shaf maff wrote:Hi Guys

I am working on a session for my site but I keep getting errors on compile. See code below:


Error:



Hi buddy! I guess you have two problems here. First one is "(long)". You can't use primitive types for casting objects. Second one, i guess, is that your code will call session.getAttribute("userid") even if your session happens to be null. response.sendError(501) will not return you from method. It'll just set a header with error status instead and you'll probably get a null pointer exception.


If you think you've done too much, usually it means you've done too few.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Session problem
 
Similar Threads
Session data
Regarding sessions in servlets
pass session in other application
Constructor Problem
Problem with method