wood burning stoves 2.0*
The moose likes Servlets and the fly likes After invoking invalidate() method getAttribute( Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "After invoking invalidate() method getAttribute("user") method doesn Watch "After invoking invalidate() method getAttribute("user") method doesn New topic
Author

After invoking invalidate() method getAttribute("user") method doesn't return any value or exception

Mukund A. Kumar
Greenhorn

Joined: Aug 27, 2013
Posts: 14


here problem is that After invoking invalidate() method getAttribute("user") method doesn't return any value or exception.and also line number 6,7,8 not print any value.

output: mukund
password
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60806
    
  65

Any scoped variables will no longer be available and any attempt to fetch one will result in null. Why is that surprising?

ALso, "hs1" is a really poor name for a variable.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Mukund A. Kumar
Greenhorn

Joined: Aug 27, 2013
Posts: 14
@ Bear Bibeault : sir, then why the line 6 and 7 is not printing "null" and why the line 8 is not printing "Your Username" as output.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60806
    
  65

When output unexpectedly stops, it's most likely the result of an exception. Is there any exception stack trace in the logs (first thing you should always check), or is your code catching exceptions?
Mukund A. Kumar
Greenhorn

Joined: Aug 27, 2013
Posts: 14
thanks @Bear Bibeault, when i inserted a catch block corresponding to try block then i have seen that catch block is executing.
it means that an exception is occuring during the invocation of


but why the exception is not showing in netbeans ide logs when we don't insert a catch block but throws ServletException, IOException on processRequest
method like this




in this case the exception is not showing in the netbeans ide logs.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60806
    
  65

Mukund A. Kumar wrote:but why the exception is not showing in netbeans ide logs when we don't insert a catch block

That I cannot tell you, but it's one of the reason I don't run web apps inside an IDE.
Ishan Pandya
Ranch Hand

Joined: Feb 06, 2012
Posts: 219

Bear Bibeault wrote:I don't run web apps inside an IDE.


you mean you develop a webapp inside a IDE but run manually? (Manually in the sense typing the URL after starting tomcat) is it?


OCPJP
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60806
    
  65

That's what I do. I use an IDE as an intelligent editor, but run and test my web apps in a separate Tomcat instance over which I have full control, and that better matches the production environment.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: After invoking invalidate() method getAttribute("user") method doesn't return any value or exception
 
Similar Threads
User can log in even after logout (invalidating session)
Session
Hyeprlinks inside servlet
Jsp code doubt
Login/Logout Problem