Programación General > Java

 java.lang.ArrayIndexOutOfBoundsException

(1/1)

LordJhony:
Hola....
Se Que Ese Error Se Presenta Porque Intento Acceder A Una Posicion Inexistente En Un Arreglo. Ahi Es Donde No Entiendo Porque La Posicion Que Estoy Intentando Acceder Si Existe.
Lo Que Yo Hago Es Hacer Una Consulta A Mi Base De Datos, Tomo Uno De Los Resultados y Simplemente Quiero Mostrarlo Y Ahi es Donde Se Presenta El Error:

--- Citar ---HTTP Status 500 -

--------------------------------------------------------------------------------

type Exception report

message

descriptionThe server encountered an internal error () that prevented it from fulfilling this request.

exception

java.lang.ArrayIndexOutOfBoundsException: 1
note The full stack traces of the exception and its root causes are available in the GlassFish/v3 logs.


--------------------------------------------------------------------------------

GlassFish/v3
--- Fin de la cita ---
Miren El Codigo:

--- Código: Java ---try        {            if(req.getParameter("B1")!=null)            {               String q="select * from simulador_ecaes.pregunta where Id_Componente='"+id+"'order by rand()limit 0,1";               try               {                bd.valida = bd.ingreso.executeQuery(q);                while(bd.valida.next())                {                    String pre=bd.valida.getString("Id_Pregunta");                    pag.println(pre);                }               }catch(SQLException e){}            }        }        catch(Exception e){} La Verdad Yo No Veo Ningun Problema. Espero Y Me Puedan Colaborar Diciendome Que me Genera El Error Y Como Solucionarlo.
Muchas Gracias

m0skit0:
¿En qué línea concretamente te da el error?

LordJhony:
Gracias... Ya He Solucionado El Problema... Resulta Que La Variable "id"
Del Query No Le Estaba Llegando Informacion Del Jsp

Navegación

[0] Índice de Mensajes

Ir a la versión completa