开发者

jsp java: my tag files don't replace parameters

script.tag:

<%@ attribute name="file" required="true"%>
<script type="text/javascript" src="/path/to/${file}"></script>

my.jsp

<%@ page l开发者_运维百科anguage="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%> 
<%@ taglib tagdir="/WEB-INF/tags" prefix="x"%>
<x:script file="register.js"/>

however, the ${file} param does not get replaced and stays literally ${file}

Help!


Did you try adding pageScope when you use the attribute in the tag? Like this:

<script type="text/javascript" src="/path/to/${pageScope.file}"></script>


Moving to tomcat 6 fixed this.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