my dog learned polymorphism*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes question from one of the mock exams.. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "question from one of the mock exams.." Watch "question from one of the mock exams.." New topic

question from one of the mock exams..

trupti nigam
Ranch Hand

Joined: Jun 21, 2001
Posts: 613
<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..
Barry Kushnir

Joined: Oct 14, 2002
Posts: 14
<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.

Barry Kushnir, SCJP, SCWCD, SCEA
Maha Annadurai
Ranch Hand

Joined: Oct 27, 2002
Posts: 87
<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.
Maha Anna
I agree. Here's the link:
subject: question from one of the mock exams..
Similar Threads
JNDI Port number issue while strating JBoss server 4.2.2.GA
ServletConfig & ServletContext
marcus green: Mock test
Hibernate id null issue
error occured while deploying JSF portlet in Jboss Portal server