You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Sean Kendall - NASource Imports <se...@nasource.com> on 2012/06/12 03:46:17 UTC

References not loading correctly. Wicket 1.5.7

I am not sure if this is something I am missing or a bug in wicket (1.5.7)
(Tomcat 6)

Basically, I am trying to add CSS and JS references to my 'BasePage'
(extends WebPage) and my references are not loading.
The actual markup has a link to the JS and CSS files, yet they do not link
to the actual files.

Here is the basic setup of my 'BasePage.class'

<code>

public abstract class BasePage extends WebPage implements
IHeaderContributor{

protected BasePage() {
        initPage();
    }

private void initPage() {
this.setStatelessHint(true);
//add a bunch of componentsŠ
Add(some new Component);
//end of my adding component code
}//end of initPage

public void renderHead(IHeaderResponse response) {

        response.renderCSSReference(new CssResourceReference(WebDummy.class,
"css/wicketIsAwesome.css"), "screen");
        response.renderJavaScriptReference(new
JavaScriptResourceReference(WebDummy.class, "js/javascriptRocks.js"));
        response.renderJavaScriptReference(new
JavaScriptResourceReference(WebDummy.class, "js/lightbox.js"));
        response.renderCSSReference(new CssResourceReference(WebDummy.class,
"css/commonCss.css"));
//add to some page
        if (this instanceof AwesomeWicketPage) {
            response.renderCSSReference(new
CssResourceReference(WebDummy.class, "css/jqu.jqz.css"));
            response.renderJavaScriptReference(new
JavaScriptResourceReference(WebDummy.class, "js/libjs-1.6.js"));
            response.renderJavaScriptReference(new
JavaScriptResourceReference(WebDummy.class, "js/mylibsJs-core.js"));
        }
}//end of renderHead
}//end of class
</code>

This is my Directory Structure (hopefully this makes sense):
-src (directory)
---main (directory)
------java (directory)
--------com.company (directory)
-----------com.company.common (directory)
-------------------------------BasePage.class
-------------------------------BasePage.html
-----------com.company.web (directory)
-------------------------------WebDummy.class
-------------------------------com.company.web.js  (directory)
-------------------------------------------javascriptRocks.js
-------------------------------------------lightbox.js
-------------------------------------------libjs-1.6.js
-------------------------------------------mylibsJs-core.js
-------------------------------com.company.web.css (directory)
-------------------------------------------wicketIsAwesome.css
-------------------------------------------commonCss.css
-------------------------------------------jqu.jqz.css


Anyone?








Re: References not loading correctly. Wicket 1.5.7

Posted by Martin Grigorov <mg...@apache.org>.
Hi,

Please create a quickstart and attach it to a ticket in Jira.

