Hi all, this problem is very nice solved in c:url JSP tag. When the URL is absolute (starting with /) then the context is added before (request.getContextPath()) otherwise the URL is relative and leaved the same as it was.
I think it shouldn't be problem to create component solving this problem. Jirka Howard Lewis Ship napsal(a): > > This is a conscious decision, that you will know early on what the > context path will be. > > The effort to avoid this in T4, using a <base> tag, caused far more > problems than it solved. > > A solution using query parameters is likewise: it makes your site > off-limits to any kind of search engine, and it tends to create longer > and less "pretty" URLs. > > On 3/12/07, D&J Gredler <[EMAIL PROTECTED]> wrote: >> I've never had to operate out of a context other than root, so I've just >> hardcoded it to "/mystyle.css" or whatever... >> >> >> On 3/12/07, Bogdan Calmac <[EMAIL PROTECTED]> wrote: >> > >> > Consider a UserDetail page that has an URL like >> > "http://server/context/UserDetail/jdoe". Here I'm using the tapestry >> > style of passing parameters, as part of the context. The problem here >> > is that if you have a styleset link to "mystyle.css", it will try to >> > look for "http"://server/context/userdetail/mystyle.css" which of >> > course does not exit. The alternative to use the full path to the css, >> > "/context/mystyle.css" is also bad because you don't want to hardcode >> > the name of the context. >> > >> > There are 2 correct solutions to this problem which would be nice to >> > be part of the framework: >> > >> > 1. Allow context information to (optionally) be passed to a page as >> > query parameters, so the above URL would be >> > "http://server/context/UserDetail?userid=jdoe". The relative link to >> > the stylesheet would be fine now, but I don't know if this fits with >> > the design of the framework. >> > >> > 2. Create something like an AssetLink component that takes care to >> > prepend so context, so that: >> > >> > <link t:type="AssetLink" href="/mystyle.css" rel="stylesheet" >> > type="text/css"/> >> > >> > would generate; >> > >> > <link href="/context/mystyle.css" rel="stylesheet" type="text/css"/> >> > >> > >> > I would expect there were others who encountered the same quirk. How >> > did you address it? >> > >> > Thank you, >> > Bogdan Calmac. >> > >> > --------------------------------------------------------------------- >> > To unsubscribe, e-mail: [EMAIL PROTECTED] >> > For additional commands, e-mail: [EMAIL PROTECTED] >> > >> > >> > > -- Jiří Mareš (mailto:[EMAIL PROTECTED]) ČSAD SVT Praha, s.r.o. (http://www.svt.cz) Czech Republic --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]