In my first jsp i am getting a list of nearby stores and their other attributes like name of the store, latitude, longitude etc. using Google API.
In my second jsp. i want the latitude and longitude of the particular store that the user has selected from the list shown in first jsp.
I am trying to pass the values of latitude and longitude via href but somehow i cannot. below is my code:
side_bar_html += "<tr><td>" + place.geometry.location.toUrlValue(6) + "</td><td><a href='second.jsp?key='+place.geometry.location.toUrlValue(6)>" + "LINK" + "</a></td></tr>";
place.geometry.location.toUrlValue(6)
gives proper latitude and longitude but while passing this value, nothing appears on second page.
Here's how i am retrieving the value in my second jsp:
<%=request.getParameter("key")%>
Your html markup looks a little off to me. The closing apostrophe enclosing the href attribute is missing:
side_bar_html += "<tr><td>" + place.geometry.location.toUrlValue(6) + "</td><td><a href='second.jsp?key=" + place.geometry.location.toUrlValue(6) + "'>" + "LINK" + "</a></td></tr>";
You should check your generated source code and confirm that the href is valid. Also, try going directly to second.jsp?key=test
to confirm that your jsp is reading the request param correctly.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.