I have the following question: I have a project in Java JSP and I do not know how to select the UF combo and the City refresh as I selected earlier. Below I have an example with fixed data, but I want to do it in mysql, I want to know how I can execute the select in the database table. I need an example in my project
I've done everything that's shape and I do not know how to move forward.
I have it from here on mine.
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSP Page</title>
</head>
<script type='text/javascript'>
window.onload = function () {
BindEvent();
}
function BindEvent()
{
var elemToBind = document.getElementById("uf");
elemToBind.onchange = function () {
SetSel(this);
}
}
function SetSel(elem)
{
var secondCombo = document.getElementById("cidade");
secondCombo.value = elem.value;
}
</script>
<body>
<select id="uf">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
</select>
<select id="cidade">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
</select>
</body>
I saw that in this other topic there is what I need but I do not know php needed to run jsp and doing the query in the right bank
Selecting an option in a < select > and load related data into another?