On Wed, Jun 13, 2012 at 4:12 AM, Sean Kendall - NASource Imports
<se...@nasource.com> wrote:
> I wish it as that easy.   :p
>
> I did add in the super.renderHead(response); call (and I already had it
> set in child classes).
>
> But still my styles are not showing up. The other weird thing is that if I
> shutdown my app, re-create the artifacts and basically redeploy; the first
> time I open my 'HomePage' I see all my styles again, but after doing a
> page refresh, all styles are removed again and the following WARNING shows:
>
> WARN  - ResourceReferenceRegistry  - Asked to auto-create a
> ResourceReference, but
> ResourceReferenceRegistry.createDefaultResourceReference() return null.
> [scope: com.company.web.WebDummy; name: jquery/js/jquery.myjavascript.js;
> locale: null; style: null; variation: null]
>
> Possibly is a caching problem?
>
>
>
>
>
>
>
> On 12-06-12 12:24 AM, "Martin Grigorov" <mg...@apache.org> wrote:
>
>>Hi,
>>
>>On Tue, Jun 12, 2012 at 4:46 AM, Sean Kendall - NASource Imports
>><se...@nasource.com> wrote:
>>> I am not sure if this is something I am missing or a bug in wicket
>>>(1.5.7)
>>> (Tomcat 6)
>>>
>>> Basically, I am trying to add CSS and JS references to my 'BasePage'
>>> (extends WebPage) and my references are not loading.
>>> The actual markup has a link to the JS and CSS files, yet they do not
>>>link
>>> to the actual files.
>>>
>>> Here is the basic setup of my 'BasePage.class'
>>>
>>> <code>
>>>
>>> public abstract class BasePage extends WebPage implements
>>> IHeaderContributor{
>>
>>No need to implement IHeaderContributor.
>>o.a.w.Component does this for you in 1.5.x.
>>
>>>
>>> protected BasePage() {
>>>        initPage();
>>>    }
>>>
>>> private void initPage() {
>>> this.setStatelessHint(true);
>>> //add a bunch of componentsŠ
>>> Add(some new Component);
>>> //end of my adding component code
>>> }//end of initPage
>>>
>>> public void renderHead(IHeaderResponse response) {
>>
>>I see you do not call: super.renderHead(response).
>>For the base page it is not really needed but if you skip this call in
>>the children pages' #renderHead() then the following code wont be
>>executed and this will lead to the problem you describe.
>>
>>>
>>>        response.renderCSSReference(new
>>>CssResourceReference(WebDummy.class,
>>> "css/wicketIsAwesome.css"), "screen");
>>>        response.renderJavaScriptReference(new
>>> JavaScriptResourceReference(WebDummy.class, "js/javascriptRocks.js"));
>>>        response.renderJavaScriptReference(new
>>> JavaScriptResourceReference(WebDummy.class, "js/lightbox.js"));
>>>        response.renderCSSReference(new
>>>CssResourceReference(WebDummy.class,
>>> "css/commonCss.css"));
>>> //add to some page
>>>        if (this instanceof AwesomeWicketPage) {
>>>            response.renderCSSReference(new
>>> CssResourceReference(WebDummy.class, "css/jqu.jqz.css"));
>>>            response.renderJavaScriptReference(new
>>> JavaScriptResourceReference(WebDummy.class, "js/libjs-1.6.js"));
>>>            response.renderJavaScriptReference(new
>>> JavaScriptResourceReference(WebDummy.class, "js/mylibsJs-core.js"));
>>>        }
>>> }//end of renderHead
>>> }//end of class
>>> </code>
>>>
>>> This is my Directory Structure (hopefully this makes sense):
>>> -src (directory)
>>> ---main (directory)
>>> ------java (directory)
>>> --------com.company (directory)
>>> -----------com.company.common (directory)
>>> -------------------------------BasePage.class
>>> -------------------------------BasePage.html
>>> -----------com.company.web (directory)
>>> -------------------------------WebDummy.class
>>> -------------------------------com.company.web.js  (directory)
>>> -------------------------------------------javascriptRocks.js
>>> -------------------------------------------lightbox.js
>>> -------------------------------------------libjs-1.6.js
>>> -------------------------------------------mylibsJs-core.js
>>> -------------------------------com.company.web.css (directory)
>>> -------------------------------------------wicketIsAwesome.css
>>> -------------------------------------------commonCss.css
>>> -------------------------------------------jqu.jqz.css
>>>
>>>
>>> Anyone?
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>
>>
>>
>>--
>>Martin Grigorov
>>jWeekend
>>Training, Consulting, Development
>>http://jWeekend.com
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>For additional commands, e-mail: users-help@wicket.apache.org
>>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>



-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: References not loading correctly. Wicket 1.5.7

Posted by vineet semwal <vi...@gmail.com>.
it actually means can't find "jquery.myjavascript.js" at the path you
provided ie. the path relative to WebDummy
so do you have that file in  com/company/web/jquery/js directory?

