Forums Register Login

HTTP Status 500 - error running servlet with JSP

+Pie Number of slices to send: Send
I'm attempting to run the program from chapter 3 of Head First Servlets & JSP, and I get the following error.I am using apache-tomcat-5.5.17, jdk1.6.0, jre1.6.0



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
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:510)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:393)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
com.example.web.BeerSelect.doPost(BeerSelect.java:34)
javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

root cause

java.lang.NullPointerException
org.apache.jsp.result_jsp._jspService(result_jsp.java:51)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:332)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
com.example.web.BeerSelect.doPost(BeerSelect.java:34)
javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)


my servlet and jsp codes are like this:

result.jsp:
-----------


BeerSelect.jsp:
---------------


please someone help me debug this problem.



[BSouther: Added UBB CODE tags]
[ February 03, 2008: Message edited by: Ben Souther ]
+Pie Number of slices to send: Send
Without seeing the BeerExpert code, or what line is throwing the NPE in the .jsp, my best guess is that there is a null List being returned so the JSP throws the null pointer exception.

I would debug/print-out the contents of that List before you set it as a request attribute.

Tom
+Pie Number of slices to send: Send


You're setting an attribute named "sytles" but looking for an attribute named "styles" in your JSP.

Fix the typo and see if the problem goes away.
+Pie Number of slices to send: Send
Doh! missed that typo . . .
+Pie Number of slices to send: Send
It was indeed typo mistake...thank you all
We don't have time for this. We've gotta save the moon! Or check this out:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 6429 times.
Similar Threads
HTTP Status 500
JCaptcha and Struts
chapter 3:package com.example.model does exist
help needed with tomcat/requestDispatcher - example form HeadFirst servlets and jsp
Unable to compile class for JSP
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 20:13:43.