tags:

views:

74

answers:

1

I'd like to insert a link (as an -Tag) and/or an Asset (as an -Tag) into localized Messages in Tapestry 5. Is there any way to generate the HTML so that I can insert it into the message, possibly via

messages.format("message", link);

A: 

I'm not 100% sure what you're asking, but you can do something like:

@Inject
private PageRenderLinkSource renderLinkSource;

void setupRender() {
  Link link = renderLinkSource.createPageRenderLink("pageName");
  String uri = link.toAbsoluteURI();
}

At that point you have the link in a String and you can do whatever you want with it.

For assets, I think you could do something like:

@Inject
@Path("context:images/image.png")
private Asset image;

...
image.toClientURL()
Brian Deterling