wood burning stoves 2.0*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes JSP: GetProperty - Scope Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "JSP: GetProperty - Scope" Watch "JSP: GetProperty - Scope" New topic
Author

JSP: GetProperty - Scope

vinod balaji
Ranch Hand

Joined: May 18, 2006
Posts: 84
Mock Exam Question:
A JSP page has the following useBean declaration that references a bean called Person. The person class has a private field calledfirstname and an appropriate getter (accessor) method for retrieving the value of that field.<jsp:useBean id="person" type="com.examulator.Person" class="com.examulator.Person" scope="session" />Which of the following is the correct syntax for a getProperty tag to retrieve the value of the instance of Person.
a)<jsp:getProperty name="person" property="firstname"/>
b)<jsp:getProperty name="person" property="getFirstname"/>
c)<jsp:getProperty id="person" property="firstname"/>
d)<jsp:getProperty name="person" property="firstname" class="com.examulator.Person"/>
e)<jsp:getProperty name="person" property="firstname" scope="session"/>
Answer:
a. a
b. b
c. c
d. d
e. e

I answered e, but mock result gives me option a, since in usebean they have mentioned scope as session i think while getting the value we have to put scope attribute.. Correct me if iam wrong
Gowher Naik
Ranch Hand

Joined: Feb 07, 2005
Posts: 643
getProperty can never contain scope attribute.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JSP: GetProperty - Scope
 
Similar Threads
jsp:useBean
useBean
jsp:useBean doubt
jsp:useBean doubt
jsp:getProperty action