0
我是JSPX和Tiles的新手。我的定义瓷砖(瓷砖2.2)是:JQuery 1.8.1 TypeError:d是未定义使用Spring Web MVC + Apache Tiles + JSPX
<tiles-definition>
<definition name="default" template="/WEB-INF/layouts/test.jspx" preparer="com.test.MenuPreparer">
</definition>
</tiles-definition>
我test.jpsx
内容是:
<?xml version="1.0" encoding="UTF-8" ?>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:tiles="http://tiles.apache.org/tags-tiles"
xmlns:c="http://java.sun.com/jsp/jstl/core"
xmlns:jsp="http://java.sun.com/JSP/Page"
xmlns:spring="http://www.springframework.org/tags">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<spring:url value="/scripts/jquery-1.8.1.min.js" var="jqURL" />
<script type="text/javascript" src="${jqURL}"><jsp:text /></script>
</head>
<body>
<h1>TEST!</h1>
</body>
</html>
在我servlet-context.xml
,我已经包括资源位置:
<resources location="/resources/scripts/" mapping="/scripts/**" />
当我试图查看页面是Firefox 14.0.1,我在错误控制台中找到以下内容:
TypeError: d is undefined
http://localhost:8080/test/scripts/jquery-1.8.1.min.js
当我查看IE9同一页上,我得到了在IE控制台以下消息:
SCRIPT5007: Unable to get value of the property 'style': object is null or undefined
jquery-1.8.1.min.js, line 2 character 19451
jQuery将不会在这两个浏览器。
但是当我包括独立的HTML同一jQuery脚本(不部署在TC服务器),我得到了在浏览器控制台和JQuery工作没有错误消息。
如何使JQuery在使用Spring Web MVC + Apache Tiles + JSPX时有效?