On Wed, Jun 13, 2012 at 6:42 AM, Sean Kendall - NASource Imports
<se...@nasource.com> wrote:
> I wish it as that easy.   :p
>
> I did add in the super.renderHead(response); call (and I already had it
> set in child classes).
>
> But still my styles are not showing up. The other weird thing is that if I
> shutdown my app, re-create the artifacts and basically redeploy; the first
> time I open my 'HomePage' I see all my styles again, but after doing a
> page refresh, all styles are removed again and the following WARNING shows:
>
> WARN  - ResourceReferenceRegistry  - Asked to auto-create a
> ResourceReference, but
> ResourceReferenceRegistry.createDefaultResourceReference() return null.
> [scope: com.company.web.WebDummy; name: jquery/js/jquery.myjavascript.js;
> locale: null; style: null; variation: null]
>
> Possibly is a caching problem?
>
>
>
>
>
>
>
> On 12-06-12 12:24 AM, "Martin Grigorov" <mg...@apache.org> wrote:
>
>>Hi,
>>
>>On Tue, Jun 12, 2012 at 4:46 AM, Sean Kendall - NASource Imports
>><se...@nasource.com> wrote:
>>> I am not sure if this is something I am missing or a bug in wicket
>>>(1.5.7)
>>> (Tomcat 6)
>>>
>>> Basically, I am trying to add CSS and JS references to my 'BasePage'
>>> (extends WebPage) and my references are not loading.
>>> The actual markup has a link to the JS and CSS files, yet they do not
>>>link
>>> to the actual files.
>>>
>>> Here is the basic setup of my 'BasePage.class'
>>>
>>> <code>
>>>
>>> public abstract class BasePage extends WebPage implements
>>> IHeaderContributor{
>>
>>No need to implement IHeaderContributor.
>>o.a.w.Component does this for you in 1.5.x.
>>
>>>
>>> protected BasePage() {
>>>        initPage();
>>>    }
>>>
>>> private void initPage() {
>>> this.setStatelessHint(true);
>>> //add a bunch of componentsŠ
>>> Add(some new Component);
>>> //end of my adding component code
>>> }//end of initPage
>>>
>>> public void renderHead(IHeaderResponse response) {
>>
>>I see you do not call: super.renderHead(response).
>>For the base page it is not really needed but if you skip this call in
>>the children pages' #renderHead() then the following code wont be
>>executed and this will lead to the problem you describe.
>>
>>>
>>>        response.renderCSSReference(new
>>>CssResourceReference(WebDummy.class,
>>> "css/wicketIsAwesome.css"), "screen");
>>>        response.renderJavaScriptReference(new
>>> JavaScriptResourceReference(WebDummy.class, "js/javascriptRocks.js"));
>>>        response.renderJavaScriptReference(new
>>> JavaScriptResourceReference(WebDummy.class, "js/lightbox.js"));
>>>        response.renderCSSReference(new
>>>CssResourceReference(WebDummy.class,
>>> "css/commonCss.css"));
>>> //add to some page
>>>        if (this instanceof AwesomeWicketPage) {
>>>            response.renderCSSReference(new
>>> CssResourceReference(WebDummy.class, "css/jqu.jqz.css"));
>>>            response.renderJavaScriptReference(new
>>> JavaScriptResourceReference(WebDummy.class, "js/libjs-1.6.js"));
>>>            response.renderJavaScriptReference(new
>>> JavaScriptResourceReference(WebDummy.class, "js/mylibsJs-core.js"));
>>>        }
>>> }//end of renderHead
>>> }//end of class
>>> </code>
>>>
>>> This is my Directory Structure (hopefully this makes sense):
>>> -src (directory)
>>> ---main (directory)
>>> ------java (directory)
>>> --------com.company (directory)
>>> -----------com.company.common (directory)
>>> -------------------------------BasePage.class
>>> -------------------------------BasePage.html
>>> -----------com.company.web (directory)
>>> -------------------------------WebDummy.class
>>> -------------------------------com.company.web.js  (directory)
>>> -------------------------------------------javascriptRocks.js
>>> -------------------------------------------lightbox.js
>>> -------------------------------------------libjs-1.6.js
>>> -------------------------------------------mylibsJs-core.js
>>> -------------------------------com.company.web.css (directory)
>>> -------------------------------------------wicketIsAwesome.css
>>> -------------------------------------------commonCss.css
>>> -------------------------------------------jqu.jqz.css
>>>
>>>
>>> Anyone?
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>
>>
>>
>>--
>>Martin Grigorov
>>jWeekend
>>Training, Consulting, Development
>>http://jWeekend.com
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>For additional commands, e-mail: users-help@wicket.apache.org
>>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>



-- 
thanks,

Vineet Semwal

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: References not loading correctly. Wicket 1.5.7

Posted by Sean Kendall - NASource Imports <se...@nasource.com>.
I wish it as that easy.   :p

I did add in the super.renderHead(response); call (and I already had it
set in child classes).

But still my styles are not showing up. The other weird thing is that if I
shutdown my app, re-create the artifacts and basically redeploy; the first
time I open my 'HomePage' I see all my styles again, but after doing a
page refresh, all styles are removed again and the following WARNING shows:

WARN  - ResourceReferenceRegistry  - Asked to auto-create a
ResourceReference, but
ResourceReferenceRegistry.createDefaultResourceReference() return null.
[scope: com.company.web.WebDummy; name: jquery/js/jquery.myjavascript.js;
locale: null; style: null; variation: null]

Possibly is a caching problem?







On 12-06-12 12:24 AM, "Martin Grigorov" <mg...@apache.org> wrote:

>Hi,
>
>On Tue, Jun 12, 2012 at 4:46 AM, Sean Kendall - NASource Imports
><se...@nasource.com> wrote:
>> I am not sure if this is something I am missing or a bug in wicket
>>(1.5.7)
>> (Tomcat 6)
>>
>> Basically, I am trying to add CSS and JS references to my 'BasePage'
>> (extends WebPage) and my references are not loading.
>> The actual markup has a link to the JS and CSS files, yet they do not
>>link
>> to the actual files.
>>
>> Here is the basic setup of my 'BasePage.class'
>>
>> <code>
>>
>> public abstract class BasePage extends WebPage implements
>> IHeaderContributor{
>
>No need to implement IHeaderContributor.
>o.a.w.Component does this for you in 1.5.x.
>
>>
>> protected BasePage() {
>>        initPage();
>>    }
>>
>> private void initPage() {
>> this.setStatelessHint(true);
>> //add a bunch of componentsŠ
>> Add(some new Component);
>> //end of my adding component code
>> }//end of initPage
>>
>> public void renderHead(IHeaderResponse response) {
>
>I see you do not call: super.renderHead(response).
>For the base page it is not really needed but if you skip this call in
>the children pages' #renderHead() then the following code wont be
>executed and this will lead to the problem you describe.
>
>>
>>        response.renderCSSReference(new
>>CssResourceReference(WebDummy.class,
>> "css/wicketIsAwesome.css"), "screen");
>>        response.renderJavaScriptReference(new
>> JavaScriptResourceReference(WebDummy.class, "js/javascriptRocks.js"));
>>        response.renderJavaScriptReference(new
>> JavaScriptResourceReference(WebDummy.class, "js/lightbox.js"));
>>        response.renderCSSReference(new
>>CssResourceReference(WebDummy.class,
>> "css/commonCss.css"));
>> //add to some page
>>        if (this instanceof AwesomeWicketPage) {
>>            response.renderCSSReference(new
>> CssResourceReference(WebDummy.class, "css/jqu.jqz.css"));
>>            response.renderJavaScriptReference(new
>> JavaScriptResourceReference(WebDummy.class, "js/libjs-1.6.js"));
>>            response.renderJavaScriptReference(new
>> JavaScriptResourceReference(WebDummy.class, "js/mylibsJs-core.js"));
>>        }
>> }//end of renderHead
>> }//end of class
>> </code>
>>
>> This is my Directory Structure (hopefully this makes sense):
>> -src (directory)
>> ---main (directory)
>> ------java (directory)
>> --------com.company (directory)
>> -----------com.company.common (directory)
>> -------------------------------BasePage.class
>> -------------------------------BasePage.html
>> -----------com.company.web (directory)
>> -------------------------------WebDummy.class
>> -------------------------------com.company.web.js  (directory)
>> -------------------------------------------javascriptRocks.js
>> -------------------------------------------lightbox.js
>> -------------------------------------------libjs-1.6.js
>> -------------------------------------------mylibsJs-core.js
>> -------------------------------com.company.web.css (directory)
>> -------------------------------------------wicketIsAwesome.css
>> -------------------------------------------commonCss.css
>> -------------------------------------------jqu.jqz.css
>>
>>
>> Anyone?
>>
>>
>>
>>
>>
>>
>>
>
>
>
>-- 
>Martin Grigorov
>jWeekend
>Training, Consulting, Development
>http://jWeekend.com
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>For additional commands, e-mail: users-help@wicket.apache.org
>



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: References not loading correctly. Wicket 1.5.7

Posted by Martin Grigorov <mg...@apache.org>.
Hi,

On Tue, Jun 12, 2012 at 4:46 AM, Sean Kendall - NASource Imports
<se...@nasource.com> wrote:
> I am not sure if this is something I am missing or a bug in wicket (1.5.7)
> (Tomcat 6)
>
> Basically, I am trying to add CSS and JS references to my 'BasePage'
> (extends WebPage) and my references are not loading.
> The actual markup has a link to the JS and CSS files, yet they do not link
> to the actual files.
>
> Here is the basic setup of my 'BasePage.class'
>
> <code>
>
> public abstract class BasePage extends WebPage implements
> IHeaderContributor{

No need to implement IHeaderContributor.
o.a.w.Component does this for you in 1.5.x.

>
> protected BasePage() {
>        initPage();
>    }
>
> private void initPage() {
> this.setStatelessHint(true);
> //add a bunch of componentsŠ
> Add(some new Component);
> //end of my adding component code
> }//end of initPage
>
> public void renderHead(IHeaderResponse response) {

I see you do not call: super.renderHead(response).
For the base page it is not really needed but if you skip this call in
the children pages' #renderHead() then the following code wont be
executed and this will lead to the problem you describe.

>
>        response.renderCSSReference(new CssResourceReference(WebDummy.class,
> "css/wicketIsAwesome.css"), "screen");
>        response.renderJavaScriptReference(new
> JavaScriptResourceReference(WebDummy.class, "js/javascriptRocks.js"));
>        response.renderJavaScriptReference(new
> JavaScriptResourceReference(WebDummy.class, "js/lightbox.js"));
>        response.renderCSSReference(new CssResourceReference(WebDummy.class,
> "css/commonCss.css"));
> //add to some page
>        if (this instanceof AwesomeWicketPage) {
>            response.renderCSSReference(new
> CssResourceReference(WebDummy.class, "css/jqu.jqz.css"));
>            response.renderJavaScriptReference(new
> JavaScriptResourceReference(WebDummy.class, "js/libjs-1.6.js"));
>            response.renderJavaScriptReference(new
> JavaScriptResourceReference(WebDummy.class, "js/mylibsJs-core.js"));
>        }
> }//end of renderHead
> }//end of class
> </code>
>
> This is my Directory Structure (hopefully this makes sense):
> -src (directory)
> ---main (directory)
> ------java (directory)
> --------com.company (directory)
> -----------com.company.common (directory)
> -------------------------------BasePage.class
> -------------------------------BasePage.html
> -----------com.company.web (directory)
> -------------------------------WebDummy.class
> -------------------------------com.company.web.js  (directory)
> -------------------------------------------javascriptRocks.js
> -------------------------------------------lightbox.js
> -------------------------------------------libjs-1.6.js
> -------------------------------------------mylibsJs-core.js
> -------------------------------com.company.web.css (directory)
> -------------------------------------------wicketIsAwesome.css
> -------------------------------------------commonCss.css
> -------------------------------------------jqu.jqz.css
>
>
> Anyone?
>
>
>
>
>
>
>



-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org