This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes need help to understand question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "need help to understand question" Watch "need help to understand question" New topic
Author

need help to understand question

vaishali dhembre
Greenhorn

Joined: Aug 29, 2007
Posts: 6
hi,

guys

I need help to understand and to find possible answer for following question from jdiscuss

Consider the following usage of a custom tag in a JSP page:

<jsp:useBean id="student" scope = "session" class="com.xyz.Student" />

<mytaglib:studentTag student='student' />

Which of the following statements are correct?

Select 1 correct option.

1)Application objects such as com.xyz.Student, cannot be passed as attributes to custom tags.

2)The Student object will be passed to the studentTag tag handler.

3)The Student object will NOT be passed because no variable named student is defined.

4)A Student object will not be created if it is not available it the session

5)None of these.



Thanks ,

~vaishali
Marcus Green
arch rival
Rancher

Joined: Sep 14, 1999
Posts: 2813
What happened when you tried to compile code based on these tags?


SCWCD: Online Course, 50,000+ words and 200+ questions
http://www.examulator.com/moodle/course/view.php?id=5&topic=all
Marc Peabody
pie sneak
Sheriff

Joined: Feb 05, 2003
Posts: 4727

Or at least share why you think certain options are right or wrong, please.


A good workman is known by his tools.
vaishali dhembre
Greenhorn

Joined: Aug 29, 2007
Posts: 6
Hi

I wrote answer to above question as
2)The Student object will be passed to the studentTag tag handler.

but the actual answer is option no 4)None of these.

So i couldnt understand why we cant pass Student object?
due to lac of time i am unable to code and check what happens if we try
to pass Student object.

So rancher's help will be appreciated if anyone can explain
how objects can be passed to studentTag tag handler

Thanks, Marc and Marcus for reply

Thanks in advance

~vaishali
khushhal yadav
Ranch Hand

Joined: Jun 20, 2007
Posts: 242

Hi Vaishali,

Correct answer is not 4), it's 5) None of these

See in this case
<mytaglib:studentTag student='student' />

A String 'student' is being passed to the attribute which is not there, anywhere in the given options.

Your option 4)A Student object will not be created if it is not available it the session is not true as a student object already exist in scope session by the time this statement execute because of the above tag <jsp:useBean id="student" scope = "session" class="com.xyz.Student" />. Moreover it (<mytaglib:student> is not a tag whcih is going to create a Student object (I am assuming it).

Yes, answer 2)The Student object will be passed to the studentTag tag handler might have been correct if, the last statement would have been like this
<mytaglib:studentTag student='${student}' />

So please I request you to either check your question or your answer once again and confirm.

Regards,
Khushhal


rgrds,
Khushhal
vaishali dhembre
Greenhorn

Joined: Aug 29, 2007
Posts: 6
hi
khushhal ,

Thanks !!! correct answer is 5)None of these

~vaishali
 
wood burning stoves
 
subject: need help to understand question