It looks like Howard's example is like approach 1 here 
http://tapestry.apache.org/javascript.html

The @Import annotation when used with the element "library" as shown in his 
response is for js libraries.  Same as "stack".
For use with a stylesheet, use the element "stylesheet"

http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/annotations/Import.html

Good question & answer for a Friday :)



On 13/01/2012, at 12:04 PM, Howard Lewis Ship wrote:

> Basically, when your code invokes most methods of JavaScriptSupport
> (or, in older versions of Tapestry, RenderSupport) that triggers the
> inclusion of the "core" JavaScriptStack. "core" is "tapestry.js" plus
> supporting libraries such as prototype.js.  This intent is that, if
> you are not using JavaScript on a page, you don't force the browser to
> load all that JavaScript.
> 
> So, for example, if you page has some JavaScript associated with it,
> package that into a companion JavaScript file (I usually name it the
> same as the Java class, but with a different extension), thus:
> 
> @Import("library=NiftyPage.js")
> public class NiftyPage { ...
> 
> Now Tapestry's core stack, including prototype & scriptaculous, is
> loaded as well as your JavaScript.
> 
> This is better than inline <script> elements, from a bunch of
> performance and maintainability points of view.
> 
> On Thu, Jan 12, 2012 at 3:38 PM, Lenny Primak <lpri...@hope.nyc.ny.us> wrote:
>> I would look at the source code of the simplest tapestry component to see 
>> how it does it.
>> 
>> 
>> 
>> On Jan 12, 2012, at 6:31 PM, Paul Stanton <p...@mapshed.com.au> wrote:
>> 
>>> Hi all,
>>> 
>>> I recently figured out that 'tapestry.js', 'prototype.js' etc is only 
>>> included when you have at least one tapestry component within a tml.
>>> 
>>> I can't find where this logic takes place however.
>>> 
>>> I need to make use of prototype and tapestry js on a page which does not 
>>> have any tapesry components and want to figure out the simplest way of 
>>> including them.
>>> 
>>> Thanks, Paul.
>>> 
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
>>> For additional commands, e-mail: users-h...@tapestry.apache.org
>>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
>> For additional commands, e-mail: users-h...@tapestry.apache.org
>> 
> 
> 
> 
> -- 
> Howard M. Lewis Ship
> 
> Creator of Apache Tapestry
> 
> The source for Tapestry training, mentoring and support. Contact me to
> learn how I can get you up and productive in Tapestry fast!
> 
> (971) 678-5210
> http://howardlewisship.com
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
> 

Reply via email to