HTTP Status 500 - --------------------------------------------------------------------------------type Exception reportmessage description The server encountered an internal error () that prevented it from fulfilling this request.exception org.apache.jasper.JasperException
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:372)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
Bean.EncodingFilter.doFilter(EncodingFilter.java:23)
root cause java.lang.NullPointerException
org.apache.jsp.showProduct_jsp._jspService(showProduct_jsp.java:83)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
Bean.EncodingFilter.doFilter(EncodingFilter.java:23)
note The full stack trace of the root cause is available in the Apache Tomcat/5.0.28 logs.
--------------------------------------------------------------------------------

解决方案 »

  1.   

    <%@ page language="java" import="java.util.*,com.Wease.struts.form.*"
    pageEncoding="gbk"%>
    <%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%>
    <%@ taglib uri="http://struts.apache.org/tags-html" prefix="html"%>
    <%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic"%>
    <%@ taglib uri="http://struts.apache.org/tags-tiles" prefix="tiles"%>
    <%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://"
    + request.getServerName() + ":" + request.getServerPort()
    + path + "/";
    ArrayList proList = (ArrayList) request.getAttribute("proList");
    %><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    <head>
    <base href="<%=basePath%>"> <title>产品信息</title> <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="This is my page">
    <!--
    <link rel="stylesheet" type="text/css" href="styles.css">
    --> </head>
    <body>
    <form action="">
    <table> <%
    for (int i = 0; i < proList.size(); i++) {
    AddProductForm product = (AddProductForm) proList.get(i);
    %>
    <tr>
    <td>
    产品名称:<%=product.getProductName()%><br>
    </td>
    </tr>
    <tr>
    <td>
    产品描述:<%=product.getProductInco()%><br>
    </td>
    </tr>
    <tr>
    <td>
    产品图片:
    <img width="150px" height="100px"
    src="<%=basePath%>productImg/<%=product.getProductImg()%>" />
    <br>
    </td>
    </tr>
    <%
    }
    %>
    </table>
    </form>
    </body>
    </html>
      

  2.   

    request.setAttribute("proList",你要保存的值);
    并且你要保存的值不为null
    这些是不是都有了啊?
      

  3.   

      action 里面这样写的:
    ProductDAO proDao = new ProductDAO();
    List proList = proDao.getPoductInfo();
    request.setAttribute("proList", proList);
    return mapping.findForward("show");
     DAO方法:
    public List getPoductInfo() {
    Connection con = getCon();
    ArrayList proList = new ArrayList();
    try {
    Statement st = con.createStatement();
    ResultSet rs = st
    .executeQuery("select productName,productInfo,productImg,ProductFunction,ProductGood,ProductParameter from product");
    while (rs.next()) {
    AddProductForm product = new AddProductForm();
    product.setProductName(rs.getString(1));
    product.setProductInco(rs.getString(2));
    product.setProductImg(rs.getString(3));
    product.setProductFunction(rs.getString(4));
    product.setProductGood(rs.getString(5));
    product.setProductParameter(rs.getString(6));
    proList.add(product);
    }
    } catch (SQLException e) {
    e.printStackTrace();
    } finally {
    closeConnection(con);
    }
    return proList;
    }
      

  4.   

     action : ProductDAO proDao = new ProductDAO();
    List proList = proDao.getPoductInfo();
    request.setAttribute("proList", proList);
    return mapping.findForward("show");DAO :public List getPoductInfo() {
    Connection con = getCon();
    ArrayList proList = new ArrayList();
    try {
    Statement st = con.createStatement();
    ResultSet rs = st
    .executeQuery("select productName,productInfo,productImg,ProductFunction,ProductGood,ProductParameter from product");
    while (rs.next()) {
    AddProductForm product = new AddProductForm();
    product.setProductName(rs.getString(1));
    product.setProductInco(rs.getString(2));
    product.setProductImg(rs.getString(3));
    product.setProductFunction(rs.getString(4));
    product.setProductGood(rs.getString(5));
    product.setProductParameter(rs.getString(6));
    proList.add(product);
    }
    } catch (SQLException e) {
    e.printStackTrace();
    } finally {
    closeConnection(con);
    }
    return proList;
    }JSP: 
    <%@ page language="java" import="java.util.*,com.Wease.struts.form.*"
    pageEncoding="gbk"%>
    <%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%>
    <%@ taglib uri="http://struts.apache.org/tags-html" prefix="html"%>
    <%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic"%>
    <%@ taglib uri="http://struts.apache.org/tags-tiles" prefix="tiles"%>
    <%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://"
    + request.getServerName() + ":" + request.getServerPort()
    + path + "/";
    ArrayList proList = (ArrayList) request.getAttribute("proList");
    %><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    <head>
    <base href="<%=basePath%>"> <title>产品信息</title> <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="This is my page">
    <!--
    <link rel="stylesheet" type="text/css" href="styles.css">
    --> </head>
    <body>
    <form action="">
    <table> <%
    for (int i = 0; i < proList.size(); i++) {
    AddProductForm product = (AddProductForm) proList.get(i);
    %>
    <tr>
    <td>
    产品名称:<%=product.getProductName()%><br>
    </td>
    </tr>
    <tr>
    <td>
    产品描述:<%=product.getProductInco()%><br>
    </td>
    </tr>
    <tr>
    <td>
    产品图片:
    <img width="150px" height="100px"
    src="<%=basePath%>productImg/<%=product.getProductImg()%>" />
    <br>
    </td>
    </tr>
    <%
    }
    %>
    </table>
    </form>
    </body>
    </html>
    数据库有数据
      

  5.   

    action里面加个断点,看下proList是不是空的吧,nullpointException都是有数据空导致的
      

  6.   

    看看proList是否已经实例化.LZ可是在代码中用后台输出语句System.out.println(" ***** ");进行分析,看看到底那里是NULL