getRequest().getRelativePathPrefixToContextRoot() will get you the
"../.." part automatically

-igor


On Fri, Feb 29, 2008 at 9:50 AM, spencer.c <[EMAIL PROTECTED]> wrote:
>
>  I have a component that allows the user to pass in a url.  The component
>  generates a link, and sets the passed in url as an href attribute, along
>  with other things.
>
>  Everything works fine when the heirarchy is flat, but when nested, the image
>  url isn't right.  Lets say I have a picture at webapp/images/1.jpg.  If I
>  have a regular image in the nested page, and put in src="images/1.jpg", it
>  comes out as src="../../images/1.jpg" and everything works.  If you pass my
>  component the url "images/1.jpg", however, it comes out as
>  href="images/1.jpg", which doesn't work, because it wasn't interpreted to
>  take the folder depth into account.
>
>  I can currently pass in the url with the "../.." already there, and
>  everything will work, but I'd prefer to get it to work more elegantly.  How
>  do I get the component to be smart about locating the specified url
>  according to where it is in the folder heirarchy?  ie, automatically output
>  "../../images/1.jpg", in this example.
>
>  There is some magic happening to the default links that I want to work for
>  my component as well, but I haven't been able to locate where it is taking
>  place.
>
>  A nudge in the right direction would be appreciated, thanks!
>
>
>
>
>  --
>  View this message in context: 
> http://www.nabble.com/Component-quest-re%3Anested-component-urls.-tp15763869p15763869.html
>  Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: [EMAIL PROTECTED]
>  For additional commands, e-mail: [EMAIL PROTECTED]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to