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

...

Concepts & Terminology

JSF

Tapestry

Java class associated with a page or component

"Backing Bean"

"Component Class"

Component attributes/parameters

"attributes"

"parameters"

Common Attributes/Parameters

JSF

Tapestry

HTML Attribute used for invisible instrumentation

jsfc="someComponentType"

t:type="someComponentType"

CSS "class" attribute name

styleClass

class

Alternating "zebra" striped rows

rowclasses="class1,class2"

class="${cycle:class1,class2}" using cycle binding prefix, or with CSS: .rowClass:nth-child(even) {background-color: #e8e8e8;}

Output and Messages

JSF

Tapestry

Escaped HTML from property

<h:outputText value="myBean.myValue"/>

${myValue}

Raw HTML from property

#{myBean.myValue}

<t:outputRaw value="myValue"/>

Error messages

<h:message> and <h:messages>

<t:error> and <t:errors> (for forms) or <t:alerts>

Image display

<h:graphicImage>

use standard <img> tag, but see Assets

Conditionals and Looping

JSF

Tapestry

Render-time loop

<ui:repeat>

<t:loop>

Compile-time loop

<c:forEach>

<t:loop>

Conditional

<c:if test="#{myBean.myValue}">

<t:if test="myValue">

Conditional

<ui:fragment rendered="#{myBean.someCondition}"/>...</ui:fragment>

<t:if test="someCondition">...</t:if>

Switch

<c:choose><c:when ... ></c:choose>

See Tapestry for JSF Users Switching Cases

Server-side comment

<ui:remove>

<t:remove>

Links and Buttons

JSF

Tapestry

Navigational link

<h:link outcome="nextpage.xhtml"/>

<t:pagelink page="nextpage"/>

Event-triggering link, without form submission

not available

<t:actionLink> or <t:eventLink>

Form submission link

<h:commandLink>

<t:linkSubmit>

Form submission button

<h:commandButton>

<t:submit>

Link to Javascript file

<h:outputScript>

<script> or use @Import in component class

Link to CSS file

<h:outputStylesheet>

<style> or use @Import in component class

Grids, Tables and Trees

JSF

Tapestry

Tabular data in <table>

<h:datatable>

<t:grid>

Table used for layout

<h:panelGrid> with <h:panelGroup>

use standard <table> tag

Hierarchical tree

depends on component library

<t:tree>

Form Tags/Components

JSF

Tapestry

Form

<h:form>

<t:form>

Single-line text input field

<h:inputText>

<t:textField>

Password field

<h:inputSecret>

<t:passwordfield>

Select menu

<h:selectOneMenu>

<t:select>

Checkbox

<h:selectBooleanCheckbox>

<t:checkbox>

Checkbox list

<h:selectManyCheckbox>

<t:checklist>

Radio button list

<h:selectOneRadio>

<t:radioGroup> with <t:radio>

Multiple select menu

<h:selectManyListbox>

not available (but see Palette and Checklist)

Hidden field

<h:inputHidden>

<t:hidden>

textarea tag

<h:inputTextarea>

<t:textArea>

Label tag

<h:outputLabel for="...">

<t:label for="...">

...

JSF uses the Unified Expression Language with the #{...} or ${...} syntax for accessing Backing Bean properties. For its part, Tapestry uses the ${...} syntax with a similar but intentially intentionally limited expression language called Tapestry for JSF Users Property Expressions. Both allow easy access to properties via the usual JavaBean conventions, but with Tapestry you don't have to specify which class the expression starts at (because it always starts at the component class corresponding to the template). Some comparisons:

...

Note that by default Tapestry does not save property values across the Post-Redirect-Get cycle. This means that you have to consider how (and whether) to persist property values from one page to the next. The usual solution is to either make the values part of the page's Activation Context (which means the values will be appended to the URL) or @Persist the properties the values in the session.

...

In contrast, with Tapestry, creating custom components is a beginner topic: it is expected to be a daily activity for developers, because it is so easy. In fact, the steps are the same as creating a page. All you have to do is create a (potentially empty) Java class in a "components" sub-package, and create a template file containing (X)HTML markup in the corresponding "components" sub-folder within your package hierarchy under /src/main/resources. You use a custom component just like you use any built-in Tapestry component: <t:mycomponent>.

...