会员可以在此提问,百战程序员老师有问必答
对大家有帮助的问答会被标记为“推荐”
看完课程过来浏览一下别人提的问题,会帮你学得更全面
截止目前,同学们一共提了 132463个问题

老师我点击查询后跳转一个空白页面没有任何结果显示,数据库字段是对应的

viewUser.jsp页面代码
<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2022/2/13
  Time: 18:36
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>无标题文档</title>
    <link href="css/style.css" rel="stylesheet" type="text/css" />

</head>


<body>

<div class="place">
    <span>位置:</span>
    <ul class="placeul">
        <li><a href="#">用户管理</a></li>
        <li><a href="#">查询用户</a></li>
        <li><a href="#">查询结果</a></li>
    </ul>
</div>

<div class="rightinfo">


    <div class="formtitle1"><span>用户列表</span></div>

    <table class="tablelist" >
        <thead>
        <tr>
            <th>序号</th>
            <th>用户名</th>
            <th>用户性别</th>
            <th>手机号</th>
            <th>QQ号</th>
            <th>操作</th>
        </tr>
        </thead>

        <tbody>
        <c:forEach items="${list}" var="user" varStatus="status">
        <tr>
            <td>${status.count}</td>
            <td>${user.username}</td>
            <td>
                <c:choose>
                    <c:when test="${user.usersex == 1}">
                        男
                    </c:when>
                    <c:otherwise>
                        女
                    </c:otherwise>
                </c:choose>
            </td>
            <td>${user.phonenumber}</td>
            <td>${user.qqnumber}</td>
            <td><a href="userUpdate.html" class="tablelink">修改</a> &nbsp;&nbsp;&nbsp;&nbsp;  <a href="#" class="tablelink click"> 删除</a></td>
        </tr>
        </c:forEach>
        </tbody>
    </table>



    <div class="tip">
        <div class="tiptop"><span>提示信息</span><a></a></div>

        <div class="tipinfo">
            <span><img src="images/ticon.png" /></span>
            <div class="tipright">
                <p>是否确认对信息的修改 ?</p>
                <cite>如果是请点击确定按钮 ,否则请点取消。</cite>
            </div>
        </div>

        <div class="tipbtn">
            <input name="" type="button"  class="sure" value="确定" />&nbsp;
            <input name="" type="button"  class="cancel" value="取消" />
        </div>

    </div>
</div>
</body>
</html>

image.png

JAVA 全系列/第五阶段:JavaWeb开发/Web实战案例 12647楼

由逆向工程中的class类导入实现类显示有一个导包找不到,而在原来的项目也就是上一节中也有此包,但是没有错误提示,请老师帮我解答一下

2020-04-09_12-25-03.png2020-04-09_12-26-37.png无标题.png

ego.rar

mybatisGenerator.rar

mybatisGenerator中没有错误提示

ego中的service.impl中的cn.cxs.ego.rpc.mapper中的class类是从上面的项目中直接复制过来的,报名已经改过,只有一个ibatis包显示找不到



JAVA 全系列/(旧的隐藏)第八阶段:电商高级项目_架构/编码/电商ego-基于SOA架构_Dubbo使用_逆向工程_分页插件完成商品查询 12648楼
JAVA 全系列/第二阶段:JAVA 基础深化和提高/IO 流技术(旧) 12650楼
Python 全系列/第二阶段:Python 深入与提高/GUI编程(隐藏) 12651楼
Python 全系列/第二十三阶段:人工智能基础_机器学习理论和实战(旧)/SVM支持向量机算法 12652楼

老师我这个导包应该没问题吧,但还是无法初始化类,请老师指点

报错信息image.png

源码:

package jdbcDemo2;


import java.sql.Connection;

import java.sql.ResultSet;

import java.sql.SQLException;

import java.sql.Statement;


public class TestJdbc {

public void InsertDepartments(String department_name , int location_id){

Connection conn=null;

Statement state=null;

ResultSet rs=null;

try{

conn=JdbcUtilPro.getConnection();

String sql="insert into departments values(default,department_name'"+department_name+"',location_id'"+location_id+"')";

state=conn.createStatement();

int flat=state.executeUpdate(sql);

System.out.println(flat);

}catch(SQLException e){

e.printStackTrace();

}finally{

JdbcUtilPro.closeResource(state, conn,null);

}

}

public static void main(String[] args){

TestJdbc test=new TestJdbc();

test.InsertDepartments("aaa", 22);

}

}



jdbc.properties如下

image.png



package jdbcDemo2;


import java.sql.Connection;

import java.sql.DriverManager;

import java.sql.ResultSet;

import java.sql.SQLException;

import java.sql.Statement;

import java.util.ResourceBundle;



public class JdbcUtilPro {

//抽取常量串

private static String driver;

private static String url;

private static String username;

private static String password;

static{

ResourceBundle bundle=ResourceBundle.getBundle("jdbc");

driver=bundle.getString(driver);

url=bundle.getString(url);

username=bundle.getString(username);

password=bundle.getString(password);

try {

//注册驱动

Class.forName(driver);

} catch (Exception e) {

// TODO Auto-generated catch block

e.printStackTrace();

}

}

//获取Connection对象

public static Connection getConnection(){

Connection conn=null;

try{

//建立连接

conn=DriverManager.getConnection(url, username, password);

}catch(SQLException e){

e.printStackTrace();

}

return conn;

}

//关闭Statement对象

public static void closeStatement(Statement state){

try{

if(state!=null){

state.close();

}

}catch(SQLException e){

e.printStackTrace();

}

}

//关闭Connection对象

public static void closeConnection(Connection conn){

try{

if(conn!=null){

conn.close();

}

}catch(Exception e){

e.printStackTrace();

}

}

//关闭ResultSet对象

public static void closeResultSet(ResultSet rs){

try{

if(rs!=null){

rs.close();

}

}catch(Exception e){

e.printStackTrace();

}

}

//关闭资源

public static void closeResource(Statement state,Connection conn,ResultSet rs){

closeStatement(state);

closeConnection(conn);

closeResultSet(rs);

}

}


JAVA 全系列/第三阶段:数据库编程/JDBC技术(旧) 12653楼
Python 全系列/第四阶段:函数式编程和核心特性/生成器和装饰器 12657楼
Python 全系列/第二阶段:Python 深入与提高/模块 12658楼

课程分类

百战程序员微信公众号

百战程序员微信小程序

©2014-2025百战汇智(北京)科技有限公司 All Rights Reserved 北京亦庄经济开发区科创十四街 赛蒂国际工业园
网站维护:百战汇智(北京)科技有限公司
京公网安备 11011402011233号    京ICP备18060230号-3    营业执照    经营许可证:京B2-20212637