• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

output of result.jsp

 
Praful Chandekar
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi every one,
I am unable to get the output of "result.jsp"

---result.jsp---
<%@ page import="java.util.*" %>

<html>
<body>
<h1 align = "center"> Beer Recommendations JSP</h1>
<p>

<%
List styles = (List)request.getAttribute("styles");
Iterator it = styles.iterator();
while(it.hasNext()) {
out.print("<br>try: " + it.next());
}
%>

</body>
</html>

I am getting java.lang.NullPointerException error in "http://localhost:8080/Beer-v1/result.jsp"
My BeerExpert.java & BeerSelect.java is compiled successfully without error or warning
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64962
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's likely that styles is null. What have you done to figure out why?

 
Praful Chandekar
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am not getting what you said because in BeerSelect.java

List result = be.getBrands(c);
request.setAttribute("styles",result);

then how it could be null
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic