Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/371.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/206.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 这个jsp没有显示任何输出,甚至没有显示谷歌地图。需要帮助吗?_Java_Android_Google Maps_Jsp_Servlets - Fatal编程技术网

Java 这个jsp没有显示任何输出,甚至没有显示谷歌地图。需要帮助吗?

Java 这个jsp没有显示任何输出,甚至没有显示谷歌地图。需要帮助吗?,java,android,google-maps,jsp,servlets,Java,Android,Google Maps,Jsp,Servlets,我正在建立一个网页,显示用户从android应用程序发送的lat/LAGS。我已经成功地接收了那些lat/lngs,并且还使用DAO和servlet类将它们插入了数据库中。现在对jsp中的java脚本知之甚少。如何将这些参数传递到此jsp中,以便它可以在地图上显示它们 <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> <

我正在建立一个网页,显示用户从android应用程序发送的lat/LAGS。我已经成功地接收了那些lat/lngs,并且还使用DAO和servlet类将它们插入了数据库中。现在对jsp中的java脚本知之甚少。如何将这些参数传递到此jsp中,以便它可以在地图上显示它们

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
    <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<script type="text/javascript">
</script>
<style>


<% int i= 0;%>
              <c:forEach var="usinf" items="${LatLang}">

  #map-canvas_<%=i%> {
        height: 150px;
        width: 250px;
        margin: 0px;
        padding: 0px
      }

       <% i= i+1;%>
     </c:forEach>


</style>
<script type="text/javascript"
    src="http://maps.google.com/maps/api/js?sensor=set_to_true_or_false">



</script>
<script>
function initialize() {

    <% i= 0;%>

    <c:forEach var="usinf" items="${LatLang}">


    var geocoder<%=i%>;
    var mapsss<%=i%>;

    var infowindow<%=i%> = new google.maps.InfoWindow();

    var marker<%=i%>;

    geocoder<%=i%> = new google.maps.Geocoder();


     var latlng<%=i%> = new google.maps.LatLng(${usinf.pickuplat},${usinf.pickuplng});

     geocoder<%=i%>.geocode({'latLng': latlng<%=i%>}, function(results, status) {




             if (status == google.maps.GeocoderStatus.OK) {
                  if (results[1]) {
                    mapsss<%=i%>.setZoom(11);
                    marker<%=i%> = new google.maps.Marker({
                        position: latlng<%=i%>,
                        map: mapsss<%=i%>
                    });
                    infowindow<%=i%>.setContent(results[1].formatted_address);
                    infowindow<%=i%>.open(mapsss<%=i%>, marker_<%=i%>);
                  }else {
                      alert('No results found');
                  }


         }else {
              alert('Geocoder failed due to: ' + status);
            } 
     });

      var mapOptions<%=i%> = {
                zoom: 8,
                center: latlng<%=i%>,
                mapTypeId: 'roadmap'
              }
      mapsss<%=i%> = new google.maps.Map(document.getElementById('map-canvas_<%=i%>'), mapOptions<%=i%>);
       <% i= i+1;%>

     </c:forEach>
}


google.maps.event.addDomListener(window, 'load', initialize);



</script>

<title>Insert title here</title>
</head>
<body>
<body onload="initialize()">
  <div id="map-canvas_" style="width:100%; height:100%"></div>
</body>
</body>
</html>
我的servlet do post方法

protected void Process(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        // TODO Auto-generated method stub

        Authenticate authplots = new Authenticate();
        List<UserInfo> getTheLatlangs = authplots.GetAllLangs();

         request.setAttribute("LatLang", getTheLatlangs);
         RequestDispatcher view = request.getRequestDispatcher("Testmaps.html");
         view.forward(request, response);



    }

使用JSTL,我是这样做的。也许会有帮助

 <script type="text/javascript">

    var markers = [
       <c:forEach var="row" items="${result.rows}">
                   ['<c:out value="${row.aciklama}" />',
                     <c:out value="${row.KONUME}" />,
                     <c:out value="${row.KONUMB}" />,
                     <c:out value="${row.EVID}" />,
                    '<c:out value="${row.aptadi}" />',
                    '<c:out value="${row.mahalle}" />',
                    '<c:out value="${row.sokak}" />',
                    '<c:out value="${row.durumu}" />',
                    '<c:out value="${row.metrekare}" />',
                    '<c:out value="${row.fiyat}" />',
                    '<c:out value="${row.odasayisi}" />'],
        </c:forEach>   ];  
 </script>
您可以在github中查看