Ver Mensaje Individual
  #1 (permalink)  
Antiguo 21/03/2008, 16:49
hsoft
 
Fecha de Ingreso: diciembre-2007
Mensajes: 22
Antigüedad: 16 años, 4 meses
Puntos: 0
menu javascript con jsp

comp puedo hacer dinamico un menu de javascritp con jsp, tengo una tabla recursiva

id_menu | nombre | id_padre


1 opcion1 0 (no tiene padre)
2 opcion 2 0 (no tiene padre)
3 opcion 3 1 (su padre es opcion 1)
4 opcion 4 1 (su padre tambien es opcion 1)



lo q quiero hacer es al darle click a opcion1 me desspliegye las opciones 3 y 4

tengo el codigo javascript funcionando de manera estatica bien, cuando le aplico jsp, me muestra los datos pero solo de las dos primeras opciones(las que no tienen padre), por q cuando le doy click em la opcion 1 no me despliega lo q deberia mostrar(opcion 3 y 4)

que puede estar pasando ???

aqui dejo el codigo jsp

<div id="mainContainer">
<br/>

<div id="leftColumn">

<%

String[] campos=new String[2];
String inicio="";
String fin="";
String padre="";
sql="select * from tipo_proceso";

if(padre.trim().length()==0)
{
sql+=" where id_padre is null or id_padre=0";
inicio="<ul id=\"listMenu\">";
fin="</ul>";

}
else
{
sql+="where id_padre="+padre;

inicio="<ul>";
fin="</ul>";

}
out.print(sql);
int filas=0;
try {
rpta=oper.executeQuery(sql);

while(rpta.next())
{
filas=rpta.getRow();
out.println("registros encontrados:");

if(filas>0)
{

campos[0]=String.valueOf(rpta.getInt("id_tipo"));
campos[1]=rpta.getString("nombre_tipo");

out.println(inicio);

out.print("<li>");
out.print("<a href=\"#?detalle='"+campos[0]+"'\" >"+campos[1]+"</a>");
out.print("</li>");
out.print(fin);
}

}


}catch(SQLException ex) {
ex.printStackTrace();
}


%>


</div>
</div>
</th>


ayuda please....