Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

need help to understand question

 
vaishali dhembre
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2813
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What happened when you tried to compile code based on these tags?
 
Marc Peabody
pie sneak
Sheriff
Posts: 4727
Mac Ruby VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Or at least share why you think certain options are right or wrong, please.
 
vaishali dhembre
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 242
Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
vaishali dhembre
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi
khushhal ,

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

~vaishali
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic