• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

variable directive in tagfiles

 
James Mark
Ranch Hand
Posts: 115
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please give an example for variable directive in tagfiles.What is the use
of that???
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The variable directive in tag files works like the variable tag in the TLD, and is used to give some interactivity between the JSP and the tag, especially to export some variables from the tag to the JSP. You'll find some example here and here.
 
Jan van Mansum
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It lets your create a variabele that can be used by the page that calls the tag file. This is for example something that the JTSL forEach element does:



It exposes a variabele called "counter" to the body of the forEach. You could create something similar in the tag implemented by your tag file using variable. (Note that JSTL is probably not implemented using tag files---it probably can't even be.)

On the SCWCD exam I think you only have to know that the variabele directive exists and that it is only valid in a tag file, by the way.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic