I also recommend to use separate .js files for the different components.
I'd also prefer a Behavior to contribute some common JS logic like
validation. If a component needs validation then add this behavior to it.

Since 6.0 Wicket supports resource bundling, i.e. combine several .js or
.css files in one bundle.
Take a look at
http://wicketinaction.com/2012/07/wicket-6-resource-management/ and the
linked demo application.

JS world is also going in this direction.
Dojo as component based framework does this since its early versions. AMD
frameworks do the same. And they also provide bundling.
JQuery developers also realized this and now the split the bigger .js into
several smaller ones

On Thu, Mar 21, 2013 at 12:33 AM, Sven Meier <s...@meiers.net> wrote:

> >Wicket Application Design
> Point your colleagues to the components in wicket-core and
> wicket-extensions:
> Is there a global .js file or many component specific ones?
> *After* you've experienced performance problems, you should look into
> ResourceBundles.
> Hope this helps
> Sven
> On 03/20/2013 09:53 PM, xe0nre wrote:
>> Hello,
>> At my current place of employment we are using wicket for quite some time
>> and I believe that we are comfortable with it..but this days I had a
>> discussion with a colleague about the javascript files that we write for
>> our
>> components.We could not agree and I think that we can find the answer on
>> wicket forum.So here it goes:
>>   I believe that because wicket is a component-based web framework the
>> javascript code that only applies to one component should be only loaded
>> when that component is being used.We have a global js file where I believe
>> that  we can keep javascript code that can be applied in multiple places
>> like validation behavior for textfields.This way we also support component
>> portability.
>>   My colleague believes that we should only use the global js file and
>> place
>> all our javascript code there.One argument witch i believe is true is that
>> one js file loads faster that multiple js files - but i think that this is
>> true  only when you load all the js code in that multiple files.I think
>> that
>> if you only load what you need it cannot impact the page load time.
>>   To give you a example of our problem: We have a component that handles
>> file
>> upload witch is only used in one place in the entire application. I think
>> that the js code that handles validation for this component should only be
>> used when the component is used.I see no reason the load the js code it
>> the
>> entire applications if it is only used on one page.
>>   Any opinions are appreciated.
>> TL;DR: Should javascript code that is only used on one component/panel be
>> placed on a js file that is loaded only when component/panel is used or
>> on a
>> global js file that in loaded on every page.
>> --
>> View this message in context: http://apache-wicket.1842946.**
>> n4.nabble.com/Wicket-**Application-Design-Question-**tp4657388.html<http://apache-wicket.1842946.n4.nabble.com/Wicket-Application-Design-Question-tp4657388.html>
>> Sent from the Users forum mailing list archive at Nabble.com.
>> ------------------------------**------------------------------**---------
>> To unsubscribe, e-mail: 
>> users-unsubscribe@wicket.**apache.org<users-unsubscr...@wicket.apache.org>
>> For additional commands, e-mail: users-h...@wicket.apache.org
> ------------------------------**------------------------------**---------
> To unsubscribe, e-mail: 
> users-unsubscribe@wicket.**apache.org<users-unsubscr...@wicket.apache.org>
> For additional commands, e-mail: users-h...@wicket.apache.org

Martin Grigorov
Training, Consulting, Development
http://jWeekend.com <http://jweekend.com/>

Reply via email to