On 03/02/2025 09:24, Rémy Maucherat wrote:
On Mon, Feb 3, 2025 at 3:38 AM Tim N <[email protected]> wrote:I've replicated something similar on Tomcat 10.1.34 (and also 9.0.98). Steps 1 - Download and unzip Tomcat 10.1.34 2 - Create file "webapps/ROOT/include.jsp" with contents "<h1>I've been included!</h1>" 3 - Edit "webapps/ROOT/index.jsp" adding the following code at the bottom of the JSP ``` <% String bigString = "<span style=\"color: red;\">This is a big string</span>"; for (int i = 0; i < 100; i++) { bigString += "<span style=\"display: none;\">This is a big string</span>"; } request.setAttribute("bigString", bigString); request.setAttribute("length", bigString.length()); %> <p>isCommitted=<%= response.isCommitted() %></p> <p>${bigString}</p> <p>length=${length/1024}</p> <p>isCommitted=<%= response.isCommitted() %></p> <p>Before Include</p> <jsp:include page="include.jsp"/> <p>After Include</p> ``` 3 - Start Tomcat (using Java 17) 4 - Load page http://localhost:8080/ 5 - The text "I've been included!" is missingI cannot really reproduce it (tried on trunk). You should look at the log files. If there is a problem including it should be reported there instead of getting an error report in the browser (since the repose is committed already, as you can see). I did run into this situation by accident due to my page directive (I copied from index.jsp), which had <%@ page session="false", and the included resource did not. This then produced an exception when the included page wanted a session. This was in the logs as an ISE.
Just to confirm, I see the same behaviour as Rémy. Once I add <%@ page session="false"%> at the start of include.jsp the test case works as expected. Mark --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
