You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2003/02/25 01:48:00 UTC
DO NOT REPLY [Bug 17351] New: -
include directive bug with "dangling else"
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=17351>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND
INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=17351
include directive bug with "dangling else"
Summary: include directive bug with "dangling else"
Product: Tomcat 4
Version: 4.0.4 Final
Platform: PC
OS/Version: Windows NT/2K
Status: NEW
Severity: Normal
Priority: Other
Component: Jasper
AssignedTo: tomcat-dev@jakarta.apache.org
ReportedBy: randynichols@yahoo.com
There appears to be a bug in the include directive when the included code is
an "if" block with a trailing "else" that has no statement or block following.
It is assumed that the following "else" block is in "including" code.
I have inserted sample code below. There are two files "test.jsp"
and "incl_test.jsp". The first file includes the second with an include
directive. The "if" statement should execute only one of the two alternatives;
however, it appears to execute both, as if the "else" keyword is completely
ignored.
Please let me know if you need further information:
-Randy Nichols
randynichols@yahoo.com
contents of file "incl_test.jsp" below:
<%
if (str.equals("hello"))
{
out.println("helloblock " + str);
}
else // is this being ignored?
%>
contents of file "test.jsp" below:
<%@ page language="java"%>
<html>
<head>
<title>test</title>
</HEAD>
<body>
<pre>
This page should print out a single line as follows:
helloblock hello
If instead it prints out two lines as follows:
helloblock hello
non-helloblock hello
then I believe there is a Tomcat 4 bug in the include directive, where
it is ignoring the "else" after an "if" block in the include file.
Test printout below
<%
String str = "hello";
%>
<%@ include file="incl_test.jsp"%>
<%
{
// this should be the else block after the include file.
out.println("non-helloblock " + str);
}
%>
</pre>
</body>
</html>
%>
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org