Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

HTTP Status 500 - null pointer exception

 
vijay sharmaa
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi

I am getting error as below please help to resolve this issue.

HTTP Status 500 -

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

type Exception report

message

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

exception
org.apache.jasper.JasperException: An exception occurred processing JSP page /DisplayAll.jsp at line 94

91: <td width="7%" class="stylegrey"><%=status.get(i)%></td>
92: <td width="13%" class="stylegrey"><%=lastLogin.get(i)%></td>
93: <td width="12%" align="center">
94: <% if(status.get(i).equals("Disabled")) { %>
95: <a href="javascript:setlocation('<%=sid.get(i)%>','Enabled')" class="stylelink" style="text-decoration:none">Enable</a>
96: <% } else if(status.get(i).equals("Enabled")) { %>
97: <a href="javascript:setlocation('<%=sid.get(i)%>','Disabled')" class="stylelink" style="text-decoration:none">Disable</a>


Stacktrace:
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:553)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:457)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:391)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:393)



root cause
java.lang.NullPointerException
org.apache.jsp.DisplayAll_jsp._jspService(DisplayAll_jsp.java:223)
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:419)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:391)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:393)
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65335
97
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch.

Firstly, you should not be putting Java code into a JSP. That is an obsolete and poor practice from over 12 years ago. Do you not think that it is time to update your JSP skills to modern levels?

Next, this portion of the stack trace is the important one:
root cause
java.lang.NullPointerException
org.apache.jsp.DisplayAll_jsp._jspService(DisplayAll_jsp.java:223)

It tells you that you are making a null reference somewhere in the JSP.

Your first step should be to learn how to write web apps properly without using Java code in a JSP and to use only the JSTL and EL in the JSPs. Any Java code that is needed should be placed in Java classes that either serve as beans or controllers.

If you need a primer on JSP, please read this article.

If you'd like to learn how to properly structure a web app, see this article.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic