Sorry for the many questions, But I'm using wicket 8.9 and this code is not
correct :  RequestCycle.get().urlFor(new
PackageResourceReference(Some.class, "dataTables.persian.json"))
[image: image.png]
This is my code and file hierarchy. I saw your provided link but I can't
find the solution yet.

On Tue, Sep 20, 2022 at 6:00 PM Martin Grigorov <mgrigo...@apache.org>
wrote:

> you may also want to check
> http://wicketinaction.com/2011/07/wicket-1-5-mounting-resources/
>
> On Tue, Sep 20, 2022 at 4:25 PM Martin Grigorov <mgrigo...@apache.org>
> wrote:
>
> >
> >
> > On Tue, Sep 20, 2022 at 4:16 PM vahid ghasemi <vahidghasemi...@gmail.com
> >
> > wrote:
> >
> >> I don't want to be available always. so I don't want to add to webapp.
> >> I think exactly my problem is in the (...).
> >> I don't know how should add my file
> >> I write this code in renderHead, before
> >>
> """response.render(OnDomReadyHeaderItem.forScript("$('table').DataTable({"
> >> + ... + "});"));""" :
> >>
> >
> > You need to use RequestCycle.get().urlFor(new
> > PackageResourceReference(Some.class, "dataTables.persian.json"))
> >
> >
> >
> >> WebApplication.get().mountResource("/", new
> >> PackageResourceReference("dataTables.persian.json"));
> >>
> >
> > I guess you don't want it on the root ("/").
> > But this will make it "available always" too!
> >
> >
> >
> >> But I got 404 for the file
> >> [image: image.png]
> >>
> >> On Tue, Sep 20, 2022 at 5:31 PM Martin Grigorov <mgrigo...@apache.org>
> >> wrote:
> >>
> >>> Hi,
> >>>
> >>> You can put the JSON file in your webapp /static folder.
> >>> Or you could use application.mountResource(...) if you want it to be
> >>> served
> >>> and/or generated by Wicket.
> >>>
> >>> Also please check
> >>> https://github.com/wicketstuff/core/tree/master/datatables-parent
> >>>
> >>>
> >>> On Tue, Sep 20, 2022 at 3:31 PM vahid ghasemi <
> vahidghasemi...@gmail.com
> >>> >
> >>> wrote:
> >>>
> >>> > Hello,
> >>> > I want to use datatables library: https://datatables.net/
> >>> > I created a behavior and override renderHead method :
> >>> >
> >>>
> response.render(OnDomReadyHeaderItem.forScript("$('table').DataTable({" +
> >>> > ... + "});"));
> >>> >
> >>> > according to this link :
> >>> > https://datatables.net/reference/option/language.url
> >>> > I can pass the JSON file for internationalization, my JSON file
> should
> >>> be
> >>> > after http://localhost:8080/wicket/bookmarkable/
> >>> > I don't know how can I add my JSON file.
> >>> >
> >>> > Thanks. Regards
> >>> >
> >>>
> >>
>

Reply via email to