Image submit in Tapestry 5.1

This just took me a really long time to figure out, so I’m writing it down. Tapestry 5.1 adds support for submit buttons with an image (I think it was added in 5.1). In any case, you just use the normal tag, but you add an image attribute which is an “asset”. I added an Asset property to my page class and used @Inject and @Path to inject the asset. I used that property name in the image attribute, and it didn’t work. It turns out, you don’t need to declare the asset as a property in your page class. You just specify the path in the image attribute just like you would in the @Path annotation. So, it looks something like this:

<t:submit image=”context:images/submit.gif”/>

Much simpler than I was thinking. Sometimes I get really frustrated with these little Tapestry issues…

Advertisements

One thought on “Image submit in Tapestry 5.1

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s