hello guillaume. a typical solution is to define another "common" resource types for your components and reference it as "sling:resourceSuperType", see [1], [2]
then you can move your comment.jsp to the folder of the "common" resource type and it is usable from all components inheriting from this. stefan [1] https://sling.apache.org/documentation/the-sling-engine/url-to-script-resolution.html#base-resource-type-inheritance [2] http://stackoverflow.com/questions/22708055/how-does-apache-sling-script-resolving-rules-work >-----Original Message----- >From: Guillaume Lucazeau [mailto:glucaz...@gmail.com] >Sent: Tuesday, November 17, 2015 4:27 PM >To: users@sling.apache.org >Subject: Include same comment form from different resource type's views > >Hello, > >not sure the subject is clear... >I have this simple structure: >- document >-- page(s) >--- component(s) : 1 to 4 on each page > >Those components can be of different type : image, text, map, graph. For >each I have a different sling:resourceType for the node and a corresponding >view (JSP) > >I'd like to have a form on each component, to allow user to add comments. >They would be created under this path: >/document/pages/page1/components/component1/comments/* > >For now I have only two component types: text and image >so in imageComponent/html.jsp I have this: > ><sling:include path="${resource.path}" replaceSelectors="comment"/> > >and next to html.jsp I have comment.jsp which contains this form: <form >method="POST" action="${resource.path}/comments/*" /> > >But I have the same in textComponent/. And so far I would have to duplicate >this form for each component type. I'm pretty sure there is a better way to >do it but I don't know how. > >Having a specifig resourceType for the comment form would allow me to have >only one, but then I don't know how I could pass the "action" parameter >(e.g. the resource path) to this view. > >I bet it's a simple requirement but I didn't find any tips in the document >nor in some examples I've found online. > >Thank you for your help! > >Regards, >Guillaume