Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Little help please....

 
Scott Batchelor
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here is what I am trying to do...
Integer cnt = new Integer(1);
Later on in the code I want to change the value of the Variable cnt.
I am doing this...but it isnt working.
cnt = session.getAttribute("count");
Telling me incompatible types...I am trying to cast the string to Integer but no matter what I do I still get an error.
Thanks in Advance.
SB
 
Sree Yemparala
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try the following:
Integer cnt = new Integer(1);
cnt = Integer.valueOf( session.getAttribute("count"));
I hope this helps
Good Luck,
SJ
 
Scott Batchelor
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I tried that before I posted and I get this:
Method valueOf(java.lang.Object) not found in class java.lang.Integer at line 152
I am lost...
SB
 
Scott Batchelor
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As usual I was trying to make it to hard.
cnt = (Integer)session.getAttribute("count");
This works.
Thanks.
SB
 
Sree Yemparala
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is it possible for you to post your code from the beginning to line 153.
Thanks,
sj
 
Sree Yemparala
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Well, Ignore my previous reply then..
Bye..SJ
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic