File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Doubt in Custom Tag Question !

 
Jagjit Dhaliwal
Greenhorn
Posts: 20
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can anyone help me in understanding answer for following question which I got it from one of mock exam:

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.
A.Application objects such as com.xyz.Student, cannot be passed as attributes to custom tags.
B.The Student object will be passed to the studentTag tag handler.
C.The Student object will NOT be passed because no variable named student is defined.
D.A Student object will not be created if it is not available it the session.
E.None of these.
 
Christophe Verré
Sheriff
Pie
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'd say E.
A : anything can be passed to custom tags
B : No, a String will be passed. It should be student="${student}" instead.
C : a student variable is defined by useBean
D : with this useBean syntax, a bean will be created if not found.
 
Sandeep Vaid
Ranch Hand
Posts: 392
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
<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.
A.Application objects such as com.xyz.Student, cannot be passed as attributes to custom tags.
B.The Student object will be passed to the studentTag tag handler.
C.The Student object will NOT be passed because no variable named student is defined.
D.A Student object will not be created if it is not available it the session.
E.None of these.


A) is Incorrect - Objects can be passed as attributes to custom tags
B) is Incorrect - You are just passing String 'student' to custom tag and
not the student object.
C) is Incorrect - There is a student object but you are not passing it.
D) is Incorrect - As you have provided class attribtue, a new object
will be created in it doesn;t exists.
E) This is correct
 
Jagjit Dhaliwal
Greenhorn
Posts: 20
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Christophe & Sandeep !!
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic