
Hello,
I have a dropdownbox on my webpage and a map which contains a marker, and that marker contains a button, on click of that button i need to get the name of the selected value from the dropdown list and dispaly it to on the next page.
i used request.getParameter("") but its not working its printing "null".
So could you please help me out with this!!
thanks, Pradeep

Hi Friend,
Try this:
1)combo.jsp:
<html> <form method="post" action="selectedValue.jsp"> Select Programming Language: <select name="lang"> <option value="C/C++">C/C++</option> <option value="C#">C#</option> <option value="Java">Java</option> <option value="Perl">Perl</option> <option value="Python">Python</option> </select><br> <input type="submit" value="Submit"><br> </form> </html>
2)selectedValue.jsp:
<%
String selectedValue=request.getParameter("lang");
out.println("Selected Value is: "+selectedValue);
%>

Hi Friend,
Try this:
1)combo.jsp:
2)selectedValue.jsp:
<%
String selectedValue=request.getParameter("lang");
out.println("Selected Value is: "+selectedValue);
%>

but my problem is i have the button on my marker and the dropdownlist is on the webpage so how to link both button and dropdownlist
can u please help me on this issue

Hi Friend,
Post your code.
Thanks

ok iam posting my code
This is my 1.jsp file
<%@page contentType="text/html" pageEncoding="UTF-8"%> <%@page import="java.sql.*" %>
<%!
int i=1;
Connection connection = null;
boolean foundResults = false;
ResultSet set = null;
Statement statement = null;
String city;
String ip;
String sysname;
String sess;
%>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<title>Google Maps API Sample</title>
<script src="http://maps.google.com/maps?file=api&v=2&sensor=false&key=ABQIAAAAPDUET0Qt7p2VcSk6JNU1sBSM5jMcmVqUpI7aqV44cW1cEECiThQYkcZUPRJn9vy_TWxWvuLoOfSFBw" type="text/javascript"></script>
<script src="http://maps.google.com/maps?file=api&v=2&sensor=false&key=ABQIAAAA1XbMiDxx_BTCY2_FkPh06RRaGTYH6UMl8mADNa0YKuWNNa8VNxQEerTAUcfkyrr6OwBovxn7TDAH5Q"></script>
<script type="text/javascript">
var map;
var geocoder;
var address=sel.options[sel.selectedIndex].value;
document.write(address);
//sess = address;
//session.setAttribute("sess1",sess);
function createMarker(point,html,what)
{
var marker = new GMarker(point,{id:what, name:"foo", description:"baz"});
GEvent.addListener(marker, "mouseover", function() {
marker.openInfoWindowHtml(html);
});
return marker;
}
function initialize()
{
map = new GMap2(document.getElementById("map_canvas"));
map.addControl(new GLargeMapControl());
map.addControl(new GScaleControl());
map.setCenter(new GLatLng(79, 0, true), 8);
map.addControl(new GMenuMapTypeControl(true,false));
var point1 = map.getCenter();
var marker = createMarker(point1,'<img src="printers-for-wire-and-network-elements-marking-43844.jpg" width="100" height="100">',"this")
map.addOverlay(marker);
geocoder = new GClientGeocoder();
}
function addAddressToMap(response) {
map.clearOverlays();
if (!response || response.Status.code != 200) {
alert("Sorry, we were unable to geocode that address");
} else {
place = response.Placemark[0];
point = new GLatLng(place.Point.coordinates[1],
place.Point.coordinates[0]);
//var test = 'ajaykumar';
//alert(test);
var marker = createMarker(point,'<form action="/Details.jsp"><input type="image" name="b" value="click" src="printers-for-wire-and-network-elements-marking-43844.jpg" width="100" height="100"></form>',"this");
map.addOverlay(marker);
marker.openInfoWindowHtml('<b>Coordinates:</b>' + place.Point.coordinates);
}
}
function showLocation(sel)
{
address = sel.options[sel.selectedIndex].value;
geocoder.getLocations(address, addAddressToMap);
}
function findLocation(address)
{
showLocation();
}
function find()
{
window.open("/Details.jsp","winA","width=300,height=300,resizeable=no")
}
</script>
</head>
<body onload="initialize()" onunload="GUnload()" style="font-family: Arial;border: 0 none;">
<form name="f1" action="#" onsubmit="showLocation(); return false;">
<p>
<TABLE ALIGN="CENTER">
<b>Search cities:</b>
<%
try
{
Class c = Class.forName("org.postgresql.Driver");
//out.print(c);
connection = DriverManager.getConnection("jdbc:postgresql://localhost:5432/postgres","postgres", "password");
statement = connection.createStatement();
set = statement.executeQuery("SELECT sno,city,ip,sysname FROM test");
%>
<select name="htmlcombo" onchange="showLocation(this)">
<%
while(set.next())
{
%>
<option value=<%= set.getString(2)%>> <%= set.getString(2)%> </option>
<% }
%>
</select>
</TABLE>
<%
}
catch(Exception e)
{
e.printStackTrace();
}
%>
</p>
</form>
<div id="map_canvas" style="width: 1250px; height: 740px"></div>
<form>
<%
try{
out.print(set.getString(2));
%>
<%
}
catch(Exception e)
{}
%>
</form>
</body>