You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by kamiseq <ka...@gmail.com> on 2012/05/19 02:12:52 UTC

wicket 6 resources

hej,
I tried to look for this and I ve found some old topics but they were
related to older version of wicket than 6.

I m looking for 2 things

1] I would like to get validator message with all parameters. for
example lets take required message I can get it like this: new
StringResourceModel("Required", this, null).getString() but it will
return "Field '${label}' is required." or its translated equivalent.
how can I set label parameter with actual value. maybe
StringRecourceModel is not the best choice. I tried to look how
validators do that but I think it is to much trouble.

I need this error message before form performs any validation so I can
reuse it in javascript validation. in other words if form component
has validator I would like to get its message and add it to my custom
js validation function.

2] I know that I should keep all my css and js next to java classes
and let wicket handle, and this work - I have no problem with it. but
sometimes it is more convenient to put those scripts inside webapp
directory. and again I ve found some article about it but I dont want
to use wro4j. what is the easiest way to reference any JS script from
webapp/scripts/ in wicket 6?? I started playing with requireJs.js and
it looks for scripts inside scripts directory

i started with code like this
response.render(JavaScriptHeaderItem.forReference(new
JQueryPluginResourceReference(Application.class, "Forms.js"))); but of
course it is not working.

maybe Im too tired or something but all I can find uses resources
inside java packages.

thanks for any hints

pozdrawiam
Paweł Kamiński

kamiseq@gmail.com
pkaminski.prv@gmail.com
______________________

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


Re: wicket 6 resources

Posted by kamiseq <ka...@gmail.com>.
yep,
I think I ve even seen a way to change jQ file somewhere in
application settings. it was described somewhere in migration to 6.0
page

again thanks

pozdrawiam
Paweł Kamiński

kamiseq@gmail.com
pkaminski.prv@gmail.com
______________________


On 20 May 2012 07:27, vineet semwal <vi...@gmail.com> wrote:
> you are welcome ..,to use same version of jquery in your case do
> response.render(JavaScriptHeaderItem.forReference(Application.get().getJavaScriptLibrarySettings().getJQueryReference()))
>
> On Sun, May 20, 2012 at 10:46 AM, kamiseq <ka...@gmail.com> wrote:
>> hym, I thought it is more flexible, anyway I can always add jquery
>> manually. and yes good point that I need make sure that im using same
>> version of jQ as wicket.
>>
>> thanks for explanation
>>
>> pozdrawiam
>> Paweł Kamiński
>>
>> kamiseq@gmail.com
>> pkaminski.prv@gmail.com
>> ______________________
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>
>
>
> --
> thank you,
>
> regards,
> Vineet Semwal
>
> ---------------------------------------------------------------------
> 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: wicket 6 resources

Posted by vineet semwal <vi...@gmail.com>.
you are welcome ..,to use same version of jquery in your case do
response.render(JavaScriptHeaderItem.forReference(Application.get().getJavaScriptLibrarySettings().getJQueryReference()))

On Sun, May 20, 2012 at 10:46 AM, kamiseq <ka...@gmail.com> wrote:
> hym, I thought it is more flexible, anyway I can always add jquery
> manually. and yes good point that I need make sure that im using same
> version of jQ as wicket.
>
> thanks for explanation
>
> pozdrawiam
> Paweł Kamiński
>
> kamiseq@gmail.com
> pkaminski.prv@gmail.com
> ______________________
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>



-- 
thank you,

regards,
Vineet Semwal

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


Re: wicket 6 resources

Posted by kamiseq <ka...@gmail.com>.
hym, I thought it is more flexible, anyway I can always add jquery
manually. and yes good point that I need make sure that im using same
version of jQ as wicket.

thanks for explanation

pozdrawiam
Paweł Kamiński

kamiseq@gmail.com
pkaminski.prv@gmail.com
______________________

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


Re: wicket 6 resources

Posted by vineet semwal <vi...@gmail.com>.
resourcereference is meant for the resources in java packages ,to
access resources in webapp ,you don't need wicket,if your js file uses
jquery then you should put it in a java package.

On Sun, May 20, 2012 at 6:26 AM, kamiseq <ka...@gmail.com> wrote:
> ok but when you use JQueryPluginResourceReference how then access
> scripts form webapp directory, I tried something like
> JQueryPluginResourceReference(null, "scripts/Form") and
> JQueryPluginResourceReference(myPageRef, "scripts/Form") but no luck,
> maybe I just overlooked something
>
> pozdrawiam
> Paweł Kamiński
>
> kamiseq@gmail.com
> pkaminski.prv@gmail.com
> ______________________
>
>
> On 19 May 2012 23:44, vineet semwal <vi...@gmail.com> wrote:
>> afaik wicket ajax depends on jquery and not whole wicket so jquery is
>> not always imported in your page automatically,it's imported
>> automatically when you your page has some wicket ajax functionality so
>> imo if your js file  is using jquery  then you should use
>> JQueryPluginResourceReference to import your js file
>> ,JQueryPluginResourceReference will also add jquery on its own .
>> basically this approach prevents version conflicts .
>>
>>  btw HomePage.js is using jquery ..
>>
>>
>> On Sat, May 19, 2012 at 11:23 PM, kamiseq <ka...@gmail.com> wrote:
>>> thanks, it works.
>>>
>>> ok so if jQuery is added always as wicket depends on it now, so what
>>> is JQueryPluginResourceReference for??? I saw it in
>>> http://www.wicket-library.com/wicket-examples-6.0.x/resourceaggregation/
>>> and javadoc says it is "Base class for JavaScript resources that are
>>> JQuery plugins" but in example HomePage.js is not a jQ plugin. more,
>>> it will work if I reference js file using
>>> response.render(JavaScriptHeaderItem.forUrl("scripts/Forms.js")); (as
>>> you showed me) or using JS reference to get file from java package.
>>>
>>> im just little confused
>>>
>>> pozdrawiam
>>> Paweł Kamiński
>>>
>>> kamiseq@gmail.com
>>> pkaminski.prv@gmail.com
>>> ______________________
>>>
>>>
>>> On 19 May 2012 13:42, vineet semwal <vi...@gmail.com> wrote:
>>>> On Sat, May 19, 2012 at 5:42 AM, kamiseq <ka...@gmail.com> wrote:
>>>>> hej,
>>>>> I tried to look for this and I ve found some old topics but they were
>>>>> related to older version of wicket than 6.
>>>>>
>>>>> I m looking for 2 things
>>>>>
>>>>> 1] I would like to get validator message with all parameters. for
>>>>> example lets take required message I can get it like this: new
>>>>> StringResourceModel("Required", this, null).getString() but it will
>>>>> return "Field '${label}' is required." or its translated equivalent.
>>>>> how can I set label parameter with actual value. maybe
>>>>> StringRecourceModel is not the best choice. I tried to look how
>>>>> validators do that but I think it is to much trouble.
>>>>
>>>> public class Foo implements Serializable {String label;public String
>>>> getLabel() {return "anyname";}    }
>>>> new StringResourceModel("key",JsPage.this, new Model(new Foo())).toString()
>>>>
>>>> or you  can useinterpolator like mapvariableinterpolator
>>>>  Map<String,String>map=new HashMap<String, String>();
>>>>     map.put("label","anyname");
>>>>    MapVariableInterpolator.interpolate( getString("key"), map);
>>>>>
>>>>> I need this error message before form performs any validation so I can
>>>>> reuse it in javascript validation. in other words if form component
>>>>> has validator I would like to get its message and add it to my custom
>>>>> js validation function.
>>>>>
>>>>> 2] I know that I should keep all my css and js next to java classes
>>>>> and let wicket handle, and this work - I have no problem with it. but
>>>>> sometimes it is more convenient to put those scripts inside webapp
>>>>> directory. and again I ve found some article about it but I dont want
>>>>> to use wro4j. what is the easiest way to reference any JS script from
>>>>> webapp/scripts/ in wicket 6?? I started playing with requireJs.js and
>>>>> it looks for scripts inside scripts directory
>>>>>
>>>>> i started with code like this
>>>>> response.render(JavaScriptHeaderItem.forReference(new
>>>>> JQueryPluginResourceReference(Application.class, "Forms.js"))); but of
>>>>> course it is not working.
>>>>
>>>>  resourcereference is not required  to access resources in webcontext
>>>> response.render(JavaScriptContentHeaderItem.forUrl("Forms.js"));
>>>>>
>>>>> maybe Im too tired or something but all I can find uses resources
>>>>> inside java packages.
>>>>>
>>>>> thanks for any hints
>>>>>
>>>>> pozdrawiam
>>>>> Paweł Kamiński
>>>>>
>>>>> kamiseq@gmail.com
>>>>> pkaminski.prv@gmail.com
>>>>> ______________________
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> thank you,
>>>>
>>>> regards,
>>>> Vineet Semwal
>>>>
>>>> ---------------------------------------------------------------------
>>>> 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
>>>
>>
>>
>>
>> --
>> thank you,
>>
>> regards,
>> Vineet Semwal
>>
>> ---------------------------------------------------------------------
>> 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
>



-- 
thank you,

regards,
Vineet Semwal

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


Re: wicket 6 resources

Posted by kamiseq <ka...@gmail.com>.
ok but when you use JQueryPluginResourceReference how then access
scripts form webapp directory, I tried something like
JQueryPluginResourceReference(null, "scripts/Form") and
JQueryPluginResourceReference(myPageRef, "scripts/Form") but no luck,
maybe I just overlooked something

pozdrawiam
Paweł Kamiński

kamiseq@gmail.com
pkaminski.prv@gmail.com
______________________


On 19 May 2012 23:44, vineet semwal <vi...@gmail.com> wrote:
> afaik wicket ajax depends on jquery and not whole wicket so jquery is
> not always imported in your page automatically,it's imported
> automatically when you your page has some wicket ajax functionality so
> imo if your js file  is using jquery  then you should use
> JQueryPluginResourceReference to import your js file
> ,JQueryPluginResourceReference will also add jquery on its own .
> basically this approach prevents version conflicts .
>
>  btw HomePage.js is using jquery ..
>
>
> On Sat, May 19, 2012 at 11:23 PM, kamiseq <ka...@gmail.com> wrote:
>> thanks, it works.
>>
>> ok so if jQuery is added always as wicket depends on it now, so what
>> is JQueryPluginResourceReference for??? I saw it in
>> http://www.wicket-library.com/wicket-examples-6.0.x/resourceaggregation/
>> and javadoc says it is "Base class for JavaScript resources that are
>> JQuery plugins" but in example HomePage.js is not a jQ plugin. more,
>> it will work if I reference js file using
>> response.render(JavaScriptHeaderItem.forUrl("scripts/Forms.js")); (as
>> you showed me) or using JS reference to get file from java package.
>>
>> im just little confused
>>
>> pozdrawiam
>> Paweł Kamiński
>>
>> kamiseq@gmail.com
>> pkaminski.prv@gmail.com
>> ______________________
>>
>>
>> On 19 May 2012 13:42, vineet semwal <vi...@gmail.com> wrote:
>>> On Sat, May 19, 2012 at 5:42 AM, kamiseq <ka...@gmail.com> wrote:
>>>> hej,
>>>> I tried to look for this and I ve found some old topics but they were
>>>> related to older version of wicket than 6.
>>>>
>>>> I m looking for 2 things
>>>>
>>>> 1] I would like to get validator message with all parameters. for
>>>> example lets take required message I can get it like this: new
>>>> StringResourceModel("Required", this, null).getString() but it will
>>>> return "Field '${label}' is required." or its translated equivalent.
>>>> how can I set label parameter with actual value. maybe
>>>> StringRecourceModel is not the best choice. I tried to look how
>>>> validators do that but I think it is to much trouble.
>>>
>>> public class Foo implements Serializable {String label;public String
>>> getLabel() {return "anyname";}    }
>>> new StringResourceModel("key",JsPage.this, new Model(new Foo())).toString()
>>>
>>> or you  can useinterpolator like mapvariableinterpolator
>>>  Map<String,String>map=new HashMap<String, String>();
>>>     map.put("label","anyname");
>>>    MapVariableInterpolator.interpolate( getString("key"), map);
>>>>
>>>> I need this error message before form performs any validation so I can
>>>> reuse it in javascript validation. in other words if form component
>>>> has validator I would like to get its message and add it to my custom
>>>> js validation function.
>>>>
>>>> 2] I know that I should keep all my css and js next to java classes
>>>> and let wicket handle, and this work - I have no problem with it. but
>>>> sometimes it is more convenient to put those scripts inside webapp
>>>> directory. and again I ve found some article about it but I dont want
>>>> to use wro4j. what is the easiest way to reference any JS script from
>>>> webapp/scripts/ in wicket 6?? I started playing with requireJs.js and
>>>> it looks for scripts inside scripts directory
>>>>
>>>> i started with code like this
>>>> response.render(JavaScriptHeaderItem.forReference(new
>>>> JQueryPluginResourceReference(Application.class, "Forms.js"))); but of
>>>> course it is not working.
>>>
>>>  resourcereference is not required  to access resources in webcontext
>>> response.render(JavaScriptContentHeaderItem.forUrl("Forms.js"));
>>>>
>>>> maybe Im too tired or something but all I can find uses resources
>>>> inside java packages.
>>>>
>>>> thanks for any hints
>>>>
>>>> pozdrawiam
>>>> Paweł Kamiński
>>>>
>>>> kamiseq@gmail.com
>>>> pkaminski.prv@gmail.com
>>>> ______________________
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>
>>>
>>>
>>>
>>> --
>>> thank you,
>>>
>>> regards,
>>> Vineet Semwal
>>>
>>> ---------------------------------------------------------------------
>>> 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
>>
>
>
>
> --
> thank you,
>
> regards,
> Vineet Semwal
>
> ---------------------------------------------------------------------
> 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: wicket 6 resources

