...
In addition, it is possible to define additional root packages for the application:
Code Block | ||||
---|---|---|---|---|
| ||||
public static void contributeComponentClassResolver(Configuration<LibraryMapping> configuration) { configuration.add(new LibraryMapping("", "com.example.app.tasks")); configuration.add(new LibraryMapping("", "com.example.app.chat")); } |
...
Getting informal parameters to work is in two steps. First, you must make a call to the ComponentResources.renderInformalParameters()
method, but just as importantly, you must tell Tapestry that you want the component to support
informal parameters, using the SupportsInformalParameters
annotation. Here's a hypothetical component that displays an image based on the value of a Image
object (presumably, a database entity):
Code Block | ||||
---|---|---|---|---|
| ||||
@SupportsInformalParameters public class DBImage { @Parameter(required=true) private Image image; @Inject private ComponentResources resources; boolean beginRender(MarkupWriter writer) { writer.element("img", "src", image.toClientURL(), "class", "db-image"); resources.renderInformalParameters(writer); writer.end(); return false; } } |
...
The second disadvantage is you are more susceptible to off-by-a-character errors. For example, onSucessFromLoginForm()
will never be called because the event name is misspelled; this would not happen using the annotation approach:
Code Block | ||||
---|---|---|---|---|
| ||||
@OnEvent(value=EventConstants.SUCCESS, component="loginForm") Object storeUserCredentialsAndReturnToProductsPage() { . . . } |
...