You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Mikaël Cluseau <mc...@gmail.com> on 2008/05/30 00:32:19 UTC

"Beginner's" Feedback

Hi dear list,

Just a though while I was working on a T5 app. It took me a lot of time
(well, more than 20 minutes...) to figure out why I didn't get my
informal block parameters from my component resources.

===== The Code

MyComp.java:

public class {

	@Inject
	private ComponentResource _resources;

	public Block getBlock() {
		return _resource.getBlockParameter("test");
	}

}

Page.tml
...
<t:mycomp>
	<t:parameter name="test">Test parameter contents</t:parameter>
</t:mycomp>
...

===== The Problem

getBlock() returns null.

===== The Solution

Add @SupportInformalParameters to the class MyComp.

===== Constructive comment

According to its Java doc, getBlockParameter returns a *informal*
parameter block. Shouldn't it throw an (runtime) exception if the
component doesn't support informal parameters ?

Of course, for special components, it should advised to check the
component's model before using
getComponentModel()#getSupportsInformalParameters().

Cheers,

-- 
  .~.
  /V\      Mikaël Cluseau <mc...@isi.nc>
 // \\
/(   )\    ISI.NC             +687 26.93.18
 ^`~'^


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org