• 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

question from one of the mock exams..

 
Ranch Hand
Posts: 647
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
<jsp:useBean id="temp" class="java.lang.String" property="temporary"/> <%
out.println(temp); %>
A It would print 'temporary' if 'property' was replaced by 'value'
B It would print 'temporary' if 'property' was replaced by 'param'
C It would work if this line was added before the scriptlet:
<jsp:setProperty name="temp" param="temporary" />
D None of the above are true

None of the statements is true. A and B would cause blank output and C would cause an error.
why c would cause an error?
thanks in advance..
Trupti
 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Trupti,
<jsp:setProperty name="temp" param="temporary" />
is missing a property attibute. The property attribute is mandatory.
Without a property attribute, the JSP Engine would not be able to create the proper set method to call on the bean.
-BK
 
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
<jsp:useBean /> can take one of the 4 attribute combinations only.
1. class
2. type
3. class and type
4. beanName and type
Options 1,2,3, would be wrong because the attribute names are wrong for <jsp:useBean />. This is the main reason.
Regards,
Maha Anna
 
reply
    Bookmark Topic Watch Topic
  • New Topic