• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Clarification needed on variable tag and TagExtraInfo

 
Bhagawanlu Durvasula
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
I am planning to take the exam next week. Could anybody help me in clarifying my doubt.
Taglib1.2 dtd specifies <variable> tag which describes on scripting variable. This can be done normally in the TagExtraInfo class. For normal creation of scripting variables we dont really need to implement the isValid(). So, could we alternatively use <variable> tag to define scripting varibale instead of creating a TagExtraInfo class. What are the pros and cons of these 2 approaches.
Thanks in Advance
Durvasula
 
Simon Brown
sharp shooter, and author
Ranch Hand
Posts: 1913
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Essentially one is declarative, whereas one is programmatic. The TagExtraInfo class was introduced before JSP 1.2 and apart from existing for backwards compatability, there is another good reason for it.
Imagine that you are trying to implement a copy of the <jsp:useBean> tag which looks up an object and introduces it into the page as a scripting variable. There is no way that you can know in advance what type (class) that variable might be and this, therefore, means that you can't use the <variable> tag to define the variable. Instead, you must use the TEI class.
Basically, the <variable> attribute is useful if you know the type of the variable, whereas the TEI class is useful if you want to programmatically determine some of the variable's properties.
Hope that helps and good luck with the exam.
Regards
Simon
 
Bhagawanlu Durvasula
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Brown,
Thanks for your response and wishes. The explanation is appreciable and helpful.
Kind Regards
Durvasula
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic