On Mon, 8 Apr 2002, Steve Morrison wrote:

> I noticed that <c:param>'s in a <c:url> are added backwards.
> So if I have:
> <c:url var="my_url" value="http://example.com/script.jsp";>
>   <c:param name="A">1</c:param>
>   <c:param name="B">2</c:param>
>   <c:param name="C">3</c:param>
> </c:url>
> It produces:
> http://example.com/script.jsp?C=3&amp;B=2&amp;A=1
> 
> This isn't so good because I have an app that expects things 
> a certain way.

This, however, is intentional because it's the only way to emulate the
behavior of <jsp:include> and <jsp:param>, and this behavior is called for
by the JSTL spec.  (Later parameters must supercede earlier parameters,
and the only way to accomplish this is to make sure that later parameters
come first.)  The goal is to interoperate well with JSP pages, and this is
(unfortunately) incompatible with applications that care about the order
of their request parameters and apply a different algorithm for their
interpretation than JSP/Servlet does.

> Also, I've found the whole <c:url> stuff to be a bit clunky.
> It would be nice if it accepted body content, something like:
> <c:url var="my_url>
>   <%@ include file="my_host.jsf" %><c:out value="${my_var}"/>
> <c:param ...> etc.
> 
> Right now I need to create some variables, and do
> <c:url var="my_url" value="${my_var}">
> 
> But this is awkward if I have multiple urls, and the params are the
> same, but the paths are different.  Especially so, since the only
> reason I'm using <c:param> is that it url encodes strings for me.

I'm not sure I'm clear what you're asking for.  You'd want the URL base
path to come from the body in addition to the 'value' attribute?  In
principle, this is plausible, although it adds no new functionality --
just a new syntax.  Still, I suggest sending that comment to
[EMAIL PROTECTED] so that it gets recorded officially.

Thanks for the comments,

-- 
Shawn Bayern
Author, "JSP Standard Tag Library"  http://www.jstlbook.com
(coming this summer from Manning Publications)


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

Reply via email to