Bug 7576 - <c:if> doesn't parse test attribute
Summary: <c:if> doesn't parse test attribute
Alias: None
Product: Taglibs
Classification: Unclassified
Component: Standard Taglib (show other bugs)
Version: unspecified
Hardware: Other other
: P3 normal (vote)
Target Milestone: ---
Assignee: Tomcat Developers Mailing List
Depends on:
Reported: 2002-03-28 14:27 UTC by Alexei Yudichev
Modified: 2004-11-16 19:05 UTC (History)
0 users


Note You need to log in before you can comment on or make changes to this bug.
Description Alexei Yudichev 2002-03-28 14:27:05 UTC
<c:if> tag is not working at all. It includes a body in any case, either 
if "value" attribute contains an expression that evaluates to false or contains 
no valid expression at all. I have tested with the latest nighty build and some 
previuos versions.
Comment 1 Shawn Bayern 2002-03-28 21:03:00 UTC
Are you sure you're including a <%@ taglib %> directive, so that
<c:if> is actually treated as an action and not simply template text?
That's just a guess, but the directive is a common thing to forget.
If the problem persists for you, please let me know more about your
environment; nobody else has had any trouble with <c:if>.

Hope that helps.
Comment 2 Alexei Yudichev 2002-03-29 07:14:30 UTC
yes I am sure, other <c:xxx> tags are working well. I use Resin 2.0.5 under Red 
Hat linux 7.2 (kernel 2.4.18-0.1), Sun JDK 1.3.1_02. For example, let's take 
If.jsp from standard-examples and modify it as follows:
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/ea/core" %>

  <title>JSTL: Conditional Support -- Simple Conditional Execution 
<body bgcolor="#FFFFFF">

<h3>Simple Conditional Execution</h3>

<h4>Customers living in the USA</h4>

<c:forEach var="customer" items="${customers}">
  <c:if test="${#%^}">
    <c:out value="${customer}"/><br>

It does not report any error and outputs a body. So it does if I change to 
<c:if test="${1==2}">. But just to make sure everything else is working, after 
changing a line just above to <c:forEach var="customer" items="${#%^}"> i get 

Unable to parse custom action attribute "items" with value "${#$%}": ...

Hence seems <c:if> is not parsing its "test" attribute at all. I can try to 
debug with the sources....
Comment 3 Alexei Yudichev 2002-03-29 07:33:43 UTC
Ok i've tried with tomcat 4.0.2-b2 and it works fine... Seems we have some kind 
of incompatibility issue... But Resin is proven to conform good to the servlet 
specification. I have never had problems with jakarta Struts for example.
Comment 4 Alexei Yudichev 2002-03-29 08:48:05 UTC
And also under Resin 2.0.5 <c:forEach> only executes its body once regardless 
of number of items in the collection. I think there's a work to do with