You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Entropy <bl...@gmail.com> on 2013/03/06 17:14:38 UTC
JS and CSS package references
So I am trying to do the package resource reference thing.
https://cwiki.apache.org/WICKET/adding-javascript-or-css-using-a-resource.html
https://cwiki.apache.org/WICKET/including-css-resources.html
However, I am clearly not doing it right. The URLs rendered look like:
<script
src="resources/gov.usdoj.afms.shared.wicket.ext.grid.ExtGrid$1/ExtGridSupport.js"
type="text/javascript">
<link
href="resources/gov.usdoj.afms.shared.wicket.ext.grid.ExtGrid$1/extjs.css"
type="text/css" rel="stylesheet">
These are broken links in the browser.
I tried putting a package reference in front of them and that just prepends
the package in front of the slash befor ethe file name, but it also does not
work. My code is:
response.renderJavascriptReference(new
PackageResourceReference(this.getClass(),
/*this.getClass().getPackage().getName() +*/
"ExtGridSupport.js"));
response.renderCSSReference(new
PackageResourceReference(this.getClass(),
/*this.getClass().getPackage().getName() +*/
"extjs.css"));
The resources (js and css files) are in the same package as the invoking
class. Any ideas what I am doing wrong here?
--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/JS-and-CSS-package-references-tp4657034.html
Sent from the Users forum mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: JS and CSS package references
Posted by Entropy <bl...@gmail.com>.
Ack. You were right. I was doing it in an anonymous class. I thought I was
in ExtGrid itself. Changing it worked. Thanks folks.
--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/JS-and-CSS-package-references-tp4657034p4657059.html
Sent from the Users forum mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: JS and CSS package references
Posted by Martin Grigorov <mg...@apache.org>.
On Wed, Mar 6, 2013 at 6:51 PM, Ernesto Reinaldo Barreiro <
reiern70@gmail.com> wrote:
> Hi,
>
> On Wed, Mar 6, 2013 at 5:44 PM, Entropy <bl...@gmail.com> wrote:
>
> > That's exactly what i am doing. Notice the comment marks /* and */
> around
> > the package stuff. I tried it both ways. And "this" in this case is
> > ExtGrid.java. So I am also sending in that class.
> >
>
> I think the URLs are telling you this.getClass() != ExtGrid.class. Can you
> paste whole panel code?
>
Exactly!
Note the '$1' in the class name. This means the class is an anonymous class
in ExtGrid.
Just use ExtGrid.class instead of this.getClass()
>
> >
> > So I have to pre-register these resources in some way or something? Note
> > that ExtGrid is a panel not a page, so the resources aren't in the same
> > pacakge as the page. Would that matter?
> >
> >
> No, it should not matter.
>
>
> >
> >
> > --
> > View this message in context:
> >
> http://apache-wicket.1842946.n4.nabble.com/JS-and-CSS-package-references-tp4657034p4657038.html
> > Sent from the Users forum mailing list archive at Nabble.com.
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > For additional commands, e-mail: users-help@wicket.apache.org
> >
> >
>
>
> --
> Regards - Ernesto Reinaldo Barreiro
> Antilia Soft
> http://antiliasoft.com/ <http://antiliasoft.com/antilia>
>
--
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com <http://jweekend.com/>
Re: JS and CSS package references
Posted by Ernesto Reinaldo Barreiro <re...@gmail.com>.
Hi,
On Wed, Mar 6, 2013 at 5:44 PM, Entropy <bl...@gmail.com> wrote:
> That's exactly what i am doing. Notice the comment marks /* and */ around
> the package stuff. I tried it both ways. And "this" in this case is
> ExtGrid.java. So I am also sending in that class.
>
I think the URLs are telling you this.getClass() != ExtGrid.class. Can you
paste whole panel code?
>
> So I have to pre-register these resources in some way or something? Note
> that ExtGrid is a panel not a page, so the resources aren't in the same
> pacakge as the page. Would that matter?
>
>
No, it should not matter.
>
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/JS-and-CSS-package-references-tp4657034p4657038.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
--
Regards - Ernesto Reinaldo Barreiro
Antilia Soft
http://antiliasoft.com/ <http://antiliasoft.com/antilia>
Re: JS and CSS package references
Posted by Entropy <bl...@gmail.com>.
That's exactly what i am doing. Notice the comment marks /* and */ around
the package stuff. I tried it both ways. And "this" in this case is
ExtGrid.java. So I am also sending in that class.
So I have to pre-register these resources in some way or something? Note
that ExtGrid is a panel not a page, so the resources aren't in the same
pacakge as the page. Would that matter?
--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/JS-and-CSS-package-references-tp4657034p4657038.html
Sent from the Users forum mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: JS and CSS package references
Posted by Ernesto Reinaldo Barreiro <re...@gmail.com>.
Assuming
ExtGridSupport.js
extjs.css
sit next to ExtGrid class just do
response.renderJavascriptReference(new PackageResourceReference(
ExtGrid.class,"ExtGridSupport.js"));
On Wed, Mar 6, 2013 at 5:14 PM, Entropy <bl...@gmail.com> wrote:
> So I am trying to do the package resource reference thing.
>
> https://cwiki.apache.org/WICKET/adding-javascript-or-css-using-a-resource.html
> https://cwiki.apache.org/WICKET/including-css-resources.html
>
> However, I am clearly not doing it right. The URLs rendered look like:
>
> <script
>
> src="resources/gov.usdoj.afms.shared.wicket.ext.grid.ExtGrid$1/ExtGridSupport.js"
> type="text/javascript">
> <link
> href="resources/gov.usdoj.afms.shared.wicket.ext.grid.ExtGrid$1/extjs.css"
> type="text/css" rel="stylesheet">
>
> These are broken links in the browser.
>
> I tried putting a package reference in front of them and that just prepends
> the package in front of the slash befor ethe file name, but it also does
> not
> work. My code is:
>
> response.renderJavascriptReference(new
> PackageResourceReference(this.getClass(),
> /*this.getClass().getPackage().getName() +*/
> "ExtGridSupport.js"));
> response.renderCSSReference(new
> PackageResourceReference(this.getClass(),
> /*this.getClass().getPackage().getName() +*/
> "extjs.css"));
>
> The resources (js and css files) are in the same package as the invoking
> class. Any ideas what I am doing wrong here?
>
>
>
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/JS-and-CSS-package-references-tp4657034.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
--
Regards - Ernesto Reinaldo Barreiro
Antilia Soft
http://antiliasoft.com/ <http://antiliasoft.com/antilia>