I'm going to assume some typos, but it looks like you have your paths confused.
In your Sling Include statement, you're including:
but you're pulling up:
I would think that using the following would work (assuming that part was a typo for par and comapny was a typo and you mean company:
<sling:include path="/content/company/en/product/jcr:content/par/textimage" />
Oops, sorry about the typo, It actually meant I did use
<sling:include path= "/content/company/en/product/jcr:content/par/textimage"/> to try to pull the content, but it doens't pulling the content and is not returning anything.
That is correct, "http://localhost:4502/content/company/en/product/jcr:content/par/textimage.html" renders fine.
I just added a 'getHtml.jsp" in "/apps/company/components/textimage" and change the <sling:include> to
And that worked.
However, getHtml.jsp is a simplified version of textimage.jsp, so maybe some stuff was preventing it from rendering properly in the original include without ".getHtml"..
First, check out the OSGi console's "Recent Requests" to debug the issue (/system/console/requests). It should give you a complete break down of the request to the page, including useful debug info about how your sling:include is being resolved to a resource in the system (e.g. the resource path, selectors and extensions used, what it thinks it resolved to, what script it's trying to use, etc).
Second, try either adding a .html to your absolute include path or else try using a relative path; when using a full, absolute path I'm wondering if Sling is not carrying the extension over from the original request like it normally would. So an include on "/content/company/en/product/jcr:content/par/textimage" might find the resource, but not know what to do with it because it's dropped the html extension that it should have carried over from the original request. Using the recent requests output should clearly indicate if this is happening. This would make sense with the fact that adding .getHtml works with your custom getHtml script, because that's adding in a selector that Sling can use to resolve the correct script.
Third, you could try using the resource attribute of the sling:include rather than the path attribute. You would first have to fetch this child par/textimage resource from the current resource object (either getChild or using the resource resolver, not sure which would be required).
Fourth, is there a specific reason you aren't using the cq:include tag instead?
It's a complicated requirement. But, bascally, I need to loop through all the components on a page, get the HTML of each component as a String, and then append them all togther in a JSON response. So, I have to dynamically general the JSP (using <sling:include>) to render the HTML, and output that as a String and pass that back to the original JSON request.
I would use <cq:include> if it works, but it doesn't, not sure what the diff is between them but <sling:include> works for now.