https://issues.apache.org/bugzilla/show_bug.cgi?id=51490
Bug #: 51490
Summary: if.jsp has many bugs and c:if example not useful
Product: Tomcat 7
Version: 7.0.16
Platform: PC
Status: NEW
Severity: normal
Priority: P2
Component: Examples
AssignedTo: [email protected]
ReportedBy: [email protected]
Classification: Unclassified
Created attachment 27276
--> https://issues.apache.org/bugzilla/attachment.cgi?id=27276
Three versions of the "if" example, including a fix.
See:
apache-tomcat-7.0.16/webapps/examples/jsp/tagplugin/if.jsp
Small things:
* Has unclosed font tags and hr tags (old HTML)
* Has doubled font tags: "<font <font" (broken)
* Uses "</br>" sometimes (broken) - should be "<br/>" always
Medium thing:
* The content in the following prints even when it's not working! E.g., if
the jstl.jar is not there!
<c:if test="${2>0}">
It's true that (2>0)!
</c:if>
The User Agent simply prints the content of the unknown tag.
Please add after this:
<br/>
<c:if test="${0>2}">
If you see this, then (0>2)! Fail!
</c:if>
Major things:
* Must use the old non-XML syntax with .jsp file suffix:
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
* The scope for "theTruth" should be "page" to avoid testing issues.
If the taglib line is removed and the following is added to the <html> tag:
xmlns:c="http://java.sun.com/jsp/jstl/core"
then the example does NOT work, even though it might look like it does!
In this case, "theTruth" is still set from if.jsp (if scope="session") and the
contents of the c:if tag still appear, even with no JSTL processing.
To use xmlns:c rather than the taglib line, the developer must
1) Switch to the .jspx file suffix
2) Use the jsp:root element
3) Or configure Tomcat to treat .jsp as XML
The above is not clear, especially when the example appears to work in many
cases when it should not.
I have attached:
1) A fixed if.jsp - please use this.
2) An if.jspx version - please include this for contrast.
3) An if-xmlns.jsp version that does NOT work, but appears to work if if.jsp is
visited first. This is to test the example.
Thanks!
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]