You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Oscar Besga <ob...@gmail.com> on 2012/01/19 20:13:49 UTC

Java class and javascript

Hello.


I'm working into a wicket (1.4) project that now is in production, but we
have decided to move it from Wicket 1.4 to Wicket 1.5 - and correct/add
some features.

I've some problems with the migration, I can't find how to translate some
code from one version to another.

My greatest problem is:

I've a component with javascript code attached. The javascrit code is in a
file named equal as the class, f. ex. MyComponent.java MyComponent.js; in
the same package.

In Wicket 1.4 ; I simply use one line int he onRenderHead method
<code>
    @Override
    public void renderHead(IHeaderResponse response) {
        response.renderJavascriptReference(new
ResourceReference(HistoricoBehavior.class, "MyComponent.js"));
        super.renderHead(response);
    }
</code>

I've tried with PackcageResource,  a custom resource, etc. but I haven't
found a working way...

Have someone any ideas ?





-- 

             > > > Oscar Besga Arcauz < < <

Re: Java class and javascript

Posted by vineet semwal <vi...@gmail.com>.
 response.renderJavascriptReference(new
*PackageResourceReference*(HistoricoBehavior.class, "MyComponent.js"));

On Fri, Jan 20, 2012 at 12:43 AM, Oscar Besga <ob...@gmail.com> wrote:
> Hello.
>
>
> I'm working into a wicket (1.4) project that now is in production, but we
> have decided to move it from Wicket 1.4 to Wicket 1.5 - and correct/add
> some features.
>
> I've some problems with the migration, I can't find how to translate some
> code from one version to another.
>
> My greatest problem is:
>
> I've a component with javascript code attached. The javascrit code is in a
> file named equal as the class, f. ex. MyComponent.java MyComponent.js; in
> the same package.
>
> In Wicket 1.4 ; I simply use one line int he onRenderHead method
> <code>
>    @Override
>    public void renderHead(IHeaderResponse response) {
>        response.renderJavascriptReference(new
> ResourceReference(HistoricoBehavior.class, "MyComponent.js"));
>        super.renderHead(response);
>    }
> </code>
>
> I've tried with PackcageResource,  a custom resource, etc. but I haven't
> found a working way...
>
> Have someone any ideas ?
>
>
>
>
>
> --
>
>             > > > Oscar Besga Arcauz < < <



-- 
thank you,

regards,
Vineet Semwal

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