Bug 65491

Summary: Behavior differences with c:import when flushing out data
Product: Taglibs Reporter: Volodymyr Siedlecki <volosied>
Component: Standard TaglibAssignee: Tomcat Developers Mailing List <dev>
Status: NEW ---    
Severity: normal    
Priority: P2    
Version: 1.2.5   
Target Milestone: ---   
Hardware: PC   
OS: Mac OS X 10.1   

Description Volodymyr Siedlecki 2021-08-09 15:54:11 UTC
Hello,

I would like some clarification on what behavior is correct here, given the JSPs below.  There's a difference between the Tomcat/Apache Taglibs & the Eclipse Foundation's Tag Library implementations. 


test.jsp:

<%@ page session="false" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<TABLE border>
    <TR>
        <TD>Hello world</TD>
        <TD><%=System.currentTimeMillis()%></TD>
    </TR>
    <tr>
        <td>The import</td>
        <td><c:import url="imported-file.jsp" var="foo"/></td>
    </tr>
    <tr>
        <td>The output</td>
        <td><c:out value="${foo}"/></td>
    </tr>
</TABLE>

imported-file.jsp:

<%@ page session="false" %>
Start of test a
<% out.flush(); %>
End of test a


Should anything be displayed when importing a file, even when an out.flush() is called? File contents should only be stored in the variable, until is outputted? 

I also created a sister issue here (with screenshots) -- https://github.com/eclipse-ee4j/jstl-api/issues/153 

The spec appears ambiguous on this scenario, so I hope someone here can provide some insight?  What is the correct behavior here? 


In the Eclipse's Impl, calling out.flush within the import flushes that straight to the page.  

Eclipse (I testing using EE9's 2.0, but it's also the similar for the 1.2.7 version):
https://github.com/eclipse-ee4j/jstl-api/blob/1.2.7/impl/src/main/java/org/apache/taglibs/standard/tag/common/core/ImportSupport.java


https://github.com/eclipse-ee4j/jstl-api/blob/1.2.7/impl/src/main/java/org/apache/taglibs/standard/tag/common/core/ImportSupport.java#L514-L521

Apache (version 1.2.5):
https://github.com/apache/tomcat-taglibs-standard/blob/taglibs-standard-1.2.5/impl/src/main/java/org/apache/taglibs/standard/tag/common/core/ImportSupport.java#L470


Thank you!