Boa Tarde Pessoal, alguem poderia me ajudar com o seguinte erro? Estou seguindo um tutorial e me deparei com o seguinte problema.
[code]<%@page contentType=“text/html”%>
<%@page pageEncoding=“UTF-8” import=“java.sql.,MyCompletWebApp.Control.,MyCompletWebApp.Dao.*”%>
<jsp:useBean id=“productsBean” scope=“session” class=“MyCompletWebApp.Control.ProductControl”/>
<%@ taglib prefix=“c” uri=“http://java.sun.com/jsp/jstl/core” %>
The Products
Name | Price | Stock | Action |
${product.name} | ${product.price} | ${product.stock} | EditRemove |
o erro está apontando para
<c:forEach items="${productsBean.products}" var="product">
<tr>
<td><a href="/show.jsp?name=${product.name}">${product.name}</a></td>
<td>${product.price}</td>
<td>${product.stock}</td>
<td><a href="/edit.jsp?name=${product.name}">Edit</a><a href="/RemovaProductServlet?name=${product.name}">Remove</a></td>
</tr>
</c:forEach>
e tá dando o seguinte erro:
[code]
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 /products.jsp at line 29
26:
27:
28:
29: <c:forEach items="${productsBean.products}" var=“product”>
30:
31:
32:
Stacktrace:
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:510)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:419)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
root cause
javax.el.ELException: Error reading ‘products’ on type MyCompletWebApp.Control.ProductControl
javax.el.BeanELResolver.getValue(BeanELResolver.java:66)
javax.el.CompositeELResolver.getValue(CompositeELResolver.java:54)
org.apache.el.parser.AstValue.getValue(AstValue.java:123)
org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:186)
org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate(PageContextImpl.java:935)
org.apache.jsp.products_jsp._jspx_meth_c_005fforEach_005f0(products_jsp.java:121)
org.apache.jsp.products_jsp._jspService(products_jsp.java:93)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:377)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
root cause
java.lang.NullPointerException
MyCompletWebApp.Control.ProductControl.getProducts(ProductControl.java:45)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:597)
javax.el.BeanELResolver.getValue(BeanELResolver.java:62)
javax.el.CompositeELResolver.getValue(CompositeELResolver.java:54)
org.apache.el.parser.AstValue.getValue(AstValue.java:123)
org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:186)
org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate(PageContextImpl.java:935)
org.apache.jsp.products_jsp._jspx_meth_c_005fforEach_005f0(products_jsp.java:121)
org.apache.jsp.products_jsp._jspService(products_jsp.java:93)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:377)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
note The full stack trace of the root cause is available in the Apache Tomcat/6.0.28 logs.[/code]
Alguem poderia me dizer como sair disso? já conferi com o do tutorial, e está igual. não sei por que não dá. quem puder ajudar agradeço.
Abço.