Hi,
I've been trying to get the right way to send parameters to a JSP from
a HTML form. The referred JSP must get the values of the selects form,
because it executes queries and does stuff with that values. But the
only thing I've got it's a Tomcat error report.
The menu.jsp is something like this:
.... // HTML stuff
<script language='JavaS cript'>
function valida()
{
var ok=true;
var indexAccion = document.forms[0].accion.selecte dIndex;
var indexTablas = document.forms[0].tablas.selecte dIndex;
var indexBDatos = document.forms[0].BDatos.selecte dIndex;
if (indexAccion==0 || indexTablas==0 || indexBDatos==0)
{
alert("Elige un criterio");
ok=false;
}
if (ok)
document.forms[0].submit();
window.location .href =
document.forms[0].accion.options[indexAccion].value;
}
</script>
.... // HTML stuff
<form method='post' ***SHOULD BE THE accion.selected Index.value***>
<select name="accion">
<option value="inicio" selected>Selecc iona una opcion
<option value="visualiz a.jsp">Visualiz ar registros de la tabla
<option value="modifica .jsp">Modificar registros de la tabla
</select>
<select name="tablas">
<option value="inicio" selected>Selecc iona una tabla
<option value="tbl1">Ta bla 1
<option value="tbl2">Ta bla 2
</select>
<select name="BDatos">
<option value="inicio" selected>Selecc iona una base
<option value="db1">Bas e 1
<option value="db2">Bas e 2
</select>
<br><br><br>
<input type="button" value="Aceptar" onclick='valida ()'>
</form>
Any ideas to figure it out?
Regards,
- Omar.
I've been trying to get the right way to send parameters to a JSP from
a HTML form. The referred JSP must get the values of the selects form,
because it executes queries and does stuff with that values. But the
only thing I've got it's a Tomcat error report.
The menu.jsp is something like this:
.... // HTML stuff
<script language='JavaS cript'>
function valida()
{
var ok=true;
var indexAccion = document.forms[0].accion.selecte dIndex;
var indexTablas = document.forms[0].tablas.selecte dIndex;
var indexBDatos = document.forms[0].BDatos.selecte dIndex;
if (indexAccion==0 || indexTablas==0 || indexBDatos==0)
{
alert("Elige un criterio");
ok=false;
}
if (ok)
document.forms[0].submit();
window.location .href =
document.forms[0].accion.options[indexAccion].value;
}
</script>
.... // HTML stuff
<form method='post' ***SHOULD BE THE accion.selected Index.value***>
<select name="accion">
<option value="inicio" selected>Selecc iona una opcion
<option value="visualiz a.jsp">Visualiz ar registros de la tabla
<option value="modifica .jsp">Modificar registros de la tabla
</select>
<select name="tablas">
<option value="inicio" selected>Selecc iona una tabla
<option value="tbl1">Ta bla 1
<option value="tbl2">Ta bla 2
</select>
<select name="BDatos">
<option value="inicio" selected>Selecc iona una base
<option value="db1">Bas e 1
<option value="db2">Bas e 2
</select>
<br><br><br>
<input type="button" value="Aceptar" onclick='valida ()'>
</form>
Any ideas to figure it out?
Regards,
- Omar.
Comment