weixin_45992860 2021-05-21 17:55 采纳率: 80%
浏览 51
已结题

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>

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

  • 写回答

1条回答 默认 最新

  • 关注

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

    评论

报告相同问题?

悬赏问题

  • ¥15 鼠标右键,撤销删除 复制 移动,要怎样删除
  • ¥15 使用MATLAB进行余弦相似度计算加速
  • ¥15 服务器安装php5.6版本
  • ¥15 我想用51单片机和数码管做一个从0开始的计数表 我写了一串代码 但是放到单片机里面数码管只闪烁一下然后熄灭
  • ¥20 系统工程中,状态空间模型中状态方程的应用。请猛男来完整讲一下下面所有问题
  • ¥15 我想在WPF的Model Code中获取ViewModel Code中的一个参数
  • ¥15 arcgis处理土地利用道路 建筑 林地分类
  • ¥20 使用visual studio 工具用C++语音,调用openslsx库读取excel文件的sheet问题
  • ¥100 寻会做云闪付tn转h5支付链接的技术
  • ¥15 DockerSwarm跨节点无法访问问题