[Thanks go to Daniel Jue, who answered my question on June 7, 2007]

For example, if you have this file:

src/main/webapp/css/MyStyle.css

You can access it in your page or component Java class like this:

@Inject
@Path("context:css/MyStyle.css")
private Asset thestyle;

public Asset getTheStyle() { return thestyle; }

And then in your page or component template:

<html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
<head>
<title>My Title</title>
<link rel="stylesheet" type="text/css" href="${thestyle}"/>
</head>
...
</html>

Similarly, having src/main/webapp/images/MyLogo.gif Page or Component Class:

@Inject
@Path("context:images/MyLogo.gif")
private Asset thelogo;

public Asset getTheLogo() { return theLogo; }

Page or Component Template (the html):

<img src="${thelogo}" />

Tapestry5WhereToStoreExternalResources (last edited 2009-09-20 23:20:47 by localhost)