Depending on the scope of the change between the regular and "simple"
views, one thing you could do is just have an if statement in your
center.jsp which does something like this:

<% if ("simple".equals(slingRequest.getSelectorString()) { %>
<!-- do the simple thing -->
<% } else { %>
<!-- do the non-simple thing -->
<% } %>

Within the if / else blocks, you could include other scripts of course.

HTH,
Justin

On Fri, Apr 1, 2011 at 5:27 AM, Marco Dohnke <[email protected]> wrote:
> Yes I know. I also tried several ways with the resourceSuperType. The problem 
> is:
>
> /apps/myapp/components/product/center.jsp overwrites 
> /apps/myapp/components/page/center.jsp because the resourceSuperType is set 
> on it.
>
> But a sling selector is not useable for that. If I use 
> /apps/.../product/simple.jsp I have to reimplement all what I implemented in 
> the page component. That's not very DRY. I thought there is a way to achieve 
> this.
>
> Kind regards,
> Marco
>
> -----Ursprüngliche Nachricht-----
> Von: Felix Meschberger [mailto:[email protected]]
> Gesendet: Freitag, 1. April 2011 10:50
> An: [email protected]
> Betreff: Re: Inheritance and URL decomposition
>
> Hi,
>
> Am Donnerstag, den 31.03.2011, 14:41 +0100 schrieb sam lee:
>> Day CQ mailing list is: http://groups.google.com/group/day-communique
>>
>> If the resource, /products/my-first-product ,  has sling:resourceType =
>> /apps/foo/product,
>> then, to render .html version of the resource,  /apps/foo/product/html.jsp
>> will be used.
>> To render simple.html version of the resource,
>> /apps/foo/product/simple.html.jsp will be used.
>>
>> You can do whatever you want in those .jsp files.
>>
>> I am not sure about inheritance.
>> You can set /products/my-first-product's  sling:resourceSuperType =
>> /apps/foo/page ..
>> But I am not sure if that will help for your script resolution (using
>> <sling:include/>).
>
> Yes, sling supports sling:resourceSuperType of course and thus all
> resolutions for scripts and servlets will check the resource type
> hierarchy.
>
> Regards
> Felix
>
>
>

Reply via email to