I got it working with the following: public String getImagePath() { return assetSource.getClasspathAsset("classpath:com/company/tapestrylib/assets/components/languageselector/" + loopLocale.getLanguage() + ".png").toClientURL(); }
+ <img src="${imagePath}" /> + Files located in: src/main/resources/com/company/tapestrylib/assets/components/languageselector/ Is this the right way then? On 28/03/14 08:55, Nathan Quirynen wrote: > Hey Thiago, > > Thanks for the reply. I indeed use the maven structure and that's > actually something I have tried, with the following error as result: > > Could not convert 'classpath:/assets/components/languageselector/nl.png' > into a component parameter binding: Error parsing property expression > 'classpath:/assets/components/languageselector/nl.png': Unable to parse > input at character position 11. > > - What I did: > > <img src="${classpath:/assets/components/languageselector/nl.png}" /> > > - Location of the file: > > src/main/resources/assets/components/languageselector/nl.png > > > Am I forgetting something? > > ----- > > Also if I want to get it from inside a property getter, as the images > are rendered in a loop, how do I get the right path? > > - I tried the following: > > return > assetSource.getClasspathAsset("assets/components/languageselector/" + > loopLocale.getLanguage() + ".png").toClientURL(); > > - With following error as result: > > Unable to create a client URL for classpath resource > assets/components/languageselector/en.png: The resource path was not > within an aliased path. > > So yea, I'm still stuck here. > > > On 27/03/14 18:14, Thiago H de Paula Figueiredo wrote: >> On Thu, 27 Mar 2014 12:19:41 -0300, Nathan Quirynen >> <nat...@pensionarchitects.be> wrote: >> >>> Hi, >> Hi! >> >>> I'm moving my components to a Tapestry component library. But I'm not >>> sure how to handle images used in those components. >>> Before I just put them in *src/main/webapp/images/* and then used *<img >>> src="${context:/images/something.png" />* >>> >>> But what's the right way of handling images in a Tapestry library. I've >>> been trying different things without success. >>> >>> 1) Where do I put my images >> In the classpath. If you're using the Maven source folder structure, >> and it seems you do, /src/main/resources is the place. >> >>> 2) How can I get the url to these images, also how if I need to get them >>> dynamically (use of AssetSource?) >> ${classpath:/images/something.png} >> --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org