I am trying to create a servlet which can obtain the parameter of the drop down box in html and use this parameter to query a database.
my html:
<form action="servlet/currencyservlet">
<select>
<option name="usd">United States Dollar</option>
<option name="pounds">United Kingdom Sterling Pound</option>
</select>
<select>
<option name="cad">Canadian Dollars</option>
<option name="cny">Chinese Yuan</option>
</select>
<input type="submit" value="Check Rate"/>
</form>
my java:
...
...
...
conn = DriverManager.getConnect("jdbc:mysql://localhost:3306/currencydb", "root", "");
...
try{
string qstr = "SELECT source_currency, target_currency FROM currencytable WHERE????
}
"source_currency" can be "usd" or "pounds" where "target_currency" can be "cny" or "cad". My query wishes to extract the exchange rate from the "currencytable" and display result in the servlet. How do I parse the parameters of the drop down boxes?