Hi List,

I have just stepped into the same problem as the original poster of this 
thread: 
http://tapestry.markmail.org/message/ma3wvd6rk4fm56hr?q=SupportsInformalParameters#query:SupportsInformalParameters+page:1+mid:3ma5dlzcmvjjyoit+state:results

I found the solution described by Josh Canfield a bit complicated and came up 
with an easier one by using the Trigger component.

Template of a page/component, where u use "MyComponent" (style is the informal 
parameter here):
...
<MyComponent style="background:green" />
...

Java class of MyComponent

...
@SupportsInformalParameters
public class MyComponent {

@Inject
private ComponentResources resources;

/**
  * This method will be called by the Trigger component in MyComponent's 
template.
  */
@OnEvent("renderInformals")
final void renderInformals(final MarkupWriter writer) {
  /* Will render informal parameters into the current element of writer.
   * You chose which one that is by putting a Trigger component right after
   * the element you want your informal parameters rendered into.
   */
  this.resources.renderInformalParameters(writer);
}
...

Put the following into MyComponent's template right after the element that you 
want your informal parameters rendered into. You can even use it several times 
not just once:
<t:Trigger t:event="renderInformals" />

Regards nillehammer

Reply via email to