[ 
https://issues.apache.org/jira/browse/SLING-567?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12623583#action_12623583
 ] 

Felix Meschberger commented on SLING-567:
-----------------------------------------

actually, what is returned is perfectly acceptable: The a.jsp uses a JspWriter 
around the response writer as its output channel. This JspWriter is caching. If 
you include a request, the included request uses another JspWriter around the 
response writer. When the include finishes the JspWriter of the included script 
is flushed to the response (hence the output "bbb bbb").

Only when the a.jsp also ends is the the JspWriter flushed (unless the buffer 
overrunns before, of course) is the cached output flushed to the response, 
hence the output "aaa 1 2".

To have the expected output, explicitly flush the JspWriter - either by setting 
flush attribute in the include tag or by calling out.flush() before inclusion.

> sling.include inclides fragments in the wrong order
> ---------------------------------------------------
>
>                 Key: SLING-567
>                 URL: https://issues.apache.org/jira/browse/SLING-567
>             Project: Sling
>          Issue Type: Bug
>    Affects Versions: Scripting JSP 2.0.2
>            Reporter: Michael Marth
>
> (This is observed in revision 670551)
> consider a jsp "/apps/myapp/a.jsp" which contains:
> aaa
> <% sling.include(currentNode.getPath() + ".b.html"); %>
> and another jsp "/apps/myapp/b.jsp" which contains
> bbb
> if i execute /content/myapp/mynode.a.html i get
> bbb
> aaa
> expected result is:
> aaa
> bbb

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to