I can't use absolute URLs because I can't make any assumptions about the server environment this will run on. The server will likely vary and even the context name may change. Also, using an old-fashioned relative URL doesn't work for me either since my app is broken up into packages. So I may have page URLs that look like /MyApp/Section/Page1 or /MyApp/MainMenu.
Jean-Philippe > -----Original Message----- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > On Behalf Of Josh Canfield > Sent: Tuesday, December 04, 2007 5:17 PM > To: Tapestry users > Subject: Re: [T5] Obtaining a relative directory path > > If these are just static images in a directory in your webapp > then you don't need the functionality of an Asset for that. > How about just doing it the old fashioned way? > > <img src="/images/some_image.jpg"/> > > Most of my images are done like this... sometimes I need an > absolute url and I prepend that. > > Josh > On Dec 4, 2007 4:45 PM, Jean-Philippe Steinmetz > <[EMAIL PROTECTED]> wrote: > > > Hello all, > > > > I am trying to create a getter that returns the relative > path to the > > images directory for my application. I want it to apply in template > > HTML files > > as: > > > > <img src="${imagesBase}/some_image.jpg"/> > > > > I found a previous thread ( > > > > > http://www.nabble.com/T5-How-to-difine-dynamic-path-for-image-t4834269 > > .html > > ) on how to do this using AssetSource but this did not work > for me as > > it requires the java class to know the exact resource > location. This > > isn't beneficial when work is passed on to web designers who do not > > have any programming experience, nor should have to. > > > > I have also tried the following java code but I keep > getting runtime > > errors > > > > @Inject > > @Path("context:images") > > private Asset imagesBase; > > > > public Asset getImagesBase() { return imagesBase; } > > > > Any help on this would be great. Thanks. > > > > Jean-Philippe Steinmetz > > > > > > -- > -- > TheDailyTube.com. Sign up and get the best new videos on the > internet delivered fresh to your inbox. > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]