• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JSP Only-Session cookies error

 
Gez Sosa
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everyone!

i have a problem with a project.

i am getting org.apache.jasper.JasperException. i dont know whats the reason.

i am getting error at this step

step 55:
Cookie[] cookiesdevueltas = request.getCookies();
Cookie cookie_individual;
52: String Apellido_Registrado;
53: String Nombre_Registrado;
54: int i;
55: for(i=0; i< cookiesdevueltas.length;i++)
56: {
57: cookie_individual = cookiesdevueltas[i];
58: if(cookie_individual.getName().equalsIgnoreCase("nombre"))


Stacktrace:
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:568)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:470)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)

causa raĆ­z

java.lang.NullPointerException
org.apache.jsp.Inicio_jsp._jspService(Inicio_jsp.java:118)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)


Please help me to solve this prob. Thanks in advance
 
Stefan Evans
Bartender
Posts: 1784
10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Insert standard disclaimer here about how you shouldn't use Java in a JSP file...

But the information is all in the error message. You have to ask yourself what could be null on line 55 of your JSP?


It's not 'i'
so it must be cookiesdevueltas

A quick check of the API proves that the get cookies method returns:
an array of all the Cookies included with this request, or null if the request has no cookies
There are no cookies with the request, hence your null pointer exception.

A quick check of


should solve your null pointer problem.


 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic