Posted By:
Todd_Trimmer
Posted On:
Friday, March 9, 2001 01:59 PM
MyPage Is it possible to create a custom tag whose body is not evaluated right away? Instead, another tag can call the first tag, and only THEN have it's body be evaluated. Kind of like a template in XSL. For instance, I might want to specify a tag that allows the JSP creator to insert arbitrary HTML, using page attribute values if any of the HTML is conditional. However, this HTML is not spit out as soon as it is encountered. Rather, some other arbitrary HTML is written OUTSIDE the tag. Some sort of call will be embedded in one of the elements. The JSP tag will THEN be evaluated and spit out to the location from where it was called. Example:
More>>
MyPage
Is it possible to create a custom tag whose body is not evaluated right away? Instead, another tag can call the first tag, and only THEN have it's body be evaluated. Kind of like a template in XSL.
For instance, I might want to specify a tag that allows the JSP creator to insert arbitrary HTML, using page attribute values if any of the HTML is conditional. However, this HTML is not spit out as soon as it is encountered. Rather, some other arbitrary HTML is written OUTSIDE the tag. Some sort of call will be embedded in one of the elements. The JSP tag will THEN be evaluated and spit out to the location from where it was called.
Example:
Welcome!
<% callMyLibTinyTableTag() %>
Have fun!
Would produce:
MyPage
Welcome!
Have fun!
This is a simple example, but what if there were several calls to callMyLibTinyTableTag() embedded in arbitarily complex HTML, with no discernable pattern of repetition? Making it even more complex, what if
has several page variables associated with it? And these variables have to be evaluated when the tag is called, NOT when it is first read in by the JSP container.