0

I have a form in a tag file with the action url expected as an attribute.

<%@ attribute name="action" required="true" %>
<form action="${action}"...

But when used in a following manner c:url is passed as a string literal.

<t:a-form action="<c:url value='/a'/>"/>

I came up with a workaround:

<c:url value="/a" var="a"/>
<t:a-form action="${a}"/>

Do I have to use auxiliary variable?

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
user2418306
  • 2,352
  • 1
  • 22
  • 33
  • It is what it is. What task exactly of are you primarily interested in? Then you can just substitute that in EL so you don't need anymore. – BalusC Apr 10 '16 at 17:46
  • I need it to add application context to the url. Why it doesn't work with custom tag but works on the html form tag directly? – user2418306 Apr 10 '16 at 18:07
  • Because it's not legal syntax. Is this helpful in solving your problem? http://stackoverflow.com/a/3658735 – BalusC Apr 10 '16 at 18:08
  • EL workaround is better then mine and technically doesn't require auxiliary variable. But I mainly interested why it's imposible pass tag into tag. Can you elaborate what you mean by illegal syntax? I know that attribute is `String` type by default. But how does this hinders evaluation? – user2418306 Apr 10 '16 at 18:59

0 Answers0