Posted by vineet semwal <vi...@gmail.com>.
afaik wicket ajax depends on jquery and not whole wicket so jquery is
not always imported in your page automatically,it's imported
automatically when you your page has some wicket ajax functionality so
imo if your js file  is using jquery  then you should use
JQueryPluginResourceReference to import your js file
,JQueryPluginResourceReference will also add jquery on its own .
basically this approach prevents version conflicts .

 btw HomePage.js is using jquery ..


On Sat, May 19, 2012 at 11:23 PM, kamiseq <ka...@gmail.com> wrote:
> thanks, it works.
>
> ok so if jQuery is added always as wicket depends on it now, so what
> is JQueryPluginResourceReference for??? I saw it in
> http://www.wicket-library.com/wicket-examples-6.0.x/resourceaggregation/
> and javadoc says it is "Base class for JavaScript resources that are
> JQuery plugins" but in example HomePage.js is not a jQ plugin. more,
> it will work if I reference js file using
> response.render(JavaScriptHeaderItem.forUrl("scripts/Forms.js")); (as
> you showed me) or using JS reference to get file from java package.
>
> im just little confused
>
> pozdrawiam
> Paweł Kamiński
>
> kamiseq@gmail.com
> pkaminski.prv@gmail.com
> ______________________
>
>
> On 19 May 2012 13:42, vineet semwal <vi...@gmail.com> wrote:
>> On Sat, May 19, 2012 at 5:42 AM, kamiseq <ka...@gmail.com> wrote:
>>> hej,
>>> I tried to look for this and I ve found some old topics but they were
>>> related to older version of wicket than 6.
>>>
>>> I m looking for 2 things
>>>
>>> 1] I would like to get validator message with all parameters. for
>>> example lets take required message I can get it like this: new
>>> StringResourceModel("Required", this, null).getString() but it will
>>> return "Field '${label}' is required." or its translated equivalent.
>>> how can I set label parameter with actual value. maybe
>>> StringRecourceModel is not the best choice. I tried to look how
>>> validators do that but I think it is to much trouble.
>>
>> public class Foo implements Serializable {String label;public String
>> getLabel() {return "anyname";}    }
>> new StringResourceModel("key",JsPage.this, new Model(new Foo())).toString()
>>
>> or you  can useinterpolator like mapvariableinterpolator
>>  Map<String,String>map=new HashMap<String, String>();
>>     map.put("label","anyname");
>>    MapVariableInterpolator.interpolate( getString("key"), map);
>>>
>>> I need this error message before form performs any validation so I can
>>> reuse it in javascript validation. in other words if form component
>>> has validator I would like to get its message and add it to my custom
>>> js validation function.
>>>
>>> 2] I know that I should keep all my css and js next to java classes
>>> and let wicket handle, and this work - I have no problem with it. but
>>> sometimes it is more convenient to put those scripts inside webapp
>>> directory. and again I ve found some article about it but I dont want
>>> to use wro4j. what is the easiest way to reference any JS script from
>>> webapp/scripts/ in wicket 6?? I started playing with requireJs.js and
>>> it looks for scripts inside scripts directory
>>>
>>> i started with code like this
>>> response.render(JavaScriptHeaderItem.forReference(new
>>> JQueryPluginResourceReference(Application.class, "Forms.js"))); but of
>>> course it is not working.
>>
>>  resourcereference is not required  to access resources in webcontext
>> response.render(JavaScriptContentHeaderItem.forUrl("Forms.js"));
>>>
>>> maybe Im too tired or something but all I can find uses resources
>>> inside java packages.
>>>
>>> thanks for any hints
>>>
>>> pozdrawiam
>>> Paweł Kamiński
>>>
>>> kamiseq@gmail.com
>>> pkaminski.prv@gmail.com
>>> ______________________
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>
>>
>>
>> --
>> thank you,
>>
>> regards,
>> Vineet Semwal
>>
>> ---------------------------------------------------------------------
>> 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
>



