It won't throw ClassCastException since default type would be java.lang.Object. Moreover, if you want to just display numeric, you can use this code syntax.
Joined: Jul 10, 2008
Actually in defineTag value attribute is of String type (not an object).due to that while setting that value in scope (In your case it is a page scope) it is set as a String object with value as "1".
but while defining bean: define tag, in servlet created by server for that jsp there is code like below
due to above code, you are getting ClassCastException.(as value in page scope is of String type)
you can do one thing if you want to resolve this issue, try below code,
but as in 2011 that is no good practice to use scriptlet in your JSP page, you can create Integer in any scope using JSTL, as I am not much aware of JSTL I have done this using a scriptlet.