• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

jsp:useBean query

 
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hey no replies till now??
 
Ranch Hand
Posts: 621
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

[ April 21, 2008: Message edited by: Ash More' ]
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
okk, i edited my previous message
 
Ranch Hand
Posts: 392
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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"...
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic