FAQ - got5/tapestry5-jquery GitHub Wiki

FAQ

What is tapestry5-jquery project ?

It is a project based on the awesome java web framework named Tapestry 5. Tapestry 5 is a component oriented framework. So it comes with many front components you can use to build web applications. Many of those components are "dynamic" and runs javascript code on the client browser. Tapestry's javascript stack was written in 2006 with Prototype, when this js framework was popular. But today, jQuery has become "the js framework to use". So tapestry5-jquery project aims at replacing the prototype based javascript layer by a wonderful jquery based layer. All the default tapestry's components and mixins have been reimplemented with jquery and exclusive new components and mixins are being created with jquery.

Can I use all the default components and mixins included "by default" in tapestry ?

Yes ! They all have been reimplemented. So you can use them as you did before. Exceptions for autocomplete and palette, which have to be used with the "jquery" namespace :

<t:form>
	<t:jquery.autocomplete />
	<t:submit />
</t:form>

Or you can even map the 'j' namespace with the jquery library :

<html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd"
  xmlns:p="tapestry:parameter"
  xmlns:j="tapestry-library:jquery">
 <t:form>
     <j:palette />
     <t:textfield t:mixins="jquery/autocomplete" ... />
     <t:submit />
 </t:form>
 </html>

Furthermore, you have exclusive components created with jquery. Like a dialog, a slider, an accordion...

What if I still need to have PrototypeJS and the components originally included in tapestry ?

Tapestry5-jquery project allows you to choose whether to include or not Prototype (and original tapestry components). jQuery will be added to the javascript stack in every case. In your AppModule, contributeApplicationDefaults method, you can add configuration.add(JQuerySymbolConstants.SUPPRESS_PROTOTYPE, "false");

How to use prototype and jQuery together ? (notes about compatibility and jquery $ alias)

In traditional jQuery development, we are used to manipulate the $ alias to select the elements we want to play with. jQuery allows us to change this default alias (for compatibility with other js frameworks also using the $ alias : like PrototypeJS, included in Tapestry, for example). The tapestry5-jquery project has an option permitting you to customize this alias : in your AppModule, contributeApplicationDefaults method, you can add configuration.add(JQuerySymbolConstants.JQUERY_ALIAS, "yourOwnAlias");. The default jquery alias is $.

By the way, if you've set the JQuerySymbolConstants.SUPPRESS_PROTOTYPE option to false, you may not use $ to refer to jQuery, because $ actually refers to Prototype. Thus, you may want to change jQuery's alias in that particular case. However, if you didn't change it, jQuery's alias will automatically be set to $j.

⚠️ **GitHub.com Fallback** ⚠️