Map Goggle map?

Spices and polypary, please help in JSP file I have the script that allows you to place markers on the Google map:

var stationList = [


 {"latlng":[43.00000000, 43.00000000], name:"Shinagawa Station", url:"/MastersServlet?action=listUser", address:"-----str"},
 {"latlng":[43.00000000, 43.00000000], name:"Station", url:"../barber/beuaty/masterslist.jsp", address:"-----str" },

 {"latlng":[43.00000000, 43.00000000], name:"Tokyo1 Station", url:"second.php", address:"----str"},
 {"latlng":[43.00000000, 43.00000000], name:"Shinagawa1 Station", url:"second.php", address:"-----str"},
 {"latlng":[43.00000000, 43.00000000], name:"Station", url:"second.php", address:"------ str" },

 {"latlng":[43.00000000, 43.00000000], name:"Tokyo2 Station", url:"second.php", address:"----- str"},
 {"latlng":[43.00000000, 43.00000000], name:"Shinagawa2 Station", url:"second.php", address:"-----str"},
 ];


all scrpit if need be will lay out, now the question is: what would be manually the whole thing not to score, I think the record from the DB, which I did, but then pull them out using the JSTL code does not work , rather he does not see the data from the database. The database is connected, the hetero and cetery written, business TAO also wrote, with the controller too, everything is OK.

<code lang="javascript">
 <c:foreach items="${users}" var="user">
 var stationList = [
 {"latlng":[<c:out value="${user.lat}">, <c:out value="${user.lng}">], name:"<c:out value="${user.name}">", url:"<c:out value="${user.url}\">", address:"<c:out value="${user.addres}">"},
<!--C:forEach-->
</c:out></c:out></c:out></c:out></c:out></c:foreach></code>


TAO

public List<user> getAllUsers() {
 List<user> users = new ArrayList<user>();
 try {
 Statement statement = connection.createStatement();
 ResultSet rs = statement.executeQuery("select * from table");
 while (rs.next()) {
 User user = new User();
user.setName(rs.getString("name"));
user.setAddres(rs.getString("addres"));
user.setLat(rs.getString("lat"));
user.setLng(rs.getString("lng"));
 /* user.setMasteregistration(rs.getDate("masterregistration"));*/
users.add(user);
}
 } catch (SQLException e) {
e.printStackTrace();
}
 return users;
 }</user></user></user>
June 7th 19 at 14:30
2 answers
June 7th 19 at 14:32
Solution
The loop should be done inside the generated array.
And where is the closing tag of the loop?
And why do some lines?

The body of the loop to form a string with the coordinates.
Ie need to write it once, just it will be repeated/displayed several times.
Cycle put inside the array and closing too , the example was corrected - Hershel_Murray commented on June 7th 19 at 14:35
And if so?
var stationList = [
 <c:foreach items="${users}" var="user">
 {"latlng":[<c:out value="${user.lat}">, <c:out value="${user.lng}">], name:"<c:out value="${user.name}">", url:"<c:out value="${user.url}\">", address:"<c:out value="${user.addres}">"},
<!--C:forEach-->
{}
 ];</c:out></c:out></c:out></c:out></c:out></c:foreach>
- Jerry.Dickinson commented on June 7th 19 at 14:38
June 7th 19 at 14:34
Isn't it easier to jsp pass a ready array?

Find more questions by tags JSPJavaScriptMySQLJavaGoogle Maps