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?

有帮助吗?

解决方案

<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.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top