Question

I have some old jsp code that uses the struts tags inside attributes, like this:

<link href="<s:url value='/styles/layout.css'/>" 
  rel="stylesheet" type="text/css" media="all"/>

I can't get this to work in jspx files though. Is there a good alternative to sort of get the same functionality without too much clutter?

Was it helpful?

Solution

Try this

    <c:set var="myUrl"><s:url value='/styles/layout.css'/></c:set>
    <link href="${myUrl}"/>

You may also want to try this form, but I cannot really remember if it works:

    <s:url value='/styles/layout.css' var="anUrl"/>
    <link href="${anUrl}"/>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top