function selected ( $param , $value ) {
if ( $param == $value ) print “SELECTED” ;
}

本文实例汇报了php使用google地图应用措施。分享给大家供我们参谋。具体如下:

做项目里境遇jstl访问HashMap里的指标,网络上相似的例程不恐怕满意.

# Collect any form data to control the display

php代码如下:

互连网上日常是

$scale = 10 ;
$maptype = “G_NORMAL_MAP” ;
if ( $_REQUEST [ scale ]) $scale = $_REQUEST [ scale ];
if ( $_REQUEST [ maptype ]) $maptype = $_REQUEST [ maptype ];

复制代码 代码如下:

<%
Map<String,String> map2 = new
HashMap();
map2.put(“a”,”hello world”);
map2.put(“b”,”this is map”);
request.setAttribute(“map2”,map2);

# Geocoding your location
# Note – you would cache this in a file
# The key is domain specific – your google
maps教程 key

function selected ( $param , $value ) { 
if ( $param == $value ) print “SELECTED” ; 
}
 
# Collect any form data to control the display
 
$scale = 10 ; 
$maptype = “G_NORMAL_MAP” ; 
if ( $_REQUEST [ scale ]) $scale = $_REQUEST [ scale ]; 
if ( $_REQUEST [ maptype ]) $maptype = $_REQUEST [ maptype ];
 
# Geocoding your location 
# Note – you would cache this in a file 
# The key is domain specific – your google maps教程 key
 
/* 
$location =
file(” 
output=csv&key=ABQIAAAAvp3__HwvT3VkixIIbsW0axQuKI_6t1bH2P0vCI_Q8jfpn8qdNBQMnnelj 
xh9czilkau_bYSCXteS_A”); 
*/ 
# Following line is hard coded for demo 
$location [ 0 ]= “200,8,51.369318,-2.133457” ; 
list ( $stat , $acc , $north , $east ) = explode ( “,” , $location [ 0
]);

%>
<br>

/*
$location =
file(“
output=csv&key=ABQIAAAAvp3__HwvT3VkixIIbsW0axQuKI_6t1bH2P0vCI_Q8jfpn8qdNBQMnnelj
xh9czilkau_bYSCXteS_A”);
*/
# Following line is hard coded for demo
$location [ 0 ]= “200,8,51.369318,-2.133457” ;
list ( $stat , $acc , $north , $east ) = explode ( “,” , $location [ 0
]);

html页面如下:

键值对遍历<br>
<c:forEach var=”item”
items=”${map2}”>
${item.key} > ${item.value} <br>

?>

复制代码 代码如下:

必发娱乐官方网站,</c:forEach>

<html>
<head>
<title>Well House Manor, Melksham</title>
<script src=”;
key=ABQIAAAAvp3__HwvT3VkixIIbsW0axQuKI_6t1bH2P0vCI_Q8jfpn8qdNBQMnneljxh9czilkau_
bYSCXteS_A”
type=”text/javascript教程”></script>
<script type=”text/javascript”>

<html> 
<head> 
<title>Well House Manor, Melksham</title> 
<script src=” 
key=ABQIAAAAvp3__HwvT3VkixIIbsW0axQuKI_6t1bH2P0vCI_Q8jfpn8qdNBQMnneljxh9czilkau_ 
bYSCXteS_A” 
type=”text/javascript教程”></script> 
<script type=”text/javascript”>
 
//<![CDATA[
 
function load() { 
if (GBrowserIsCompatible()) { 
var map = new GMap2(document.getElementById(“map”)); 
map.setCenter(new GLatLng(51.36905, -2.1335), <?= $scale ?> ); 
map.setMapType( <?= $maptype ?> ); 
var manor = new GLatLng( <?= $north ?> , <?= $east ?> ); 
map.addOverlay(new GMarker(manor));
 

}
 
//]]> 
</script> 
</head> 
<body onLoad=”load()” onUnload=”GUnload()”> 
<table><tr valign=top><td> 
<h1>Well House Manor, Melksham</h1> 
<img src=/get_pic/2010/03/20100525003348607.jpg><br> 
• Business Hotel in Melksham<br> 
• All rooms fitted to superior standard<br> 
• Internet Access throughout<br> 
• Plenty of parking and close to town centre<br><br> 
<a href= House 
Manor website</a><hr> 
<form method=POST> Change to 
<select name=scale> 
<option value=7 <?= selected ( $scale , 7 ) ?>
>Overview</option> 
<option value=10 <?= selected ( $scale , 10 ) ?>
>County</option> 
<option value=13 <?= selected ( $scale , 13 ) ?>
>Town</option> 
<option value=16 <?= selected ( $scale , 16 ) ?>
>Street</option> 
<option value=19 <?= selected ( $scale , 19 ) ?>
>Building</option> 
</select> 
<select name=maptype> 
<option value=G_NORMAL_MAP <?= selected ( $maptype ,
“G_NORMAL_MAP” ) ?> > 
Normal map</option> 
<option value=G_SATELLITE_MAP <?= selected ( $maptype ,
“G_SATELLITE_MAP” ) ?> > 
Satellite data</option> 
<option value=G_HYBRID_MAP <?= selected ( $maptype ,
“G_HYBRID_MAP” ) ?> >
Hybrid</option> 
</select> 
<input type=submit value=”go!”></form><br> 
This is a sample PHP page with Google Maps<br> 
teach you how to write pages like this</a><br> 
Date – <?= date ( “F, jS l Y” ) ?> <br>
 
</td><td> 
<div id=”map” style=”width: 450px; height: 550px”</div> 
</td></tr></table> 
</body> 
</html>

那下边都以相比较轻便的使用.

//<![CDATA[

但愿本文所述对大家的php程序设计有所协助。

的代码大概如下

function load() {
if (GBrowserIsCompatible()) {
var map = new GMap2(document.getElementById(“map”));
map.setCenter(new GLatLng(51.36905, -2.1335), <?= $scale ?> );
map.setMapType( <?= $maptype ?> );
var manor = new GLatLng( <?= $north ?> , <?= $east ?> );
map.addOverlay(new GMarker(manor));

你可能感兴趣的文章:

  • Google地图类型详解及示范代码
  • Google地图控件集详解及实例代码
  • 谷歌(Google) 地图事件实例讲授
  • 谷歌(Google) 地图叠合层实例讲明
  • Google 地图获取API
    Key详细教程
  • 百度地图经纬度调换成腾讯地图/Google对应的经纬度
  • Google Maps
    API地图应用示范分享
  • 谷歌 静态地图API达成代码
  • 为IP查询加多GOOGLE地图作用的代码
  • google地图的路子贯彻代码
  • 谷歌(Google)地图API资料整理及详细介绍

<%

}
}

……….

//]]>
</script>
</head>
<body onLoad=”load()” onUnload=”GUnload()”>
<table><tr valign=top><td>
<h1>Well House Manor, Melksham</h1>
<img
src=;
• Business Hotel in Melksham<br>
• All rooms fitted to superior standard<br>
• Internet Access throughout<br>
• Plenty of parking and close to town centre<br><br>
<a href= House
Manor website</a><hr>
<form method=POST> Change to
<select name=scale>
<option value=7 <?= selected ( $scale , 7 ) ?>
>Overview</option>
<option value=10 <?= selected ( $scale , 10 ) ?>
>County</option>
<option value=13 <?= selected ( $scale , 13 ) ?>
>Town</option>
<option value=16 <?= selected ( $scale , 16 ) ?>
>Street</option>
<option value=19 <?= selected ( $scale , 19 ) ?>
>Building</option>
</select>
<select name=maptype>
<option value=G_NORMAL_MAP <?= selected ( $maptype ,
“G_NORMAL_MAP” ) ?> >
Normal map</option>
<option value=G_SATELLITE_MAP <?= selected ( $maptype ,
“G_SATELLITE_MAP” ) ?> >
Satellite data</option>
<option value=G_HYBRID_MAP <?= selected ( $maptype ,
“G_HYBRID_MAP” ) ?> >
Hybrid</option>
</select>
<input type=submit value=”go!”></form><br>
This is a sample PHP page with Google Maps<br>
teach you how to write pages like this</a><br>
Date – <?= date ( “F, jS l Y” ) ?> <br>

List li = call.execProcedure(obj,
SendUpdateFile.class);
List<SendUpdateFile> list = new
ArrayList<SendUpdateFile>();
    // 遍历集结
    for (int i = 0; i < li.size();
i++) {
        SendUpdateFile ui =
(SendUpdateFile) li.get(i);
        list.add(ui);
       
//System.out.println(ui.toString());
    }
    Pagination p = new
Pagination();
    p.setIndex(tmpcurrPage);
    p.setPageSize(tmppageSize);
    p.setTotle(call.getTotle());
    p.setData(list);
    request.setAttribute(“upFiles“, p);

</td><td>
<div id=”map” style=”width: 450px; height: 550px”</div>
</td></tr></table>
</body>
</html>

……..

HashMap<String, DealerBaseINF>
list1 =  new HashMap<String, DealerBaseINF>();
    // 遍历集合
    for (int i = 0; i
< li1.size(); i++) {
        DealerBaseINF ui
= (DealerBaseINF) li1.get(i);
        list1.put(“” +
ui.getId(), ui);
    }
   
request.setAttribute(“dealers“,
list1);

%>

……..

<td size=”130px”
align=”left”><select name=”delear” id=”delear”
            style=”width:
120px;”>
           
<option>请选择上乘顾客</option>            
            <c:forEach
items=”${dealers}
var=”item”> 
               
<option value=”${item.key}”>${item.value.name}</option>

           
</c:forEach>
       
</select> <font color=”red”>*</font>
</td>

………

<c:forEach items=”${upFiles.data}” var=”li“>
       
<tr>
            <td
align=”center” class=”tab_r1″><%=++i%></td>
            <td
style=”” align=”center” width=”10%”
class=”tab_r1″><input
               
type=”checkbox” id=”rowId” name=”rowId” value=”${li.id}”
/></td>
            <td
align=”center” class=”tab_r1″> 
           
<c:choose>
                  
<c:when test=”${li.delear > 0}”>
           
        ${dealers
[li.delear].name**}**
                  
</c:when>
                  
<c:otherwise>
           
                     无效上乘顾客
                  
</c:otherwise>
           
</c:choose>
            <td
align=”left” class=”tab_r1″> ${li.fileName
}</td>
            <td
align=”center” class=”tab_r1″>${li.ftpUpTime }</td>
            <td
align=”center” class=”tab_r1″>${li.disFlag }</td>
            <td
align=”center” class=”tab_r1″>${li.upOptor }</td>
       
</tr>
   
</c:forEach>

上边入眼说

1:  <c:forEach
items=”${dealers}
var=”item”> 
               
<option value=”${item.key}”>${item.value.name}</option>

2: ${dealers[li.delear].name**}**

item.value返回的 DealerBaseINF
对象,  .name是DealerBaseINF的三个属性.

delear在数据实例中是DealerBaseINF主键的FK
外界应用键. 

${dealers[li.delear].name**}表明意思就依附动态传入的表面援用键,获取**

对应的名称.

思路来源于

如果知道key就直接写${map.key}
如果key是一个变量就写成${map[key]}
例如:
map.put("name", "zhang san");
String tempVal = "name";
${map.name}
${map[tempVal]}

由于[号内的值可以动态变化]所以就容易获得.

由于对jstl不是掌握太熟悉 其中我 测试了 ${dealers.$li.dealer.name},
${dealers[$li.dealer].name},  ${dealers["$li.dealer"].name},均
不对,当然有些直接是错误的写法,反正测试,测试,终于些正确了.

以后对访问复杂jstl有很大帮助.

Author

发表评论

电子邮件地址不会被公开。 必填项已用*标注