Could you please help me out ?
What will be the result of accessing a JSP page containing this code using the URI /test/a.jsp?intValue=3
a) Prints 3
b) Prints 0
c) Does not compile
d) Throws an exception
I thought this code would not compile because Integer class does not have a default no-args constructor as required by <jsp:useBean> element.
But according to WhizLabs, this code would throw a InstantiationException.
Am I wrong ?
[ October 28, 2006: Message edited by: Nilesh Raje ]
If the class attribute is used for a Java type that cannot be instantiated as a JavaBean, the container may consider the page invalid, and is recommended to (but not required to) produce a fatal translation error at translation time, or a java.lang.InstantiationException at request time.
So the answer can both be translation time error or InstantiationException when request is received...
Still, to me translation error makes sense, but an Exception at request time... let's say our jsp was loaded on startup... first it would be translated and after that compiled(no request would have come yet, I think this isn't considered request time yet). IMO this wouldn't make it to the first request, it would fail at compilation time.
What do you think?