users@javaserverfaces.java.net

Re: Resource issue when upgrading from JSF 2.0.9 -> 2.1.13

From: Stephen More <stephen.more_at_gmail.com>
Date: Thu, 18 Oct 2012 17:15:37 -0400

Here are the results of more of my testing. My web application works
as expected with JSF versions:
2.0.9
2.1.6
2.1.7

On the following versions, I will see a trailing resource script that
should be inside of <HEAD/>
2.1.8
2.1.10
2.1.13


In my tests, the only thing that has changed is the JSF version. Which
leads me to believe it is a JSF issue. Is there any insight what
changed in version 2.1.8 to create this bug ?


-Stephen More


On Tue, Oct 16, 2012 at 11:38 AM, Stephen More <stephen.more_at_gmail.com> wrote:
> I am looking into the primefaces code, but I am not seeing any issue.
>
> According to Ryan Lubke:
> http://css.dzone.com/news/jsf-20-new-feature-preview-ser-4
>
> @ResourceDependencies({
> @ResourceDependency(library="primefaces", name="jquery/jquery.js"),
> @ResourceDependency(library="primefaces", name="primefaces.js")
> })
>
> "When the page author uses these components, they'll not need to know
> anything about any of the stylesheets or scripts. The necessary
> dependencies will be rendered as needed without further action."
>
> So how does this work under the covers? Glad you asked. Let's base the
> follow of the component example with the single @ResourceDependency
> annotation.
> The Facelets runtime will create the component
> The component will be added as a child to some other component. Before
> returning from the add() method, the component will be checked for
> @ResourceDependency annotations (either the singluar or plural
> version).
> The @ResourceDependency is found. A new UIOutput component instance is created.
> The ResourceHandler is queried for an appropriate Renderer based on
> the content type of the resource, which in this case is text/css, so
> the style sheet renderer will be set as the Rendere for this new
> UIOutput.
> The values of the name, library, and target attributes (library and
> target are optional) from the annotation are stored in the component's
> attribute map.
> UIViewRoot.addComponentResource() is called passing in the UIOutput
> and the value of target attribute from the annotation (if any)
>
> I might be mistaken, but it sounds like alot of the above logic would
> exist in the JSF layer not the Prime layer.
> This is working fine in 2.0.9 but not in 2.1.13 ( my primefaces
> version has not changed ).
>
> I have started a thread
> http://forum.primefaces.org/viewtopic.php?f=3&t=25477 so hopefully I
> can get to the bottom of this one way or another.
>
>
> -Stephen More
>
>
> On Tue, Oct 16, 2012 at 11:13 AM, Manfred Riem <manfred.riem_at_oracle.com> wrote:
>> Hi Stephen,
>>
>> Since you are stating that it seems that the PrimeFaces snippet
>> is rendered at the end I would recommend asking this question
>> on the PrimeFaces forum.
>>
>> Manfred
>>
>>
>> On 10/16/2012 10:06 AM, Stephen More wrote:
>>>
>>> Today I decided to upgrade my JSF from 2.0.9 to 2.1.13. ( I am
>>> currently using primefaces 3.4.1. )
>>>
>>> In 2.0.9 and most of my pages in 2.1.13, jquery script appears inside
>>> of the head element like it should:
>>> Code:
>>> <head> ...<script type="text/javascript"
>>>
>>> src="/pro/javax.faces.resource/jquery/jquery.js.jsf?ln=primefaces"></script>
>>> ...</head>
>>>
>>> But in certain pages using JSF 2.1.13, jquery script appears at the
>>> VERY end of the html:
>>> Code:
>>> </body></html><script type="text/javascript"
>>>
>>> src="/pro/javax.faces.resource/jquery/jquery.js.jsf?ln=primefaces"></script>
>>>
>>> which in turn breaks my ajax calls.
>>>
>>> Is this a known bug ? ( With JSF or prime ? ) Is there a fix/workaround ?
>>>
>>>
>>>
>>> -Stephen More