You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Ralf Eichinger <ra...@pixotec.de> on 2010/05/18 09:07:41 UTC
Re: Javascript template as linked header contribution?
Finally I made it working after finding this WIKI entry:
https://cwiki.apache.org/WICKET/dynamically-generate-a-css-stylesheet.html
Just used it the same way for Javascript file.
Igor: This very useful class should be integrated into Wicket core!
(under org.apache.wicket.markup.html.resources)
Am Montag, den 19.04.2010, 17:52 -0700 schrieb Igor Vaynberg:
> i meant you have to create the classes...
>
> -igor
>
> On Mon, Apr 19, 2010 at 4:10 PM, Ralf Eichinger
> <ra...@pixotec.de> wrote:
> > Am Montag, den 19.04.2010, 09:08 -0700 schrieb Igor Vaynberg:
> >> you will have to create a TextTemplateResource to serve such resources
> >> and a TextTemplateResourceReference to create urls for them.
> >>
> >> -igor
> >
> > as there are no TextTemplateResource and TextTemplateResourceReference
> > classes in Wicket 1.4.7, I tried this:
> >
> > PackagedTextTemplate jsTemplate = new
> > PackagedTextTemplate(this.getClass(), "js/lightbox.js");
> >
> > TextTemplateSharedResourceFactory ttsr = new
> > TextTemplateSharedResourceFactory(jsTemplate, this.getClass());
> >
> > String webappContext = WebApplication.get().getServletContext()
> > .getContextPath();
> >
> > Map<String, Object> parameters = new HashMap<String, Object>();
> > parameters.put("webappContext", webappContext);
> > TextTemplateLink ref = new TextTemplateLink("lightbox", ttsr,
> > parameters);
> > add(ref);
> >
> > and in panels html:
> >
> > <wicket:head>
> > <script wicket:id="lightbox" src="#" language="JavaScript"></script>
> > </wicket:head>
> >
> > this resulted in a rendered URL (that looks weired):
> >
> > <script wicket:id="lightbox" src="resources/LightBox2Panel/%2fnetcms"
> > language="JavaScript"></script>
> >
> > And this link returns a 404 error...
> >
> > So what's wrong?
> >
> >
> >
> > ---------------------------------------------------------------------
> > 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
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Javascript template as linked header contribution?
Posted by Igor Vaynberg <ig...@gmail.com>.
jira issue or this request never happened :)
-igor
On Tue, May 18, 2010 at 12:07 AM, Ralf Eichinger
<ra...@pixotec.de> wrote:
> Finally I made it working after finding this WIKI entry:
> https://cwiki.apache.org/WICKET/dynamically-generate-a-css-stylesheet.html
>
> Just used it the same way for Javascript file.
>
> Igor: This very useful class should be integrated into Wicket core!
> (under org.apache.wicket.markup.html.resources)
>
> Am Montag, den 19.04.2010, 17:52 -0700 schrieb Igor Vaynberg:
>> i meant you have to create the classes...
>>
>> -igor
>>
>> On Mon, Apr 19, 2010 at 4:10 PM, Ralf Eichinger
>> <ra...@pixotec.de> wrote:
>> > Am Montag, den 19.04.2010, 09:08 -0700 schrieb Igor Vaynberg:
>> >> you will have to create a TextTemplateResource to serve such resources
>> >> and a TextTemplateResourceReference to create urls for them.
>> >>
>> >> -igor
>> >
>> > as there are no TextTemplateResource and TextTemplateResourceReference
>> > classes in Wicket 1.4.7, I tried this:
>> >
>> > PackagedTextTemplate jsTemplate = new
>> > PackagedTextTemplate(this.getClass(), "js/lightbox.js");
>> >
>> > TextTemplateSharedResourceFactory ttsr = new
>> > TextTemplateSharedResourceFactory(jsTemplate, this.getClass());
>> >
>> > String webappContext = WebApplication.get().getServletContext()
>> > .getContextPath();
>> >
>> > Map<String, Object> parameters = new HashMap<String, Object>();
>> > parameters.put("webappContext", webappContext);
>> > TextTemplateLink ref = new TextTemplateLink("lightbox", ttsr,
>> > parameters);
>> > add(ref);
>> >
>> > and in panels html:
>> >
>> > <wicket:head>
>> > <script wicket:id="lightbox" src="#" language="JavaScript"></script>
>> > </wicket:head>
>> >
>> > this resulted in a rendered URL (that looks weired):
>> >
>> > <script wicket:id="lightbox" src="resources/LightBox2Panel/%2fnetcms"
>> > language="JavaScript"></script>
>> >
>> > And this link returns a 404 error...
>> >
>> > So what's wrong?
>> >
>> >
>> >
>> > ---------------------------------------------------------------------
>> > 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
>>
>
>
>
> ---------------------------------------------------------------------
> 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