-- 
thank you,

regards,
Vineet Semwal

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


Re: wicket 6 resources

Posted by kamiseq <ka...@gmail.com>.
thanks, it works.

ok so if jQuery is added always as wicket depends on it now, so what
is JQueryPluginResourceReference for??? I saw it in
http://www.wicket-library.com/wicket-examples-6.0.x/resourceaggregation/
and javadoc says it is "Base class for JavaScript resources that are
JQuery plugins" but in example HomePage.js is not a jQ plugin. more,
it will work if I reference js file using
response.render(JavaScriptHeaderItem.forUrl("scripts/Forms.js")); (as
you showed me) or using JS reference to get file from java package.

im just little confused

pozdrawiam
Paweł Kamiński

kamiseq@gmail.com
pkaminski.prv@gmail.com
______________________


On 19 May 2012 13:42, vineet semwal <vi...@gmail.com> wrote:
> On Sat, May 19, 2012 at 5:42 AM, kamiseq <ka...@gmail.com> wrote:
>> hej,
>> I tried to look for this and I ve found some old topics but they were
>> related to older version of wicket than 6.
>>
>> I m looking for 2 things
>>
>> 1] I would like to get validator message with all parameters. for
>> example lets take required message I can get it like this: new
>> StringResourceModel("Required", this, null).getString() but it will
>> return "Field '${label}' is required." or its translated equivalent.
>> how can I set label parameter with actual value. maybe
>> StringRecourceModel is not the best choice. I tried to look how
>> validators do that but I think it is to much trouble.
>
> public class Foo implements Serializable {String label;public String
> getLabel() {return "anyname";}    }
> new StringResourceModel("key",JsPage.this, new Model(new Foo())).toString()
>
> or you  can useinterpolator like mapvariableinterpolator
>  Map<String,String>map=new HashMap<String, String>();
>     map.put("label","anyname");
>    MapVariableInterpolator.interpolate( getString("key"), map);
>>
>> I need this error message before form performs any validation so I can
>> reuse it in javascript validation. in other words if form component
>> has validator I would like to get its message and add it to my custom
>> js validation function.
>>
>> 2] I know that I should keep all my css and js next to java classes
>> and let wicket handle, and this work - I have no problem with it. but
>> sometimes it is more convenient to put those scripts inside webapp
>> directory. and again I ve found some article about it but I dont want
>> to use wro4j. what is the easiest way to reference any JS script from
>> webapp/scripts/ in wicket 6?? I started playing with requireJs.js and
>> it looks for scripts inside scripts directory
>>
>> i started with code like this
>> response.render(JavaScriptHeaderItem.forReference(new
>> JQueryPluginResourceReference(Application.class, "Forms.js"))); but of
>> course it is not working.
>
>  resourcereference is not required  to access resources in webcontext
> response.render(JavaScriptContentHeaderItem.forUrl("Forms.js"));
>>
>> maybe Im too tired or something but all I can find uses resources
>> inside java packages.
>>
>> thanks for any hints
>>
>> pozdrawiam
>> Paweł Kamiński
>>
>> kamiseq@gmail.com
>> pkaminski.prv@gmail.com
>> ______________________
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>
>
>
> --
> thank you,
>
> regards,
> Vineet Semwal
>
> ---------------------------------------------------------------------
> 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: wicket 6 resources

