The session-id information that c:import removes, is not the web module bit that gets prefixed by c:url, or your extension of html:rewrite. Incidentally, html:rewrite is meant to allow module-relative referencing of resources (page="/resource-name") ... I'm guessing this is a bit different than c:url's advertised purpose. Have you considered extending c:url instead of html:rewrite? If you don't want the module-prefix added, you could also extend the behaviour of <html:rewrite href="<resource>" ... > which wouldn't prepend the module-name, but would still be able to do the custom stuff you're apparently needing to do.

Incidentally, if all you need to do is append a few parameters, setting up a hash map using jsp:useBean and passing that map to a plain-vanilla html:rewrite, might do the trick for you.

Brice

K.C. Baltz wrote:

I've left out a bit of detail in the hopes of making this simpler :). I'm not actually using <c:url>, but rather a custom tag that extends the Struts <html:rewrite> tag. My custom tag modifies the passed in URL, so I can't skip that step. I could probably modify my custom tag to not prepend the /context, but it seems like this is something that should work. In the jstl-1.0 spec, it says the following:


"In such a situation, <c:url> may be used to build a URL with query string parameters. <c:import> will remove any session id information if necessary (see Section 7.5)." -From section 7.4


I'll try filing a bug and see what the jakarta-taglib developers think.
For now, I'm prepending the "http://server:port"; to make it an absolute URL, but that's probably slower and certainly less elegant.
K.C.


P.S. Speaking of elegant, perhaps my best bet is to extend <c:import> with a custom tag....

Kris Schneider wrote:

You're right about why it's failing (prepending of app context). This kind of
thing should work:


<c:set var="textURL" value="/text.html"/>

<c:import url="${textURL}"/>

You could then also use textURL with <c:url>:

<a href="<c:url value="${textURL}"/>">...

Quoting "K.C. Baltz" <[EMAIL PROTECTED]>:



For various reasons, I am generating a URL for a context relative resource using <c:url> and storing the result in a variable. Then I'm using that value in a <c:import> in an attempt to include the content of the resource in the page. Example:

<!-- Stores "/myContext/text.html" in the variable textURL -->
<c:url value="/text.html" var="textURL" />

<!-- attempts to insert the contents of text.html in the page, but nothing happens -->
<c:import url="${textURL}" />


I'm pretty sure the problem is that <c:url> generates a url with a leading slash followed by the context name, when <c:import> expects URLs that start with a slash to be relative to the current context. The spec seems to indicate <c:import> can handle URLs generated with <c:url>, but I don't see how.

Help?

K.C.






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


-- Brice D. Ruth Sr. IT Analyst Fiskars Brands, Inc.



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



Reply via email to