• Post Reply Bookmark Topic Watch Topic
  • New Topic

setAttribute() doubt  RSS feed

 
Minu Jain
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
are both the code segments a correct usage of setAttribute(String name, Object value)?

long customer = 40L;
session.setAttribute("customer", new Long(customer));

long customer = 40L;
session.setAttribute("customer", customer);
 
Thirugnanam Saravanan
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The Second one is valid only if your server/container supports JRE 5 or above.
Autoboxing will happen in that case.
 
Minu Jain
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thank you
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!