Win a copy of Head First Agile this week in the Agile forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

proper access to session attributes  RSS feed

 
Dave Bosky
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is the difference between the following two lines of code? They seem to do the same thing. Why would you use one over another?

line 1:


line 2:


Thanks,
Dave
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66208
151
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is the difference between the following two lines of code?


Assuming that this code appears within a JSP, there is no difference. The first uses the session implicit variable, the second gets the session from the request implicit variable.


Why would you use one over another?


Brevity. But to be honest, I don't put Java code in my JSPs at all, so I would use neither.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!