JasperException

 

Show.jsp

<%@ page import="java.sql.Connection" %>
<%@ page import="com.sys.util.DBConnectionPool" %>
<%@ page import="java.sql.PreparedStatement" %>
<%@ page import="java.sql.ResultSet" %>
<%@ page import="com.sys.entity.User" %><%--
  Created by IntelliJ IDEA.
  User: liruyuan
  Date: 2021/5/20
  Time: 21:55
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/css/CShow.css" />
</head>
<body>
<%
    Connection conn = DBConnectionPool.getInstance().getConn();
    PreparedStatement ps;
    ResultSet rs;
    User user= (User) session.getAttribute("user");
    ps = conn.prepareStatement("select * from login where username=?");
    ps.setString(1,user.getUsername());
    rs = ps.executeQuery();
    if(rs.next()){
        user = new User();
        user.setUsername(rs.getString("username"));
        user.setPassword(rs.getString("password"));
        user.setSchool(rs.getString("school"));
        user.setRole(rs.getString("role"));
        user.setName(rs.getString("name"));

    }
%>
    <div id="divmain">
        <div id="divform">
            <form>
                <div id="div1">
                    <div id="circle"></div>
                    <input type="button"  class="button" value="修改头像"/>
                </div>
                <div id="div2">
                    <table>
                        <tr>
                            <th class="th1"><span>姓名</span></th>
                            <th class="th2"><%=user.getName() %></th>
                        </tr>
                        <tr>
                            <th class="th1"><span>用户名</span></th>
                            <th class="th2"><%=user.getUsername() %></th>
                        </tr>
                        <tr>
                            <th class="th1"><span>工作单位</span></th>
                            <th class="th2"><%=user.getSchool() %></th>
                        </tr>
                        <tr>
                            <th class="th1"><span>角色</span></th>
                            <th class="th2"><%=user.getRole() %></th>
                        </tr>
                    </table>
                </div>
            </form>
        </div>
    </div>
</body>
</html>

 

每次删除完浏览器的历史记录,就出现这个问题,然后刷新一下就没事了,怎么解决

应该是数据库连接失败了,先打印conn出来看看。