You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Angelo Chen <an...@yahoo.com.hk> on 2007/11/02 16:55:43 UTC
T5: component expansion unexpected
Hi,
I have a component :
public class ImgDlg2 {
@Parameter(required=true)
private String _path;
boolean beginRender(MarkupWriter writer)
{
if (_path != null)
writer.element("a", "href", _path);
else
writer.element("a", "href", "#");
writer.end();
return true;
}
}
template: <t:imgDlg2 path="currentImage.Photo.thumbnail_m2" >< img
src="test"/> </t:imgDlg2>
I was hoping it will generate < a href="tm_3098.jpg">< img src="test" /><
/a>
but turned out:
< a href="tm_3098.jpg">< /a>< img src="test">
anything wrong with my component? Thanks.
A.C.
--
View this message in context: http://www.nabble.com/T5%3A-component-expansion-unexpected-tf4738354.html#a13550437
Sent from the Tapestry - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: T5: component expansion unexpected
Posted by Nick Westgate <ni...@key-planning.co.jp>.
You are ending the <a> element before the inner <img> (etc) renders.
Instead, you should end the writer in afterRender:
void afterRender(MarkupWriter writer)
{
writer.end(); // <a>
}
The corelib components are good examples to copy.
Cheers,
Nick.
Angelo Chen wrote:
> Hi,
>
> I have a component :
> public class ImgDlg2 {
> @Parameter(required=true)
> private String _path;
> boolean beginRender(MarkupWriter writer)
> {
> if (_path != null)
> writer.element("a", "href", _path);
> else
> writer.element("a", "href", "#");
> writer.end();
> return true;
> }
> }
>
> template: <t:imgDlg2 path="currentImage.Photo.thumbnail_m2" >< img
> src="test"/> </t:imgDlg2>
> I was hoping it will generate < a href="tm_3098.jpg">< img src="test" /><
> /a>
> but turned out:
> < a href="tm_3098.jpg">< /a>< img src="test">
> anything wrong with my component? Thanks.
> A.C.
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org