Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Combined the mostly-redundant "Informal Parameters" and "Supporting Informal Parameters" sections.

...

Only components whose class is annotated with @SupportsInformalParameters will support informal parameters. Tapestry silently drops informal parameters that are specified for components that do not have this annotation.

Informal parameters are often used to set the CSS class of an element, or to specify client-side event handlers.

The default binding prefix for informal parameters depends on where the parameter binding is specified. If the parameter is bound inside a Java class, within the @Component annotation, then the default binding prefix is "prop:". If the parameter is bound inside the component template, then the default binding prefix is "literal:". This reflects the fact that a parameter specified in the Java class, using the annotation, is most likely a computed value, whereas a value in the template should simply be copied, as is, into the result HTML stream.

If your component should render informal parameters, just inject the ComponentResources for your component and invoke the renderInformalParameters() method.

Asset Bindings

Assets bindings are normally relative to the component class. This can be overridden by prefixing the path with "context:", in which case, the path is a context path from the root of the web application context.

...

Tapestry will adjust the URL of the image so that it is processed by Tapestry, not the servlet container. It will gain a URL that includes the application's version number, it will have a far-future expires header, and (if the client supports it) its content will be compressed before being sent to the client.

...

Parameters

...

Only components which area annotated with @SupportsInformalParameters may have informal parameters. Tapestry silently drops informal parameters that are specified for components that do not have this annotation.

To render informal parameters, inject the ComponentResources for your component and invoke the renderInformalParameters() method.

Parameters Are Bi-Directional

Parameters are not simply variables; each parameter represents a connection, or binding, between a component and a property of its container. When using the prop: binding prefix, the component can force changes into a property of its container, just by assigning a value to its own instance variable.

...

In Tapestry 5.0, you would define a parameter of the outer component, and use the "inherit:" binding prefix to connect the inner component's parameter to the outer component's parameter. This is somewhat clumsy, as it involves creating an otherwise unused field just for the parameter; in practice it also leads to duplication of the documentation of the parameter.

In Tapestry 5.1 and later, you may use the publishParameters attribute of the @Component annotation. List one or more parameters separated by commas: those parameters of the inner/embedded component become parameters of the outer component. You should not define a parameter field in the outer component.

...