got three tags. But TagHandler is being called only once. Why is it so
Containres are allowed to pool tag objects and hence may create only one instance of the tag per page.
Originally posted by Vishnu Prakash:
Output:
Tag Nested Level: 0
Attribute Name: vis1
I got three tags. But TagHandler is being called only once. Why is it so.[/QB]
Originally posted by Vishnu Prakash:
Even though I had declared JspException in throws clause If try the code
getJspBody().invoke(null);
at the end of the doTag() method I end up getting JspException.
javax.servlet.ServletException: javax.servlet.jsp.JspException: null
root cause
java.lang.NullPointerException
com.example.SimpleTagHandler.doTag(SimpleTagHandler.java:69)
If the action element is empty in the page, this method is not called at all. [SimpleTag]
This method will not be invoked for empty tags or for non-empty tags whose doStartTag() method returns SKIP_BODY or EVAL_BODY_INCLUDE. [BodyTag]
If the action element is empty in the page, this method is not called at all.
The container doesn't set the fragment or BodyContent for an empty tag, that's why it's null when you try to use it later (by invoking getJspBody() or getBodyContent()).
What is a fragment. Is it the body of the tag that invokes setJspBody() method.
Okay, basic SimpleTag stuff... When the container encounters a tag in the page which is implemented by a SimpleTag (rather than classic Tag) handler, it wraps the body of the tag into a JspFragment instance.
(so it includes code to invoke other actions and evaluate EL/scripting expressions, and not the pre-evaluated textual result of the body).
There are several ways to name a tag: "tag" and "action" are perhaps the most common. Custom tags are also known as "custom actions" and "tag extensions". So, the "action element" the API refers to is just the XML element for the action (tag) in the page.
Using standard tags and creating custom tags, along with tag deployment, are covered fully in my new book, hopefully to be available at the end of January 2006 [just trying to get a promo in there if anyone notices!]
It is an exam study guide (for the SCWCD 1.4), but I'm told it's got some good introductory discussions to the newer or more complex topics like EL and tags.
Originally posted by Vishnu Prakash:
I believe "scripting expressions" as NOT allowed as part of the body of a SimpleTag
Don't get me started about those stupid light bulbs. |