Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

jsp:useBean query

 
Ash More'
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
<jsp:useBean id="myInt" class="java.lang.Integer" />;

The above is supposed to create a Bean , however Integer does not have a constructor with no arguments.

options
1) compilation error
2) runtime error (InstantiationException)
(there are other options which arent relevant as the page wont proceed beyond compilation or throw runtime exception)

answer given is 2. (Whizlabs)
shouldn't 1 be the answer? as the compiler will come to know that Integer doesn't have a no argument constructor.

[ April 20, 2008: Message edited by: Ash More' ]
[ April 20, 2008: Message edited by: Ash More' ]
 
Ash More'
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hey no replies till now??
 
dhwani mathur
Ranch Hand
Posts: 621
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ash!!!


i am not that sure about the answer
but what i think is as here in the
tag below:




and the answer 2 sounds right to me as well.

I hope it helps .


SCJP(1.5),SCWCD(On the way...)
Dhwani:>Winning is not important but it is the only thing.
[ April 21, 2008: Message edited by: dhwani mathur ]
 
Ash More'
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
well your arguments seems valid, but on running on Tomcat 6, i get


doesn't the word compiler mentioned in the above trace, mean a compiler error?


[ April 21, 2008: Message edited by: Ash More' ]
[ April 21, 2008: Message edited by: Ash More' ]
 
Ash More'
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

[ April 21, 2008: Message edited by: Ash More' ]
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65335
97
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Ash More':
will the learned moderators reply on this, am waiting from 2 days now

It is no one's job to answer your questions -- and certainly not the moderator's. Questions are answered by the helpful membership of this site (including the moderators) who volunteer their time to help others.
 
Ash More'
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
okk, i edited my previous message
 
Sandeep Vaid
Ranch Hand
Posts: 392
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think you are right that it should give the compilation error :

com.ibm.ws.jsp.JspCoreException: JSPG0049E: /temp/Temp.jsp failed to compile :

But you know the question is a bit ambigous as :

1. If i am accessign the jsp file for the first time, the compilation will happen when the first request comes in (at request time i.e at runtime)..

2. If i use precompile=true option then the compilation will happen even before the first request.

The final answer is "It will compilation error"...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic