Object to Int casting
In my java page I have
request.setAttribute("intLevel", intLevel); // intLevel is set as an Integer
and I am retrieving it in my jsp page using
int level = (int)request.getAttribute("intLevel");
I get a cast class exception, saying Object cannot be casted into Integer. Can you please help.
if it is returning an Integer, then can you just leave off the cast and let it auto-unbox to an int? Either that or call intValue() on the returned Integer object?
I suppose that should work
Thanks guys, I will try those 2 options
Edit: serjant's recommendation is much better than mine. Go with it.