• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Mukund A. Kumar
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


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
Pie
Posts: 65120
91
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Mukund A. Kumar
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
@ 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
Pie
Posts: 65120
91
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 65120
91
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 226
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65120
91
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic