[ Team LiB ] Previous Section Next Section



Why do I see my custom tag in the HTML output?


You most likely forgot to put the taglib directive at the top of the page. You also might not have remembered to use the prefix you defined in the taglib directive, or you mistyped the prefix or the tag name.


Why do I get a compile error when I use a custom tag?


Well, the first thing to check is that it's really the tag that's causing the problem. Try removing the tag and see whether that clears up the problem. Next, make sure that you have installed the tag library on the Web server. The class files should be under the WEB-INF/classes directory. (WEB-INF must be capitalized, so don't count on web-inf working the same way.) Also make sure you have a TLD file and that the web.xml file in the WEB-INF directory has the correct pathname for the TLD.


Why do I get a runtime error when I try to set an attribute value?


There is probably some mismatch between the attribute type in the custom tag and the attribute value you are trying to set. For instance, trying to store the string "Fred" into an integer value isn't going to work.


I created get and set methods, so why doesn't the JSP engine recognize my attributes?


Don't forget that you must also define the names of the attributes in the TLD file.


When I use a body tag, why does the JSP engine stop responding?


You are probably stuck in an infinite loop caused by your doAfterBody method returning EVAL_BODY_AGAIN, instead of SKIP_BODY, over and over.


I tried to write out some code in <% %> and reevaluated the body text. Why do the <% %> tags show up in the output?


Remember, the JSP engine parses the body text only one time. It might evaluate custom tags in the body text multiple times, but after the text is parsed, that's it.


I rewrote the body text and returned EVAL_BODY_AGAIN. Why do I still see the original body text?


Again, the JSP engine parses the body text only once. You will always receive the original body text in doAfterBody.


I put a value in the page context, so why doesn't the JSP have a variable to hold the value?


You might have forgotten to create the TagExtraInfo object, or you forgot to link the TagExtraInfo object to the tag class by adding a <teiclass> item in the TLD file.

    [ Team LiB ] Previous Section Next Section