<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<title>地图浏览</title>
<%@ page isELIgnored="true" %>
<link href="theme/global.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="lib/OpenLayers.js"></script>
<script type="text/javascript">
function init(){
var map = new OpenLayers.Map("map");
var tdt = new OpenLayers.Layer.XYZ("tdt","http://tile0.tianditu.com/DataServer?T=sbsm1518&x=${x}&y=${y}&L=${z}");
map.addLayer(tdt);
map.setCenter(new OpenLayers.LonLat(116.3809,39.92361), 15);
map.addControl(new OpenLayers.Control.MousePosition());
}
</script>
</head>
<body οnlοad="init()">
<div id="map"></div>
</body>
</html>
以上是用TMS请求天地图的一个影像图层,在改成JSP时,发现$(x)无法编译成servlet
<%@ page isELIgnored="true" %>
是忽略EL表达式的。加上这句就可以了