Alignment: Chaotic Java

Friday, November 25, 2005

Tapestry and @Asset

Finished ranting about the @Script annotation, now it is time to rant about the @Asset one.

In fact, it's not about the annotation itself I wish to rant, but about the way Assets are passed. It seems to me that assets are very strictly hard-coded, if in the form of an annotation or the XML file, they're specified before-hand. However, suppose I have a dynamic page in my store, which needs to show the product's image. Since I cannot know the image's URL before-hand, I have no choice to not use the Image component. I am, in fact, forced to use the Any component, making src a dynamic attribute.

I suggest a different approach. Assets can specify hard coded items; That's a given, as it's easier for those buttons and backgrounds and whatnot. However, it should also allow Literals and OGNL which eventually translate into a String or even File objects. That way, I could do the following "classic":



img jwcid="@Image" image="ognl:item.images[0].url"

0 Comments:

Post a Comment

<< Home