You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by Apache Wiki <wi...@apache.org> on 2007/06/30 03:16:49 UTC

[Tapestry Wiki] Update of "Tapestry5WhereToStoreExternalResources" by NickWestgate

Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Tapestry Wiki" for change notification.

The following page has been changed by NickWestgate:
http://wiki.apache.org/tapestry/Tapestry5WhereToStoreExternalResources

------------------------------------------------------------------------------
   * In case of CSS/JS/images for components, have a look into the way the T5 Grid or Palette component is constructed, since they have their own js, css and images.
  [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;
+ }}}
+ 
+ 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/css/MyLogo.gif
+ Page or Component Class:
+ {{{
+ @Inject
+ @Path("context:images/MyLogo.gif")
+ private Asset thelogo;
+ }}}
+ 
+ Page or Component Template (the html):
+ {{{
+ <img src="${thelogo}" />
+ }}}
+ 

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org