This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
In our own custom tag, can we specify <body-content> as JSP? I encountered error in tomcat 5.0.29 if I put in JSP in my own tld. However, I checked with JSTL's tld and the tags there are all defined as JSP. Can anybody clarify this?
Here it is, I am mixing a SimpleTagSupport (supporting an outer tag) and TagSupport (supporting an inner tag). <my uterTag> body-content is scriptless <my:innerTag> body-content is JSP </my:innerTag> </my uterTag>
My outer tag is of <body-content>scriptless</body-content>. My inner tag is of <body-content>JSP</body-content> . And when I evaluate the outer tag's body, the following exception is thrown. I know that SimpleTagSupport cannot have body content JSP but cannot tell how this limitation would extent to the inner tag contained by it even the inner is supported by class handler where JSP is legal.
Since you declared the outer tag as scriptless, you cannot have any scripting elements in its body. That includes inside the body of nested tags.
Joined: Jan 28, 2004
I just dont understand the rule. If the "scriptless" nature of outer tag applies to inner tag's body then if I change the inner tag's <body-content> to 'tagdependent', scriptlet in inner tag body should still cause error.
But I tested it and tagdependent inner tag worked - only when I set it to JSP that error was produced. The rule is a bit confusing.
tagdependent means that the tag will interpret the body content, and thus it doesn't conflict with the outer tag.
Even though it is possible to nest the new and classic tag handlers as you are attempting, it's fraught with pitfalls and unless you have an insurmoutable reason to nest classic tags within simple tags, I'd either make then all use the classic handlers or make them all use the simple handlers. Otheriwse, you're going to keep running into these kinds of issues.