How about something simpler, like @IncludeStylesheet("context:static/css/form.css") public class MyComponent { ... }
Let Tapestry do the heavy lifting. What you are providing there is an asset path. The "context:" part indicates that the file in question is in the web application context ("classpath:" is a built-in alternative, for files stored inside JARs on the classpath). Tapestry will ensure that a proper link is built from your page to the indicated asset. This isn't just an issue for localization; using a page activation context can also change the base URL for the page and break relative links to assets. You should always let Tapestry do what it's good at ... figuring these things out so you don't have to. On Wed, Feb 24, 2010 at 6:03 AM, Thomas Cucchietti <thomas.cucchie...@gmail.com> wrote: > Hello Thiago! > > Your proposal was (again) the good solution, so thanks a lot :o) > > Here follows the code : > > �...@setuprender > void setup(){ > Asset asset = assetSource.getContextAsset("static/css/form.css", > null); > renderSupport.addStylesheetLink(asset,null); > ... > } > > Which is rendered in HTML as : > > <link href="/assets/ctx/76f6e908f48d0e66/static/css/form.css" > rel="stylesheet" type="text/css"> > > Have a nice day! > > Thomas. > > 2010/2/24 Thiago H. de Paula Figueiredo <thiag...@gmail.com> > >> On Wed, 24 Feb 2010 10:18:18 -0300, Thomas Cucchietti < >> thomas.cucchie...@gmail.com> wrote: >> >> Alexander, >>> >>> this was the first thing I tried to do : >>> >>> @SetupRender >>> void setup(){ >>> renderSupport.addStylesheetLink("context:static/css/form.css", >>> null); >>> .... >>> } >>> >> >> @Inject AssertSource and use one of its methods to get an Asset pointing to >> your file. Then add it using RenderSupport.addStylesheetLink(Asset asset). >> >> -- >> Thiago H. de Paula Figueiredo >> Independent Java, Apache Tapestry 5 and Hibernate consultant, developer, >> and instructor >> Owner, software architect and developer, Ars Machina Tecnologia da >> Informação Ltda. >> http://www.arsmachina.com.br >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org >> For additional commands, e-mail: users-h...@tapestry.apache.org >> >> > -- Howard M. Lewis Ship Creator of Apache Tapestry The source for Tapestry training, mentoring and support. Contact me to learn how I can get you up and productive in Tapestry fast! (971) 678-5210 http://howardlewisship.com --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org