Question

I have some scripts in my application and their src attribute is determined by spring:theme :

<script src = "<spring:theme code='js.jquery'/>"></script>

And that works fine.

Now I'd like the to be my own custom tag, so I changed it to:

<cc:script src = "<spring:theme code='js.jquery'/>" type="text/javascript"></cc:script>

The problem is, that src attribute of

public class ScriptTag extends BodyTagSupport {

    private String src;

    public void setSrc( String src ) {
        this.src = src;
    }

    ....

}

isn't evaluated, so value of src is

"<spring:theme code='js.jquery'/>"

Is there any way that I can get evaluated value of this attribute?

Was it helpful?

Solution

<script> is a HTML tag, which isn't interpreted by the JSP engine.

<cc:script> and <spring:theme> on the other hand, are JSP tags, which are interpreted by the JSP engine and you can't nest JSP tags the way that you can do with JSP tags in attributes of HTML tags.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top