开发者

jsp java: my tag files don't replace parameters

开发者 https://www.devze.com 2023-01-28 18:20 出处:网络
script.tag: <%@ attribute name=\"file\" required=\"true\"%> <script type=\"text/javascript\" src=\"/path/to/${file}\"></script>

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

精彩评论

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