Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Fixed bad links due to copy-paste from cwiki-test

 

 

Warning
titleFor Older Versions of Tapestry
Legacy

 

...

Div
stylefloat:right
titleRelated Articles
classaui-label
Content by Label
showLabelsfalse
showSpacefalse
titleRelated Articles
cqllabel in ("javascript","ajax") and space = currentSpace()

In production mode, by default, Tapestry will merge JavaScript libraries, add version numbering, and set a far-future expires header to encourage aggressive browser caching. Starting with version 5.3, Tapestry can also automatically minify (compress) JavaScript libraries when in production mode.

In addition, as will be described in detail below, Tapestry comes with the Prototype and Scriptaculous libraries, or you can easily swap in JQuery using a 3rd-party module.

...

Note: When specifying a file to import, you'll often use the context: binding prefix to indicate that the file is stored in the web application context, and not on the classpath. Relative paths will be on the classpath, relative to the Java class. See Legacy JavaScript See Component Parameters for other binding prefix options.

...

Alternatively, you can use JavaScriptSupport (for Tapestry 5.2 or later) or RenderSupport (for Tapestry 5.0 and 5.1) to include a JavaScript library in your page or component. JavaScriptSupport and RenderSupport are environmental services that include a number of methods that will be used by components, or by services that are called from components. For example:

...

Minification can be disabled by setting the SymbolConstants.MINIFICATION_ENABLED the tapestry.enable-minification configuration symbol to false in your application's module class (usually AppModule.java). By default it is enabled when in production mode and disabled otherwise.

...

In versions prior to 5.3, Tapestry uses used a modified version of the Blackbird JavaScript console. The Tapestry object includes three functions: debug, warn and error.

Each of these functions take a message and an optional pattern; if the pattern is provided, the message is interpolated on the pattern. The final message is displayed in the Blackbird console, which will make itself visible automatically.

...

Ajax Components and Mixins

...

Built-in Libraries

Wiki Markup
{float:right|width=30%|background=#eee}
{color:green}*Alternatives to Prototype*{color}
Tapestry also works well with other JavaScript libraries, such as JQuery and ExtJS:
* *[Tapestry5-Jquery module|https://github.com/got5/tapestry5-jquery]* -- Using JQuery _instead of_ Prototype
* [Tapestry5HowToIntegrateJQuery|http://wiki.apache.org/tapestry/Tapestry5HowToIntegrateJQuery] -- Using JQuery _in addition to_ Prototype
* [TAP5-999|https://issues.apache.org/jira/browse/TAP5-999] tracks work underway to introduce an agnostic tapestry.js layer to allow switching from Prototype to JQuery. See [JavaScript Rewrite] for more info.
* [TAPS-1364|https://issues.apache.org/jira/browse/TAP5-1364] lists some starting points for ExtJS integration
{float}
Tapestry comes with the Prototype and Scriptaculous libraries ... no extra download is required. Tapestry will automatically link into your pages the prototype.js, scriptaculous.js, and effects.js libraries, as well as the Tapestry library, tapestry.js (which largely consists of support for form input validation). Starting with Tapestry 5.3, Underscore is also included.

Prototype and Scriptaculous Versions

Tapestry included prototype and scriptaculous in versions prior to Tapestry 5

...

Prototype 1.7.1

...

Scriptaculous 1.9

...

Underscore 1.1.7

...

Tapestry 5.3+

...

Prototype 1.7

...

Scriptaculous 1.9

...

Underscore 1.1.7

...

Tapestry 5.2.6

...

Prototype 1.7

...

Scriptaculous 1.9

...

Tapestry 5.2

...

Prototype 1.6.1

...

Scriptaculous 1.8.2

...

Tapestry 5.1

...

Prototype 1.6.0.3

...

Scriptaculous 1.8.2

...

Tapestry 5.0

...

Prototype 1.6.0

...

Scriptaculous 1.8.0

.4. See Supported Environments and Versions for a matrix of prototype and scriptaculous versions supported by Tapestry.

In versions before 5.4, Tapestry used Tapestry uses a modified version of the main Scriptaculous library, scriptaculous.js, with the library's default autoloading behavior turned off. This lets Tapestry and Tapestry components control which Scriptaculus scripts are loaded, rather than having all of them loaded unnecessarily.

...

The Asset is injected, using the ${tapestry.scriptaculous} configuration symbol to reference the location of the Scriptaculous library.

...

Code Block
languagejava
titleAppModule.java (partial)
@Contribute(JavaScriptStackSource.class)
public static void addMyStack (MappedConfiguration<String, JavaScriptStack> configuration)
{
        configuration.addInstance("MyNewStack", myStack.class);
}

...