Bug 6293

Summary: TLVs does not accept valid useBean action elements
Product: Taglibs Reporter: Hans Bergsten <hans>
Component: Standard TaglibAssignee: Tomcat Developers Mailing List <dev>
Status: CLOSED FIXED    
Severity: blocker    
Priority: P3    
Version: unspecified   
Target Milestone: ---   
Hardware: All   
OS: All   

Description Hans Bergsten 2002-02-07 05:14:42 UTC
The TLVs startElement() method goes through all its tests no matter which tag 
library an element belongs to. This results in the hasDanglingScope() method
returning true for a perfectly valid <jsp:useBean> action. This is the case for
the TLVs for all JSTL libraries.

The solution is to add this right after the getLocalPart() call:

  // Just return if its an element with a foreign prefix
  if (!qn.startsWith(prefix + ":")) {
      return;
  }

With this addition, the JSP_TEXT test can likely be removed.
Comment 1 Shawn Bayern 2002-02-07 14:01:39 UTC
Thanks for the report, Hans.  I have fixed the error, although I implemented
a different check than the one you suggest.  The validator wouldn't work 
properly if I added the check you suggest:  startElement() may legitimately be
concerned with elements that are not of the taglib's prefix.  For instance,
it may desire to block ALL content within certain tags.  (Consider

  <c:choose>
     <form>
        ...

)

You may have misunderstood the check for <jsp:text>:  the goal isn't to rule
out and ignore all text in the page, but as the comment says, to 
avoid "distinguishing between it and its characters."  That is, I wouldn't
want a text element that contained nothing but whitespace, as --

  <jsp:text>  </jsp:text>

-- to invalidate a <c:choose> tag.  The easiest way to do this is to ignore
<jsp:text> and </jsp:text>, and instead logically merge them with the characters
they contain (or oblivion if they contain no characters), given our constraints.

Thanks again.