Posted by vineet semwal <vi...@gmail.com>.
On Sat, May 19, 2012 at 5:42 AM, kamiseq <ka...@gmail.com> wrote:
> hej,
> I tried to look for this and I ve found some old topics but they were
> related to older version of wicket than 6.
>
> I m looking for 2 things
>
> 1] I would like to get validator message with all parameters. for
> example lets take required message I can get it like this: new
> StringResourceModel("Required", this, null).getString() but it will
> return "Field '${label}' is required." or its translated equivalent.
> how can I set label parameter with actual value. maybe
> StringRecourceModel is not the best choice. I tried to look how
> validators do that but I think it is to much trouble.

public class Foo implements Serializable {String label;public String
getLabel() {return "anyname";}    }
new StringResourceModel("key",JsPage.this, new Model(new Foo())).toString()

or you  can useinterpolator like mapvariableinterpolator
 Map<String,String>map=new HashMap<String, String>();
     map.put("label","anyname");
    MapVariableInterpolator.interpolate( getString("key"), map);
>
> I need this error message before form performs any validation so I can
> reuse it in javascript validation. in other words if form component
> has validator I would like to get its message and add it to my custom
> js validation function.
>
> 2] I know that I should keep all my css and js next to java classes
> and let wicket handle, and this work - I have no problem with it. but
> sometimes it is more convenient to put those scripts inside webapp
> directory. and again I ve found some article about it but I dont want
> to use wro4j. what is the easiest way to reference any JS script from
> webapp/scripts/ in wicket 6?? I started playing with requireJs.js and
> it looks for scripts inside scripts directory
>
> i started with code like this
> response.render(JavaScriptHeaderItem.forReference(new
> JQueryPluginResourceReference(Application.class, "Forms.js"))); but of
> course it is not working.

 resourcereference is not required  to access resources in webcontext
response.render(JavaScriptContentHeaderItem.forUrl("Forms.js"));
>
> maybe Im too tired or something but all I can find uses resources
> inside java packages.
>
> thanks for any hints
>
> pozdrawiam
> Paweł Kamiński
>
> kamiseq@gmail.com
> pkaminski.prv@gmail.com
> ______________________
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>



-- 
thank you,

regards,
Vineet Semwal

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