Insert link/asset into a localized message in Tapestry 5
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
mess开发者_开发百科ages.format("message", link);
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()
精彩评论