正在回答
网页数据不显示?问一下同学是如何不显示,建议同学详细描述一下同学的问题,必要时,可以截图说明。
祝:学习愉快~
三月 26, 2019 9:10:08 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Server version: Apache Tomcat/8.5.37
三月 26, 2019 9:10:08 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Server built: Dec 12 2018 12:07:02 UTC
三月 26, 2019 9:10:08 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Server number: 8.5.37.0
三月 26, 2019 9:10:08 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: OS Name: Windows 10
三月 26, 2019 9:10:08 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: OS Version: 10.0
三月 26, 2019 9:10:08 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Architecture: amd64
三月 26, 2019 9:10:08 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Java Home: C:\Program Files\Java\jdk1.8.0_181\jre
三月 26, 2019 9:10:08 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: JVM Version: 1.8.0_181-b13
三月 26, 2019 9:10:08 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: JVM Vendor: Oracle Corporation
三月 26, 2019 9:10:08 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: CATALINA_BASE: F:\apache-tomcat-8.5.37
三月 26, 2019 9:10:08 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: CATALINA_HOME: F:\apache-tomcat-8.5.37
三月 26, 2019 9:10:08 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -Dcatalina.base=F:\apache-tomcat-8.5.37
三月 26, 2019 9:10:08 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -Dcatalina.home=F:\apache-tomcat-8.5.37
三月 26, 2019 9:10:08 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -Dwtp.deploy=F:\apache-tomcat-8.5.37\webapps
三月 26, 2019 9:10:08 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -Djava.endorsed.dirs=F:\apache-tomcat-8.5.37\endorsed
三月 26, 2019 9:10:08 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -Dfile.encoding=GBK
三月 26, 2019 9:10:08 下午 org.apache.catalina.core.AprLifecycleListener lifecycleEvent
信息: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: [C:\Program Files\Java\jdk1.8.0_181\bin;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:/Program Files/Java/jdk1.8.0_181/bin/../jre/bin/server;C:/Program Files/Java/jdk1.8.0_181/bin/../jre/bin;C:/Program Files/Java/jdk1.8.0_181/bin/../jre/lib/amd64;D:\FileRecv\apache-maven-3.3.9\bin;C:\Program Files\Java\jdk1.8.0_181\bin;C:\Program Files\Java\jdk1.8.0_181\jre\bin;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;D:\JDK\bin;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\;C:\Program Files\Microsoft SQL Server\100\Tools\Binn\;C:\Program Files\Microsoft SQL Server\100\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\VSShell\Common7\IDE\;C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\PrivateAssemblies\;C:\Program Files (x86)\Microsoft SQL Server\100\DTS\Binn\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\system32\wbem;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files\dotnet\;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\130\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\140\Tools\Binn\;C:\Program Files\Microsoft SQL Server\140\Tools\Binn\;C:\Program Files\Microsoft SQL Server\140\DTS\Binn\;;C:\WINDOWS\System32\OpenSSH\;D:\VanDyke Software\Clients\;D:\FileRecv\apache-maven-3.3.9\bin;C:\wamp64\bin\mysql\mysql5.7.24\bin;"C:\Users\lenovo\AppData\Local\Microsoft\WindowsApps;C:\wamp64\bin\mysql\mysql5.7.24\bin";C:\Users\lenovo\AppData\Local\atom\bin;D:\eclipse;;.]
三月 26, 2019 9:10:09 下午 org.apache.coyote.AbstractProtocol init
信息: Initializing ProtocolHandler ["http-nio-8080"]
三月 26, 2019 9:10:09 下午 org.apache.tomcat.util.net.NioSelectorPool getSharedSelector
信息: Using a shared selector for servlet write/read
三月 26, 2019 9:10:09 下午 org.apache.coyote.AbstractProtocol init
信息: Initializing ProtocolHandler ["ajp-nio-8009"]
三月 26, 2019 9:10:09 下午 org.apache.tomcat.util.net.NioSelectorPool getSharedSelector
信息: Using a shared selector for servlet write/read
三月 26, 2019 9:10:09 下午 org.apache.catalina.startup.Catalina load
信息: Initialization processed in 1453 ms
三月 26, 2019 9:10:09 下午 org.apache.catalina.core.StandardService startInternal
信息: Starting service [Catalina]
三月 26, 2019 9:10:09 下午 org.apache.catalina.core.StandardEngine startInternal
信息: Starting Servlet Engine: Apache Tomcat/8.5.37
三月 26, 2019 9:10:11 下午 org.apache.jasper.servlet.TldScanner scanJars
信息: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
容器加载中
三月 26, 2019 9:10:11 下午 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deploying web application directory [F:\apache-tomcat-8.5.37\webapps\docs]
三月 26, 2019 9:10:11 下午 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deployment of web application directory [F:\apache-tomcat-8.5.37\webapps\docs] has finished in [44] ms
三月 26, 2019 9:10:11 下午 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deploying web application directory [F:\apache-tomcat-8.5.37\webapps\examples]
三月 26, 2019 9:10:11 下午 org.apache.catalina.core.ApplicationContext log
信息: ContextListener: contextInitialized()
三月 26, 2019 9:10:11 下午 org.apache.catalina.core.ApplicationContext log
信息: SessionListener: contextInitialized()
三月 26, 2019 9:10:11 下午 org.apache.catalina.core.ApplicationContext log
信息: ContextListener: attributeAdded('StockTicker', 'async.Stockticker@944dee6')
三月 26, 2019 9:10:11 下午 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deployment of web application directory [F:\apache-tomcat-8.5.37\webapps\examples] has finished in [482] ms
三月 26, 2019 9:10:11 下午 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deploying web application directory [F:\apache-tomcat-8.5.37\webapps\host-manager]
三月 26, 2019 9:10:12 下午 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deployment of web application directory [F:\apache-tomcat-8.5.37\webapps\host-manager] has finished in [54] ms
三月 26, 2019 9:10:12 下午 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deploying web application directory [F:\apache-tomcat-8.5.37\webapps\manager]
三月 26, 2019 9:10:12 下午 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deployment of web application directory [F:\apache-tomcat-8.5.37\webapps\manager] has finished in [42] ms
三月 26, 2019 9:10:12 下午 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deploying web application directory [F:\apache-tomcat-8.5.37\webapps\ROOT]
三月 26, 2019 9:10:12 下午 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deployment of web application directory [F:\apache-tomcat-8.5.37\webapps\ROOT] has finished in [38] ms
三月 26, 2019 9:10:12 下午 org.apache.coyote.AbstractProtocol start
信息: Starting ProtocolHandler ["http-nio-8080"]
三月 26, 2019 9:10:12 下午 org.apache.coyote.AbstractProtocol start
信息: Starting ProtocolHandler ["ajp-nio-8009"]
三月 26, 2019 9:10:12 下午 org.apache.catalina.startup.Catalina start
信息: Server startup in 2395 ms
index.jsp
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>慕课网用户管理中心</title>
<link rel="stylesheet" href="lib/bootstrap-3.3.7-dist/css/bootstrap.min.css">
<script src="lib/2.2.4/jquery-1.12.4.min.js"></script>
<script src="lib/bootstrap-3.3.7-dist/js/bootstrap.min.js"></script>
</head>
<body>
<div class="container">
<div class="row">
<div class="page-header">
<h1>慕课网后台管理系统 <small>用户数据管理中心</small></h1>
</div>
</div>
<div class="row">
<div class="jumbotron">
<h1>MyBatis基础入门课程!</h1>
<p>通过一个项目来完成基础部分的学习</p>
<p><a class="btn btn-primary btn-lg" href="#" role="button">查看更多,请上慕课网</a></p>
<p><a class="btn btn-primary btn-lg" href="${pageContext.request.contextPath}/addusers.jsp" role="button">新增用户</a></p>
</div>
</div>
<div class="row">
<table class="table table-hover table-striped">
<tr>
<th>用户编号</th>
<th>登录账号</th>
<th>用户昵称</th>
<th>邮箱</th>
<th>联系方式</th>
<th>账号创建时间</th>
<th>用户状态</th>
<th>操作</th>
</tr>
<c:forEach var="user" items="${usersList}">
<tr>
<td>${user.id}</td>
<td>${user.username}</td>
<td>${user.nickname}</td>
<td>${user.email}</td>
<td>${user.phone}</td>
<td>${user.createTime}</td>
<c:if test="${user.userStatus==0 }">
<td>正常</td>
</c:if>
<c:if test="${user.userStatus==1 }">
<td>锁定</td>
</c:if>
<c:if test="${user.userStatus==2 }">
<td>删除</td>
</c:if>
<td>
<a href="">查看 </a>
<a href="">修改 </a>
<a href="">删除 </a>
</td>
</tr>
</c:forEach>
</table>
</div>
</div>
</body>
</html>
mybatis-config.xml
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE configuration
PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-config.dtd">
<configuration>
<!--
properties配置
-->
<properties resource="db.properties"></properties>
<!--
environments用于数据源配置
-->
<environments default="development">
<!--
environment配置一个具体的独立数据源
-->
<environment id="development">
<!--
transactionManager用于配置事务管理
-->
<transactionManager type="JDBC"/>
<!--
dataSource具体数据源的连接信息(连接池相关)
-->
<dataSource type="POOLED">
<property name="driver" value="com.mysql.cj.jdbc.Driver"/>
<property name="url" value="jdbc:mysql://localhost:3306/mytest?useUnicode=true&serverTimezone = GMT"/>
<property name="username" value="root"/>
<property name="password" value="9527"/>
</dataSource>
</environment>
<environment id="product">
<transactionManager type="JDBC"/>
<dataSource type="POOLED">
<property name="driver" value="${driver}"/>
<property name="url" value="${url}"/>
<property name="username" value="${username}"/>
<property name="password" value="${password}"/>
</dataSource>
</environment>
<environment id="test">
<transactionManager type="JDBC"/>
<dataSource type="POOLED">
<property name="driver" value="${driver}"/>
<property name="url" value="${url}"/>
<property name="username" value="${username}"/>
<property name="password" value="${password}"/>
</dataSource>
</environment>
</environments>
<!--
mappers外部的映射配置文件
-->
<mappers>
<!--
mapper引入具体配置文件(resource路径方式引入)
-->
<mapper resource="mapper/usersMapper.xml"/>
</mappers>
</configuration>
usersMapper.xml
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<!--
mapper定义一个映射配置文件根节点
namespace用于配置当前的命名空间,主要用于进行session级别的缓存管理,默认使用当前操作的实体类的全路径
-->
<mapper namespace="com.damu.entity.Users">
<select id="findAll" resultType="com.damu.entity.Users">
select * from users
</select>
</mapper>
UsersDao.java
package com.damu.dao;
import com.damu.entity.Users;
import com.damu.utils.SqlSessionFactoryUtils;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import java.util.List;
public class UsersDao {
private SqlSession sqlSession =SqlSessionFactoryUtils.getSqlSessionFactory().openSession();
private List<Users>list;
public List<Users>findAll(){
try {
list=sqlSession.selectList("findAll");
}
catch(Exception e) {
e.printStackTrace();
}finally{
sqlSession.close();
}
return list;
}
}
- 参与学习 人
- 提交作业 277 份
- 解答问题 4297 个
Java数据库开发的必备技能,从流行的MySQL数据库开始,到Java原生的数据库管理接口JDBC的使用,再到常用的数据持久化框架MyBatis,让你向Java工程师的目标又迈进了一步!
了解课程
恭喜解决一个难题,获得1积分~
来为老师/同学的回答评分吧
0 星