Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Wrong Line

 
Anthony Smith
Ranch Hand
Posts: 285
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I meant this one. count is an int.
username is a String
data.getSession().setAttribute(username, count);
 
Junilu Lacar
Bartender
Posts: 7465
50
Android Eclipse IDE IntelliJ IDE Java Linux Mac Scala Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Assuming data is an HttpSession, the second parameter of the setAttribute method needs to be an Object, not a primitive. Try this:
setAttribute(userName, new Integer(count));
Junilu
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic