wds
wds

Reputation: 32293

use struts tags inside attributes in jspx files

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?

Upvotes: 1

Views: 1397

Answers (1)

krosenvold
krosenvold

Reputation: 77181

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}"/>

Upvotes: 1

Related Questions