IMHO the big selling point of OSGi, is the ability to add additional packages 
as you go. If the package is needing an api of a particular version that isn't 
in your environment it just won't turn on.

If the bundle is defined correctly, which I admit, seems to be a difficult 
thing to do. Then the version of the bundle is less important then the package 
version of the api's that it exports.

-Jason

-----Original Message-----
From: Roy Teeuwen [mailto:r...@teeuwen.be] 
Sent: Saturday, August 20, 2016 8:28 AM
To: users@sling.apache.org
Subject: Re: Sling models adaptTo taglib

Hey Dan,

Ok cool, thanks, I guess it is indeed just a patch version upgrade from 2.2.4 
to 2.2.6, so it’s worth a shot :)!

Greets
Roy
> On 19 Aug 2016, at 15:00, Daniel Klco <dk...@apache.org> wrote:
> 
> Roy,
> 
> You can pretty safely upgrade the version of Sling Taglibs without 
> upgrading the overall application version. If you include the newer 
> version of the bundle into your build package in a folder like 
> /apps/[app-name]/install, Sling will pick up the more recent version 
> of the bundle and install it. If you have any issues, you can force 
> Sling to recompile the JSP's from the OSGi console.
> 
> Regards,
> Dan
> 
> On Fri, Aug 19, 2016 at 7:37 AM, Roy Teeuwen <r...@teeuwen.be> wrote:
> 
>> Hey Júnior,
>> 
>> Thanks!
>> 
>> Darnit, it seems that I will have to wait until after the upgrade to 
>> AEM
>> 6.2 ;).
>> 
>> Greets,
>> Roy
>> 
>> 
>>> On 19 Aug 2016, at 13:34, Júnior <fjunio...@gmail.com> wrote:
>>> 
>>> Hi Roy,
>>> 
>>> There is an Issue about the problem you are facing:
>>> 
>>> https://issues.apache.org/jira/browse/SLING-5653
>>> 
>>> And it seems to be fixed. Not sure in which version it is included.
>>> 
>>> Thanks
>>> 
>>> 
>>> 2016-08-19 8:25 GMT-03:00 Roy Teeuwen <r...@teeuwen.be>:
>>> 
>>>> Hello all,
>>>> 
>>>> I am trying to use the sling models taglib, and I am using the 
>>>> following
>>>> input:
>>>> 
>>>> <%@ page import=“my.packages.TestModel" %>
>>>> 
>>>> <sling:adaptTo adaptable="${resource}" adaptTo="<%=TestModel.class.
>> getName()%>"
>>>> var="model"/>
>>>> <div>${model.testString}</div>
>>>> 
>>>> 
>>>> But when doing this, I get the following exception:
>>>> 
>>>> java.lang.ClassCastException: java.lang.Object cannot be cast to 
>>>> java.lang.String
>>>>       at javax.servlet.jsp.tagext.TagData.getAttributeString(
>>>> TagData.java:138)
>>>>       at org.apache.sling.scripting.jsp.taglib.tei.AdaptToTEI.
>>>> getClassName(AdaptToTEI.java:26)
>>>>       at org.apache.sling.scripting.jsp.taglib.tei.AbstractVarTEI.
>>>> getVariableInfo(AbstractVarTEI.java:78)
>>>> I would expect this to work? Is there any way I could get it to 
>>>> work
>> like
>>>> this? It is nicer if I can import it so that my IDE has a clearer 
>>>> sight
>> of
>>>> which classes are used in the jsp’s instead of having to write the
>> class as
>>>> a plain string form:
>>>> 
>>>> <sling:adaptTo adaptable="${resource}" adaptTo="my.packages.TestModel"
>>>> var="model"/>
>>>> <div>${model.testString}</div>
>>>> 
>>>> (I am used to working with slice from cognifide, and am not trying 
>>>> out sling models, in slice you could say <slice:lookup var=“model”
>>>> class=“<%=TestModel.class%>”/> without calling the getName but just
>> using
>>>> the class object )
>>>> 
>>>> Thanks!
>>>> Roy
>>> 
>>> 
>>> 
>>> 
>>> --
>>> Francisco Ribeiro
>>> *SCEA|SCJP|SCWCD|IBM Certified SOA Associate*
>> 
>> 

Reply via email to