I created custom tag for encoding and rewriting URLs with dynamic parameters. For ex.:
<mytags:outUrl url="${value1}" id="${value2}" />
works as expected (url
is standard parameter and id
is first dynamic parameter).
Is it possible to also have dynamic parameter names like this directly?
<mytags:outUrl url="${var1}" ${name1}="${var2}" />
I know it is possible to use <jsp:attribute>
but it is too much code:
<mytags:outUrl url="${var1}"><jsp:attribute name="${name1}">${var2}</jsp:attribute></mytags:outUrl>
You're reinventing the JSTL, which already has a standard tag to do that:
<c:url value="${someUrl}">
<c:param name="${someName}" value="${someValue}"/>
<c:param name="${someOtherName}" value="${someOtherValue}"/>
</c:url>
To answer your question: no, the syntax you propose isn't supported. The closest to what you're suggesting is dynamic attributes. See http://www.javabeat.net/2009/02/dynamic-attributes-in-tag-file-in-jsp-2-0/ and http://www.coderanch.com/t/170429/java-Web-Component-SCWCD/certification/Tutorial-Dynamic-Attributes for examples.