Hi,

janandith jayawardena schrieb:
Hi,

Thanks Bertrand.

When I use ,

<sling:include addSelectors="selector"  replaceSelectors="replace" />

I get the content of replace.jsp

Point is, that the addSelectors and replaceSelectors are also in fact mutually exclusive in the sense that addSelectors is ignored if replaceSelectors is set.

Hence the inclusion of replace.jsp is expected.


and

when I use ,

<sling:include addSelectors="selector"/>
<sling:include addSelectors="selector"  replaceSelectors="replace" />

I get both selector.jsp and replace.jsp content.

Similar here: The first include includes the selector.jsp, while the second includes replace.jsp for the reasons explained above.


I tried this,

<sling:include addSelectors="selector"/>
<sling:include flush=true />
<sling:include addSelectors="selector"  replaceSelectors="replace" />

hoping flush will erase initial selector.jsp content but there is no content
and the program fails.

This is a dangerouse one because of the second line with the "flush" attribute: The flush attribute says to write the current contents of the output buffer out to the response (and not erase the buffer as you might expect). In addition this tag will recursively include the same script again, which should result in an exception being thrown.


I want to test with all these tags in one html.jsp file. how can I use the
replaceSelector to replace selector.jsp with replace.jsp.

I do not exactly understand what you are trying to achieve. Do you have three scripts -- html.jsp, selector.jsp and replace.jsp ? And you request http://host/something.html and have the html.jsp being called.

Now what is next ?



Also why does the whole script fail when using flush. What is the correct
way to use it.

Due to a recursive inclusion of itself and the exception bein thrown. This has nothing to do with the flush attribute but with the include itself, which just includes the current resource with the same selectors and extension and therefore resolves to the same script over and over again until too many scripts are included and an exception is thrown.

Regards
Felix

Reply via email to