ssm框架下,怎么将从数据库查询到的数据显示在table表格中?

ssm框架下,怎么将从数据库查询到的数据显示在table表格中??

3个回答

后台用List<实体类>list=....................; 就是查询数据,然后传送前台,用HttpServletRequest request, request.setAttribute("list", list);
前台用el表达式获取,然后用 ${list}

`
<c:foreach></c:foreach>循环赋值 具体可以百度




或者

/c:forEach
附注:
不论是对整数还是对集合进行迭代, 的varStatus属性所起的作用相同。和var属性一样,varStatus用于创建限定了作用域的变量(改变量只在当前标签体内起作用)。不过,由varStatus属性命名的变量并不存储当前索引值或当前元素,而是赋予javax.servlet.jsp.jstl.core.LoopTagStatus类的实例。

${后台传的名字},如果是list集合的话需要遍历------善知软件实训基地

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
Python+OpenCV计算机视觉

Python+OpenCV计算机视觉

ssm框架,无法访问数据库Could not get JDBC Connection

用的德鲁伊连接池,先看applicationContext-dao.xml里的配置 ``` <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:context="http://www.springframework.org/schema/context" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.2.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.2.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.2.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.2.xsd "> <context:property-placeholder location="classpath:properties/*.properties" /> <bean id="dataSource" class="com.alibaba.druid.pool.DruidDataSource" destroy-method="close"> <property name="url" value="${jdbc.url}" /> <property name="username" value="${jdbc.username}" /> <property name="password" value="${jdbc.password}" /> <property name="driverClassName" value="${jdbc.driver}" /> <property name="maxActive" value="10" /> <property name="minIdle" value="5" /> <!-- <property name="maxWait" value="5000" /> --> </bean> <bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean"> <property name="dataSource" ref="dataSource" /> <property name="configLocation" value="classpath:mybatis/SqlMapConfig.xml" /> </bean> <bean class="org.mybatis.spring.mapper.MapperScannerConfigurer"> <property name="basePackage" value="com.demo.mapper" /> </bean> </beans> ``` 这样的话,控制台输出: 2017-12-28 12:43:58,209DEBUG[org.springframework.web.servlet.DispatcherServlet] - <DispatcherServlet with name 'case' processing GET request for [/case/test]> 2017-12-28 12:43:58,214DEBUG[org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping] - <Looking up handler method for path /test> 2017-12-28 12:43:58,221DEBUG[org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping] - <Returning handler method [public com.demo.pojo.TbItem com.demo.controller.TestController.getItem(java.lang.Long)]> 2017-12-28 12:43:58,221DEBUG[org.springframework.beans.factory.support.DefaultListableBeanFactory] - <Returning cached instance of singleton bean 'testController'> 2017-12-28 12:43:58,222DEBUG[org.springframework.web.servlet.DispatcherServlet] - <Last-Modified value for [/case/test] is: -1> 2017-12-28 12:43:58,317DEBUG[org.mybatis.spring.SqlSessionUtils] - <Creating a new SqlSession> 2017-12-28 12:43:58,335DEBUG[org.mybatis.spring.SqlSessionUtils] - <Registering transaction synchronization for SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@727efb8d]> 2017-12-28 12:43:58,366DEBUG[org.springframework.jdbc.datasource.DataSourceUtils] - <Fetching JDBC Connection from DataSource> 2017-12-28 12:43:58,447INFO[com.alibaba.druid.pool.DruidDataSource] - <{dataSource-1} inited> 一直显示等待,后来加了个maxWait属性,时间是5秒,然后才开始报错,如下: 2017-12-28 12:47:41,261DEBUG[org.springframework.web.servlet.DispatcherServlet] - <DispatcherServlet with name 'case' processing GET request for [/case/test]> 2017-12-28 12:47:41,264DEBUG[org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping] - <Looking up handler method for path /test> 2017-12-28 12:47:41,269DEBUG[org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping] - <Returning handler method [public com.demo.pojo.TbItem com.demo.controller.TestController.getItem(java.lang.Long)]> 2017-12-28 12:47:41,269DEBUG[org.springframework.beans.factory.support.DefaultListableBeanFactory] - <Returning cached instance of singleton bean 'testController'> 2017-12-28 12:47:41,270DEBUG[org.springframework.web.servlet.DispatcherServlet] - <Last-Modified value for [/case/test] is: -1> 2017-12-28 12:47:41,338DEBUG[org.mybatis.spring.SqlSessionUtils] - <Creating a new SqlSession> 2017-12-28 12:47:41,348DEBUG[org.mybatis.spring.SqlSessionUtils] - <Registering transaction synchronization for SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@3a67d807]> 2017-12-28 12:47:41,378DEBUG[org.springframework.jdbc.datasource.DataSourceUtils] - <Fetching JDBC Connection from DataSource> 2017-12-28 12:47:41,472INFO[com.alibaba.druid.pool.DruidDataSource] - <{dataSource-1} inited> 2017-12-28 12:47:46,473WARN[com.alibaba.druid.pool.DruidDataSource] - <not full timeout retry : 1> 2017-12-28 12:47:51,476DEBUG[org.mybatis.spring.SqlSessionUtils] - <Releasing transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@3a67d807]> 2017-12-28 12:47:51,476DEBUG[org.mybatis.spring.SqlSessionUtils] - <Transaction synchronization deregistering SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@3a67d807]> 2017-12-28 12:47:51,476DEBUG[org.mybatis.spring.SqlSessionUtils] - <Transaction synchronization closing SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@3a67d807]> 2017-12-28 12:47:51,476DEBUG[org.springframework.jdbc.datasource.DataSourceTransactionManager] - <Should roll back transaction but cannot - no transaction available> 2017-12-28 12:47:51,478DEBUG[org.springframework.web.servlet.mvc.method.annotation.ExceptionHandlerExceptionResolver] - <Resolving exception from handler [public com.demo.pojo.TbItem com.demo.controller.TestController.getItem(java.lang.Long)]: org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.PersistenceException: ### Error querying database. Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is com.alibaba.druid.pool.GetConnectionTimeoutException: wait millis 5000, active 0 ### The error may exist in com/demo/mapper/TbItemMapper.xml ### The error may involve com.demo.mapper.TbItemMapper.selectByPrimaryKey ### The error occurred while executing a query 无法连接到数据库。。。。错误显示可能在/TbItemMapper.xml,这是mybatis逆向生成的,在其他项目中测试可用,所以问题应该不在这,其他配置文件啥的也感觉没问题,但就是连接不到数据库,问题出在哪??? TbItemMapper.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="com.demo.mapper.TbItemMapper"> <resultMap id="BaseResultMap" type="com.demo.pojo.TbItem"> <id column="id" jdbcType="BIGINT" property="id" /> <result column="title" jdbcType="VARCHAR" property="title" /> <result column="sell_point" jdbcType="VARCHAR" property="sellPoint" /> <result column="price" jdbcType="BIGINT" property="price" /> <result column="num" jdbcType="INTEGER" property="num" /> <result column="barcode" jdbcType="VARCHAR" property="barcode" /> <result column="image" jdbcType="VARCHAR" property="image" /> <result column="cid" jdbcType="BIGINT" property="cid" /> <result column="status" jdbcType="TINYINT" property="status" /> <result column="created" jdbcType="TIMESTAMP" property="created" /> <result column="updated" jdbcType="TIMESTAMP" property="updated" /> </resultMap> <sql id="Example_Where_Clause"> <where> <foreach collection="oredCriteria" item="criteria" separator="or"> <if test="criteria.valid"> <trim prefix="(" prefixOverrides="and" suffix=")"> <foreach collection="criteria.criteria" item="criterion"> <choose> <when test="criterion.noValue"> and ${criterion.condition} </when> <when test="criterion.singleValue"> and ${criterion.condition} #{criterion.value} </when> <when test="criterion.betweenValue"> and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} </when> <when test="criterion.listValue"> and ${criterion.condition} <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=","> #{listItem} </foreach> </when> </choose> </foreach> </trim> </if> </foreach> </where> </sql> <sql id="Update_By_Example_Where_Clause"> <where> <foreach collection="example.oredCriteria" item="criteria" separator="or"> <if test="criteria.valid"> <trim prefix="(" prefixOverrides="and" suffix=")"> <foreach collection="criteria.criteria" item="criterion"> <choose> <when test="criterion.noValue"> and ${criterion.condition} </when> <when test="criterion.singleValue"> and ${criterion.condition} #{criterion.value} </when> <when test="criterion.betweenValue"> and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} </when> <when test="criterion.listValue"> and ${criterion.condition} <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=","> #{listItem} </foreach> </when> </choose> </foreach> </trim> </if> </foreach> </where> </sql> <sql id="Base_Column_List"> id, title, sell_point, price, num, barcode, image, cid, status, created, updated </sql> <select id="selectByExample" parameterType="com.demo.pojo.TbItemExample" resultMap="BaseResultMap"> select <if test="distinct"> distinct </if> <include refid="Base_Column_List" /> from tb_item <if test="_parameter != null"> <include refid="Example_Where_Clause" /> </if> <if test="orderByClause != null"> order by ${orderByClause} </if> </select> <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap"> select <include refid="Base_Column_List" /> from tb_item where id = #{id,jdbcType=BIGINT} </select> <delete id="deleteByPrimaryKey" parameterType="java.lang.Long"> delete from tb_item where id = #{id,jdbcType=BIGINT} </delete> <delete id="deleteByExample" parameterType="com.demo.pojo.TbItemExample"> delete from tb_item <if test="_parameter != null"> <include refid="Example_Where_Clause" /> </if> </delete> <insert id="insert" parameterType="com.demo.pojo.TbItem"> insert into tb_item (id, title, sell_point, price, num, barcode, image, cid, status, created, updated) values (#{id,jdbcType=BIGINT}, #{title,jdbcType=VARCHAR}, #{sellPoint,jdbcType=VARCHAR}, #{price,jdbcType=BIGINT}, #{num,jdbcType=INTEGER}, #{barcode,jdbcType=VARCHAR}, #{image,jdbcType=VARCHAR}, #{cid,jdbcType=BIGINT}, #{status,jdbcType=TINYINT}, #{created,jdbcType=TIMESTAMP}, #{updated,jdbcType=TIMESTAMP}) </insert> <insert id="insertSelective" parameterType="com.demo.pojo.TbItem"> insert into tb_item <trim prefix="(" suffix=")" suffixOverrides=","> <if test="id != null"> id, </if> <if test="title != null"> title, </if> <if test="sellPoint != null"> sell_point, </if> <if test="price != null"> price, </if> <if test="num != null"> num, </if> <if test="barcode != null"> barcode, </if> <if test="image != null"> image, </if> <if test="cid != null"> cid, </if> <if test="status != null"> status, </if> <if test="created != null"> created, </if> <if test="updated != null"> updated, </if> </trim> <trim prefix="values (" suffix=")" suffixOverrides=","> <if test="id != null"> #{id,jdbcType=BIGINT}, </if> <if test="title != null"> #{title,jdbcType=VARCHAR}, </if> <if test="sellPoint != null"> #{sellPoint,jdbcType=VARCHAR}, </if> <if test="price != null"> #{price,jdbcType=BIGINT}, </if> <if test="num != null"> #{num,jdbcType=INTEGER}, </if> <if test="barcode != null"> #{barcode,jdbcType=VARCHAR}, </if> <if test="image != null"> #{image,jdbcType=VARCHAR}, </if> <if test="cid != null"> #{cid,jdbcType=BIGINT}, </if> <if test="status != null"> #{status,jdbcType=TINYINT}, </if> <if test="created != null"> #{created,jdbcType=TIMESTAMP}, </if> <if test="updated != null"> #{updated,jdbcType=TIMESTAMP}, </if> </trim> </insert> <select id="countByExample" parameterType="com.demo.pojo.TbItemExample" resultType="java.lang.Long"> select count(*) from tb_item <if test="_parameter != null"> <include refid="Example_Where_Clause" /> </if> </select> <update id="updateByExampleSelective" parameterType="map"> update tb_item <set> <if test="record.id != null"> id = #{record.id,jdbcType=BIGINT}, </if> <if test="record.title != null"> title = #{record.title,jdbcType=VARCHAR}, </if> <if test="record.sellPoint != null"> sell_point = #{record.sellPoint,jdbcType=VARCHAR}, </if> <if test="record.price != null"> price = #{record.price,jdbcType=BIGINT}, </if> <if test="record.num != null"> num = #{record.num,jdbcType=INTEGER}, </if> <if test="record.barcode != null"> barcode = #{record.barcode,jdbcType=VARCHAR}, </if> <if test="record.image != null"> image = #{record.image,jdbcType=VARCHAR}, </if> <if test="record.cid != null"> cid = #{record.cid,jdbcType=BIGINT}, </if> <if test="record.status != null"> status = #{record.status,jdbcType=TINYINT}, </if> <if test="record.created != null"> created = #{record.created,jdbcType=TIMESTAMP}, </if> <if test="record.updated != null"> updated = #{record.updated,jdbcType=TIMESTAMP}, </if> </set> <if test="_parameter != null"> <include refid="Update_By_Example_Where_Clause" /> </if> </update> <update id="updateByExample" parameterType="map"> update tb_item set id = #{record.id,jdbcType=BIGINT}, title = #{record.title,jdbcType=VARCHAR}, sell_point = #{record.sellPoint,jdbcType=VARCHAR}, price = #{record.price,jdbcType=BIGINT}, num = #{record.num,jdbcType=INTEGER}, barcode = #{record.barcode,jdbcType=VARCHAR}, image = #{record.image,jdbcType=VARCHAR}, cid = #{record.cid,jdbcType=BIGINT}, status = #{record.status,jdbcType=TINYINT}, created = #{record.created,jdbcType=TIMESTAMP}, updated = #{record.updated,jdbcType=TIMESTAMP} <if test="_parameter != null"> <include refid="Update_By_Example_Where_Clause" /> </if> </update> <update id="updateByPrimaryKeySelective" parameterType="com.demo.pojo.TbItem"> update tb_item <set> <if test="title != null"> title = #{title,jdbcType=VARCHAR}, </if> <if test="sellPoint != null"> sell_point = #{sellPoint,jdbcType=VARCHAR}, </if> <if test="price != null"> price = #{price,jdbcType=BIGINT}, </if> <if test="num != null"> num = #{num,jdbcType=INTEGER}, </if> <if test="barcode != null"> barcode = #{barcode,jdbcType=VARCHAR}, </if> <if test="image != null"> image = #{image,jdbcType=VARCHAR}, </if> <if test="cid != null"> cid = #{cid,jdbcType=BIGINT}, </if> <if test="status != null"> status = #{status,jdbcType=TINYINT}, </if> <if test="created != null"> created = #{created,jdbcType=TIMESTAMP}, </if> <if test="updated != null"> updated = #{updated,jdbcType=TIMESTAMP}, </if> </set> where id = #{id,jdbcType=BIGINT} </update> <update id="updateByPrimaryKey" parameterType="com.demo.pojo.TbItem"> update tb_item set title = #{title,jdbcType=VARCHAR}, sell_point = #{sellPoint,jdbcType=VARCHAR}, price = #{price,jdbcType=BIGINT}, num = #{num,jdbcType=INTEGER}, barcode = #{barcode,jdbcType=VARCHAR}, image = #{image,jdbcType=VARCHAR}, cid = #{cid,jdbcType=BIGINT}, status = #{status,jdbcType=TINYINT}, created = #{created,jdbcType=TIMESTAMP}, updated = #{updated,jdbcType=TIMESTAMP} where id = #{id,jdbcType=BIGINT} </update> </mapper> ``` 上面是逆向工程的mapper,后来我自己写了个TestMapper,还是出现同样的问题: ![图片说明](https://img-ask.csdn.net/upload/201712/28/1514454719_724728.png) 另外navicat访问数据库没问题。我想会不会是连接池配置的问题,也许那些配置可能导致这种情况??

怎么把数据库内容显示在网页table上?已有JAVA后台代码。求大佬帮忙

package com.lixing.tool; import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.SQLException; public class JDBC { private static String user="root"; private static String pwd="root"; private static String url="jdbc:mysql://127.0.0.1:3306/vido"; private static String driver="com.mysql.jdbc.Driver"; //��ȡ���ݿ����ӷ��� public static Connection getConnection() throws ClassNotFoundException, SQLException{ Class.forName(driver); return DriverManager.getConnection(url, user, pwd); } } package com.lixing.controller; import java.io.File; import java.io.IOException; import java.util.UUID; import javax.accessibility.AccessibleRelation; import javax.xml.ws.Response; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.multipart.MultipartFile; import com.lixing.dao.GameInfoDao; import com.lixing.dao.UserInfoDao; import com.lixing.pojo.PageData; import com.lixing.pojo.UserInfo; @Controller public class UserInfoController { //......................................中间省略部分是数据上传功能 @RequestMapping("/queryGameInfoList.do") public @ResponseBody PageData findGameInfo(int page,int limit){ System.out.println("==============="+page); System.out.println("==============="+limit); //��ѯ�û���Ϣ�����ݴ��������������������з�ҳ GameInfoDao dao=new GameInfoDao(); return dao.findGameInfo(page, limit); } @RequestMapping("deleGameInfo.do") public @ResponseBody int deleteGameInfo(int id){ System.out.println("ɾ���û��ķ���======"+id); GameInfoDao dao=new GameInfoDao(); return dao.deleGameInfoById(id); } } package com.lixing.pojo; public class PageData { private String code; private String msg; private int count; private Object data; public String getCode() { return code; } public void setCode(String code) { this.code = code; } public String getMsg() { return msg; } public void setMsg(String msg) { this.msg = msg; } public int getCount() { return count; } public void setCount(int count) { this.count = count; } public Object getData() { return data; } public void setData(Object data) { this.data = data; } } package com.lixing.pojo; public class GameInfo { private int id; private String game; private String type; public int getid() { return id; } public void setid(int id) { this.id = id; } public String getgame() { return game; } public void setgame(String game) { this.game = game; } public String gettype() { return type; } public void settype(String type) { this.type = type; } } package com.lixing.dao; import java.sql.Connection; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.util.ArrayList; import java.util.List; import com.lixing.pojo.GameInfo; import com.lixing.pojo.PageData; import com.lixing.pojo.UserInfo; import com.lixing.tool.JDBC; import java.sql.PreparedStatement; public class GameInfoDao { //中间省略部分为数据上传功能呢 public PageData findGameInfo(int page,int limit){ PageData p=new PageData(); List<GameInfo> list=new ArrayList<GameInfo>(); p.setCode("1"); p.setMsg("閿熸枻鎷烽敓鎹风》鎷烽敓鏂ゆ嫹閿熷眾甯�"); try { page = (page-1)*limit; //閿熸帴绗》鎷烽敓鏂ゆ嫹閿熸枻鎷峰 Connection con=JDBC.getConnection(); String sql="select * from czgame limit ?,?"; PreparedStatement ps=con.prepareStatement(sql); ps.setInt(1, page); ps.setInt(2, limit); ResultSet rs=ps.executeQuery(); boolean ifg=false; while(rs.next()){ //閿熸枻鎷烽敓鏂ゆ嫹閿熸枻鎷蜂竴閿熸枻鎷烽敓鏂ゆ嫹閿熸嵎锝忔嫹閿熸枻鎷烽敓鏂ゆ嫹閿熸枻鎷蜂竴閿熸枻鎷穟serInfo閿熸枻鎷烽敓鏂ゆ嫹 GameInfo game=new GameInfo(); ifg=true; game.setid(rs.getInt(1)); game.setgame(rs.getString(2)); game.settype(rs.getString(3)); list.add(game); } if(ifg){ p.setCode("0"); p.setMsg("閿熸枻鎷烽敓鏂ゆ嫹閿熸枻鎷烽敓鎹锋垚鐧告嫹閿熸枻鎷�"); p.setCount(findGameInfoCount()); //閿熸枻鎷峰彇閿熺煫浼欐嫹閿熸枻鎷烽敓鏂ゆ嫹閿熸枻鎷烽敓鏂ゆ嫹 p.setData(list); } } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } return p; } public int findGameInfoCount(){ Connection con; int num=0; try { con = JDBC.getConnection(); String sql="select count(*) from czgame "; PreparedStatement ps=con.prepareStatement(sql); ResultSet rs=ps.executeQuery(); if(rs.next()){ num=rs.getInt(1); } } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } return num; } public int deleGameInfoById(int id){ int num=0; try { Connection con=JDBC.getConnection(); String sql="delete from czgame where id=?"; PreparedStatement ps=con.prepareStatement(sql); ps.setInt(1, id); num=ps.executeUpdate(); } catch (Exception e) { e.printStackTrace(); } return num; } } 数据库表很简单 ID game type 用jquey.JS 只是不会在页面上使用这些后台JAVA代码显示网页页面上 最后能实现页面按钮对数据库数据进行删除 以及将数据库数据显示在页面上即可

ssm 框架已经实现,但是ajax返回验证有毛病

``` <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>js+ajax</title> <script type="text/javascript" src="static/bootstrap/js/jquery-2.0.3.js"></script> <script type="text/javascript"> function validate(){ var name= $("#name").val(); if(name==null||name==""){ //为空隐藏提交按钮 var ui =document.getElementById("tijiao"); ui.style.display="none"; //这里是简单的显示 不设计后台,前台做的判断 $("#namediv").html("用户名不可以为空"); }else{ //ajax实现 //11111111获取XMLhtmlRequestxml对象 var req=createXmlHttpRequest(); //222222222准备url 数据 回调函数 //这个name是function下面var的参数. var url="/maven/reg1.do?name="+name; //还有一个参数表示的是异步还是同步,一般不写直接就是true,异步的 req.open("GET",url,true); //3333333333这个就是回调函数 req.onreadystatechange=callback; //这个send是在从servlet判断你的账号是不是存在, 如果是true就说名字存在,给页面返回了以后才有的.为啥写空不知道 //4发送请求 req.send(null); //回调函数 function callback(){ //第一个是我们的服务器成功接受了响应,并且解释了出来,状态4 第二个是服务器内部没有发生错误, url什么的也没有错, if(req.readyState=4&&req.status==200){ var date=req.responseText; if(date=="false"){ //下面的是意思是,如果账号存在了,提交按钮自动消失 //超级叼 var ui =document.getElementById("tijiao"); ui.style.display="none"; $("#namediv").html("用户名已经存在"); }else{ //不为空了,按钮一直显示 var ui =document.getElementById("tijiao"); ui.style.display=""; $("#namediv").html("用户名可以使用"); } } } } } function createXmlHttpRequest(){ //如果是ie6以上版本的浏览器 if(window.XMLHttpRequest){ return new XMLHttpRequest(); }else{ //如果浏览器是ie以下的 return new ActiveXObject("Microsoft.XMLHTTP"); } } </script> </head> <body> <form action="/maven/reg1.do" id="form1"> <table id="aa"> <tr> <td>用户名</td> <td><input type="text" name="username" id="name" onblur="validate();" />&nbsp;<font color="red">*</font></td> <td> <div id="namediv" style="display: inline"></div> </td> <td>密码</td> <td><input type="password" name="password"></td> <td>电话</td> <td><input type="text" name="phone"></td> <td><input type="submit" value="点击注册" id="tijiao"></td> </tr> </table> </form> </body> </html> ``` ``` ``` ``` package com.gray.user.controller; import java.io.IOException; import java.io.PrintWriter; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpRequest; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import com.gray.user.entity.RegUser; import com.gray.user.service.impl.RegServiceImpl; import com.gray.user.service.impl.UserServiceImpl; @Controller public class RegController { @Autowired private RegServiceImpl userService; //自动装载他到spring @RequestMapping("/reg1.do") //url public String dologin(Model model,HttpServletResponse res,@RequestParam String username,RegUser rg,HttpServletResponse response) throws IOException{ boolean used=false; System.out.println("测试参数获取到bean没有"+rg.getUsername()+rg.getPassword()+rg.getPhone()); rg.setUsername(username); if(userService.doUserLogin(rg)){ used=true; System.out.println("通过control到--->service---到dao---到usermapp.在返回回来,service里面是ture,就是说账号不重复"); }else{ used=false; System.out.println("通过control到--->service---到dao---到usermapp.在返回回来,service里面是false,重复了账号 "); } return "regsuccess"; } } ``` ``` package com.gray.user.service.impl; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.gray.user.dao.UserDao; import com.gray.user.entity.RegUser; import com.gray.user.entity.User; import com.gray.user.service.RegService; import com.gray.user.service.UserService; @Service public class RegServiceImpl implements RegService { @Autowired private UserDao<RegUser> dao; @Override public boolean doUserLogin(RegUser ruser) { //第一次执行查询数据库,查询 userdao selectUserName方法。 他这个方法和user.xml里面的id为selectUserName串联了. //也就是直接调用查询语句,并且吧值返回给reguser 类 System.out.println("testRegServiceImpl------->查询数据库,查询语句为id是selectusername"); List<RegUser> list = dao.selectUserName(ruser.getUsername()); System.out.println("查到了集合大小是"+list.size()+"查到了和你账号相同是的是几个"); if(list.size() == 0){ System.out.println("RegServiceImpl---你没有查询到你账号和数据库相同的信息.所以你return,"); for(int i=0;i<list.size();i++){ System.out.println(list.get(i).getUsername()); } return true; }else{ if(list.size()!=0){ System.out.println("regServiceImpl---查询到和你相同的账号不是0个,返回false"); return false; }else{ System.out.println("regserviceImpl----其他情况我也不知道啥情况,也返回false"); return false; } } } } ``` ``` 页面上的ajax 他就一直出毛病,数据库有个账号名是aa 只有我在表单填写aa 他才在网页提示账号重复, 别的任何都不提示,只会提示不能为空, 而且还失灵时不灵。 但是用system. 输出 我写的任何判断都是对了, 这是为啥? 请求大神给我说下,最好说下哪里错了。谢谢了

ajax校验数据库数据是否存在

``` <!-- 查询student_id是否存在 --> <select id="getStudent_id" resultMap="studentMap" parameterType="int"> SELECT * from student where student_id = #{student_id} </select> ``` ``` @RequestMapping("/studentID") public Student getStudent_id(Integer student_id) { Student student = userService.getStudent_id(student_id); if (student==null){ System.out.println("没有"); }else{ System.out.println("有"); } return student; } ``` ``` function check() {//js表单验证方法 var text = document.getElementById("xh").value;//通过id获取需要验证的表单元素的值 if (text == "") { alert("请输入学号!");//弹出提示 return false;//返回false(不提交表单) } if (!(/(^[1-9]\d*$)/.test(text))) { alert("请输入学号!");//弹出提示 return false;//返回false(不提交表单) } var student_id=$("#student_id").val(); $.ajax({ url:"<%=basePath%>user/studentID", type:"post", data:{"student_id":student_id}, dataType:"json", success:function(data){ if (data!=null ) { alert("有"); }else if(data==null && username !=''){ alert("没有"); } xmlhttp.open("GET","getcustomer.asp?q="+str,true); xmlhttp.send(); //alert("啊啊啊"); } }); return true;//提交表单 } </script> <body> <div class="listDIV"> <table border="1" width="50%" height="50%" style="text-align: center;"> <form action="<%=basePath%>user/one" method="post"> <input type="text" id="xh" name="student_id" placeholder="根据学号查询"> <button class="glyphicon glyphicon-select" onclick="return check();">查询</button> </form> ``` ``` 严重: Servlet.service() for servlet [springMVC] in context with path [/StudentManagementSSM] threw exception [Request processing failed; nested exception is java.lang.NullPointerException] with root cause java.lang.NullPointerException at com.zmk.controller.UserTestController.getStudent_id(UserTestController.java:65) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:221) at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:137) at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:110) at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:777) at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:706) at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85) at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:943) at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:877) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:966) at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:868) at javax.servlet.http.HttpServlet.service(HttpServlet.java:650) at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:842) at javax.servlet.http.HttpServlet.service(HttpServlet.java:731) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:219) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:110) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:498) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:169) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103) at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:1025) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:445) at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1139) at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:637) at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:316) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) at java.lang.Thread.run(Unknown Source) ``` 我用ssm做的增删改查,搜索我想先校验一下数据库数据是否存在,存在就直接跳转查询,不存在就弹窗提示,中止提交表单,JS代码是我粘过来的,不会JS,有错误希望能告诉我如何改正,谢谢

根据下拉框选中的值,点击搜索按钮查询,然后从数据库中查询符合条件的值,现实到下面的页面的。

![图片说明](https://img-ask.csdn.net/upload/201610/24/1477286992_752015.png) 用Java代码实现,我用的是SSH框架

form表单里面的数据提交到java后台的问题

![图片说明](https://img-ask.csdn.net/upload/201810/08/1538977921_333322.png) 如图的表单将每一行的数据,作为一个对象提交到java后台,怎么实现?,后台用的ssm框架,

java 表格数据实时刷新怎么实现

如题,ssm框架 table 里面的数据需要实时刷新 数据大概两三秒会变化一次, 有没有比较高效的方法去实现,除了ajax每隔3s调用后台还有其他更优的方法吗

使用外键查看关系表中的数据

<div class="post-text" itemprop="text"> <p>Trying to fetch data from users table by user_id which is the foreign key in vehicle table. The relation is working properly like as when I insert data in the vehicle table then user_id also inserting as expected, but the problem is when I want to fetch data from users table using user_id.</p> <p><strong>I used this SQL query for viewing data</strong></p> <pre><code> &lt;?php $qry = mysql_query("select vehicle. *, users.zip AS zip from vehicle JOIN users ORDER BY id DESC "); while($data = mysql_fetch_array($qry)) {?&gt; &lt;tr role="row" class="even"&gt; &lt;td style="display:none;"&gt;&lt;?php echo $data['id'];?&gt;&lt;/td&gt; &lt;td class="sorting_1"&gt; &lt;?php $datess = $data['create_date']; $old_date_timestamp = strtotime($datess); echo date('m-d-Y', $old_date_timestamp);?&gt; &lt;/td&gt; &lt;td&gt;&lt;?php echo $data['bid_type'];?&gt;&lt;/td&gt; &lt;td&gt;&lt;?php echo $data['zip'];?&gt;&lt;/td&gt; &lt;td&gt; &lt;a href="bid-detail.php?id=&lt;?php echo base64_encode($data['id']);?&gt;" class="btn btn-success btn-small"&gt;$ Make Offer&lt;/a&gt; &lt;/td&gt; &lt;/tr&gt; &lt;?php } ?&gt; </code></pre> <p>This query displaying data, but <strong>it's repeating one again and again</strong>.</p> <p>Anyone can help me please to solve the issue or any other easy solution for this.</p> </div>

java mybaits做查询的时候ORA-00942: 表或视图不存在。但表是存在的

本项目用SSM框架写的。select * from t_menu where pid = #{id} mybatis的查询语句 同样的代码,更改数据库配置文件到Mysql数据库中,建个同样的表格,发送 http://localhost:8080/cdpf/menu/loadMenus.do?id=0请求完全正常,可以返回一个json字符串。 但是,更改成Oracle数据库,其他不变发送同样的请求就报500错误。表是存在的,我复制错误信息 中的SQL语句,放到PL/SQL中可以出结果。

spring动态多数据源切换失败

我在一个SSM项目中配置了多数据源,利用AbstractRoutingDataSource这个类,然后利用aop切入到dao层,进行数据源切换操作。进而执行SQL。事务切入到serviceImpl层。在正常执行的过程中没什么问题,但是偶尔在某个方法的执行中,会出现数据源切换失败的问题。且问题不可复现,请问哪位遇到过这种问题

怎么把前台页面的table里面的值封装成list 传入到后台 table的值是js动态赋值的

项目采用框架spring springmvc mybatis 数据库 mybatis js部分 ``` var arrVZ=eval(json[index].listVX);//arrVZ是一个数组 var str=""; for (var i = 0; i< arrVZ.length; i++) { alert(arrVZ[i].xiangmu_name); alert("项目id:"+arrVZ[i].id); str +="<tr>"; str +="<td colspan=\"5\">"; str +="<div style=\"margin-left: 148px;\" id=\"visceraXiangmus\">"; str +="<div style=\"float: left;\">"; str +="<input type=\"hidden\" name=\"id2\" id=\"id2\" value=\""+arrVZ[i].id+"\"/>"; str +="<textarea style=\"width: 50px;\" id=\"xiangmu_code\" name=\"xiangmu_code\" >"+arrVZ[i].xiangmu_code+"</textarea>"; str +="<textarea style=\"width: 100px;margin-left: 13px;\" id=\"value\" name=\"value\">"+arrVZ[i].value+"</textarea>"; str +="<textarea style=\"width: 120px;margin-left: 14px;\" id=\"xiangmu_name\" name=\"xiangmu_name\">"+arrVZ[i].xiangmu_name+"</textarea>"; str +="<textarea style=\"width: 360px; margin-left: 14px;\" id=\"content\" name=\"content\">"+arrVZ[i].content+"</textarea>"; str +="</div>"; str +="<div >"; str +=" <input type=\"button\" onclick=\"delRow(this)\" value=\"删除\" id=\"deleteXiangmu\" name=\"deleteXiangmu\" style=\"float: left; margin-left: 10px; margin-top: 5px;\">"; str +="</div>"; str +="</div>"; str +="</td>"; str +="</tr>"; $("#tbody").html(str); } ``` jsp页面部分 ``` <!-- 脏腑项目开始 --> <!-- 脏腑项目开始 --> <div id="middle"> <!-- <button style="float: right; margin-right: 95px;">添加</button> --> <input type="button" onclick="addRow()" value="添加项目"id="saveXiangmu" name="saveXiangmu" style="float: right; margin-right: 95px;"> <table border="0" cellpadding="2" cellspacing="1" style="width: 100%" id="rowTable"> <thead> <th></th> <tr> <td colspan="5" style="line-height: 40px;"> <label style="margin-left:148px">项目编号</label> <label style="margin-left:20px">项目分值</label> <label style="margin-left:68px">项目名称</label> <label style="margin-left:88px">项目说明</label> </td> </tr> </thead> <!-- tbody里面是动态添加的内容 --> <tbody id="tbody"> </tbody> </table> </div> <hr style="width: 80%;margin-top: 30px;margin-bottom:30px"> <!-- 脏腑项目结束 --> ``` 控制器部分 ``` List<VisceraXiangmu> listVX=jingluoDetectionService.findVisceraXiangmuByZangfuId(zangfu_id1); if(listVX.size()!=0){ for (int i = 0; i < listVX.size(); i++) { System.out.println(listVX.get(i).getXiangmu_name()); String id2 = request.getParameter("id2") == null ? "" : request.getParameter("id2");// 脏腑项目表id的值 String xiangmu_code = request.getParameter("xiangmu_code") == null ? "" : request.getParameter("xiangmu_code"); String xiangmu_name = request.getParameter("xiangmu_name") == null ? "" : request.getParameter("xiangmu_name"); String main = request.getParameter("main") == null ? "" : request.getParameter("main"); String gender = request.getParameter("gender") == null ? "" : request.getParameter("gender"); String content = request.getParameter("content") == null ? "" : request.getParameter("content"); String value = request.getParameter("value") == null ? "" : request.getParameter("value"); int main1=Integer.parseInt(main+"1"); int id3=Integer.parseInt(id2); jingluoDetectionService.updateVisceraXiangmu(id3, zangfu_id1, xiangmu_code, xiangmu_name, main1, gender, content, value); } ``` 页面展示 ![图片说明](https://img-ask.csdn.net/upload/201609/28/1475055451_252650.jpg) 怎么实现保存以后 循环批量修改页面显示的值 后台的控制类 改怎么取接收动态的table的参数值来就行update

在springmvc中做一个根据id删除一条数据的功能,出现500问题,代码如下,请大神指教

Model层代码 package com.pengyou.model; import java.util.Date; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.Table; @Entity @Table(name = "sg_registry") public class registryEntity { private int id; private String name; private String phonenum; private int intArea; //意向面积 private String recHouse; private String logTime; //录入时间 private String salesMan; private String workArea; private int visitsCount; private String address; private String photoUrl; @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "id",nullable = false,length = 9) public int getId() { return id; } public void setId(int id) { this.id = id; } @Column(name = "name",nullable = false,length = 25) public String getName() { return name; } public void setName(String name) { this.name = name; } @Column(name = "phonenum",nullable = false,length = 11) public String getPhonenum() { return phonenum; } public void setPhonenum(String phonenum) { this.phonenum = phonenum; } @Column(name = "intArea",nullable = false,length = 9) public int getIntArea() { return intArea; } public void setIntArea(int intArea) { this.intArea = intArea; } @Column(name = "recHouse",nullable = false,length = 255) public String getRecHouse() { return recHouse; } public void setRecHouse(String recHouse) { this.recHouse = recHouse; } @Column(name = "logTime",nullable = false) public String getLogTime() { return logTime; } public void setLogTime(String logTime) { this.logTime = logTime; } @Column(name = "salesMan",nullable = false,length = 255) public String getSalesMan() { return salesMan; } public void setSalesMan(String salesMan) { this.salesMan = salesMan; } @Column(name = "workArea",nullable = false,length = 255) public String getWorkArea() { return workArea; } public void setWorkArea(String workArea) { this.workArea = workArea; } @Column(name = "visitsCount",nullable = false,length = 9) public int getVisitsCount() { return visitsCount; } public void setVisitsCount(int visitsCount) { this.visitsCount = visitsCount; } @Column(name = "address",nullable = true,length = 255) public String getAddress() { return address; } public void setAddress(String address) { this.address = address; } @Column(name = "photoUrl",nullable = false,length = 255) public String getPhotoUrl() { return photoUrl; } public void setPhotoUrl(String photoUrl) { this.photoUrl = photoUrl; } } DAO实现类代码 package com.pengyou.dao.impl; import javax.annotation.Resource; import org.hibernate.Session; import org.hibernate.SessionFactory; import org.springframework.stereotype.Repository; import com.pengyou.dao.IdelDao; import com.pengyou.model.registryEntity; @Repository("deldao") public class delDaoImpl<sg_registry> implements IdelDao{ @Resource protected SessionFactory sessionFactory; public Session getSession(){ return sessionFactory.getCurrentSession(); } @Override public void delreg(int id) { Session session = this.getSession(); //registryEntity regens = (registryEntity) session.get(registryEntity.class, id); registryEntity regens = new registryEntity(); regens.setId(id); session.delete(regens); } } sevice实现类代码 package com.pengyou.service.impl; import java.util.List; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.web.bind.annotation.RequestMapping; import com.pengyou.dao.IdelDao; import com.pengyou.service.IdelService; @Transactional @Service("delservice") public class delServiceImpl implements IdelService{ private IdelDao deldao; @Override public void delreg(int id) { // TODO Auto-generated method stub System.out.println("delServiceImpl---1------>"+id); deldao.delreg(id); System.out.println("delServiceImpl--------->"+id); } /* @Override public List allReg() { // TODO Auto-generated method stub return deldao.allReg(); } */ } Controller层代码 package com.pengyou.controller; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseBody; import com.pengyou.service.IdelService; @Controller @RequestMapping("/del/") public class delController extends BaseController{ @Resource private IdelService idelservice; @ResponseBody @RequestMapping("delReg") public String toadd(HttpServletRequest request){ System.out.println("id++++++"+request.getParameter("id")); idelservice.delreg(Integer.parseInt(request.getParameter("id"))); /*System.out.println("delController------->");*/ return "————————————————————"; } } 页面代码 <c:forEach items="${regList }" var="r"> <tr> <td style="text-align: center;"><img style="width: 35px;height: 35px" src="images/${r.photoUrl }" /></td> <td style="text-align: center;">${r.name}</td> <td style="text-align: center;">${r.phonenum }</td> <td style="text-align: center;">${r.intArea }</td> <td style="text-align: center;">${r.recHouse}</td> <td style="text-align: center;">${r.logTime }</td> <td style="text-align: center;">${r.salesMan }</td> <td style="text-align: center;">${r.workArea}</td> <td style="text-align: center;">${r.visitsCount }</td> <td style="text-align: center;">${r.address }</td> <td style="text-align: center;"> <button type="button" class="btn btn-info btn-lg" data-toggle="modal" data-target="#ediModal" id="${u.id }" onclick="edi(this.id)">编辑</button> <button type="button" class="btn btn-info btn-lg" data-toggle="modal" data-target="#delModal" id="${u.id }" onclick="del(this.id)">删除</button> <button type="button" class="btn btn-info btn-lg" data-toggle="modal" data-target="#pushModal" id="${u.id }" onclick="push(this.id)">备注</button> </td> </tr> </c:forEach> </table> </form> 运行时会报500错误,其余的地方都应该没错,应该是dao实现类中的方法错了 id++++++1 delServiceImpl---1------>1 四月 18, 2016 12:18:51 下午 org.apache.catalina.core.StandardWrapperValve invoke 严重: Servlet.service() for servlet [sao] in context with path [/house] threw exception [Request processing failed; nested exception is java.lang.NullPointerException] with root cause java.lang.NullPointerException at com.pengyou.service.impl.delServiceImpl.delreg(delServiceImpl.java:23) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317) at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150) at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:96) at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:260) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:94) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:91) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204) at com.sun.proxy.$Proxy18.delreg(Unknown Source)

请教各路大神Tomcat加载项目报Could not get database metadata

具体报错如下 采用的是ssm框架,在控制层用Juin测试可以输出oracle数据库中的数据 ERROR: HHH000319: Could not get database metadata java.sql.SQLException: An attempt by a client to checkout a Connection has timed out. at com.mchange.v2.sql.SqlUtils.toSQLException(SqlUtils.java:118) at com.mchange.v2.sql.SqlUtils.toSQLException(SqlUtils.java:77) at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool.checkoutPooledConnection(C3P0PooledConnectionPool.java:687) at com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource.getConnection(AbstractPoolBackedDataSource.java:140) at org.hibernate.engine.jdbc.connections.internal.DatasourceConnectionProviderImpl.getConnection(DatasourceConnectionProviderImpl.java:139) at org.hibernate.tool.hbm2ddl.SuppliedConnectionProviderConnectionHelper.prepare(SuppliedConnectionProviderConnectionHelper.java:51) at org.hibernate.tool.hbm2ddl.SchemaValidator.validate(SchemaValidator.java:166) at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:525) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1859) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1930) at org.springframework.orm.hibernate4.LocalSessionFactoryBuilder.buildSessionFactory(LocalSessionFactoryBuilder.java:372) at org.springframework.orm.hibernate4.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:454) at org.springframework.orm.hibernate4.LocalSessionFactoryBean.afterPropertiesSet(LocalSessionFactoryBean.java:439) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1633) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1570) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:539) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:303) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:299) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:736) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:757) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:480) at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:434) at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:306) at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:106) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4738) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5158) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:726) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:702) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:697) at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1134) at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1780) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) Caused by: com.mchange.v2.resourcepool.TimeoutException: A client timed out while waiting to acquire a resource from com.mchange.v2.resourcepool.BasicResourcePool@3b9fff67 -- timeout at awaitAvailable() at com.mchange.v2.resourcepool.BasicResourcePool.awaitAvailable(BasicResourcePool.java:1416) at com.mchange.v2.resourcepool.BasicResourcePool.prelimCheckoutResource(BasicResourcePool.java:606) at com.mchange.v2.resourcepool.BasicResourcePool.checkoutResource(BasicResourcePool.java:526) at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool.checkoutAndMarkConnectionInUse(C3P0PooledConnectionPool.java:755) at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool.checkoutPooledConnection(C3P0PooledConnectionPool.java:682) ... 37 more

2019 Python开发者日-培训

2019 Python开发者日-培训

150讲轻松搞定Python网络爬虫

150讲轻松搞定Python网络爬虫

设计模式(JAVA语言实现)--20种设计模式附带源码

设计模式(JAVA语言实现)--20种设计模式附带源码

YOLOv3目标检测实战:训练自己的数据集

YOLOv3目标检测实战:训练自己的数据集

java后台+微信小程序 实现完整的点餐系统

java后台+微信小程序 实现完整的点餐系统

三个项目玩转深度学习(附1G源码)

三个项目玩转深度学习(附1G源码)

初级玩转Linux+Ubuntu(嵌入式开发基础课程)

初级玩转Linux+Ubuntu(嵌入式开发基础课程)

2019 AI开发者大会

2019 AI开发者大会

玩转Linux:常用命令实例指南

玩转Linux:常用命令实例指南

一学即懂的计算机视觉(第一季)

一学即懂的计算机视觉(第一季)

4小时玩转微信小程序——基础入门与微信支付实战

4小时玩转微信小程序——基础入门与微信支付实战

Git 实用技巧

Git 实用技巧

Python数据清洗实战入门

Python数据清洗实战入门

使用TensorFlow+keras快速构建图像分类模型

使用TensorFlow+keras快速构建图像分类模型

实用主义学Python(小白也容易上手的Python实用案例)

实用主义学Python(小白也容易上手的Python实用案例)

程序员的算法通关课:知己知彼(第一季)

程序员的算法通关课:知己知彼(第一季)

MySQL数据库从入门到实战应用

MySQL数据库从入门到实战应用

机器学习初学者必会的案例精讲

机器学习初学者必会的案例精讲

手把手实现Java图书管理系统(附源码)

手把手实现Java图书管理系统(附源码)

极简JAVA学习营第四期(报名以后加助教微信:eduxy-1)

极简JAVA学习营第四期(报名以后加助教微信:eduxy-1)

.net core快速开发框架

.net core快速开发框架

玩转Python-Python3基础入门

玩转Python-Python3基础入门

Python数据挖掘简易入门

Python数据挖掘简易入门

微信公众平台开发入门

微信公众平台开发入门

程序员的兼职技能课

程序员的兼职技能课

Windows版YOLOv4目标检测实战:训练自己的数据集

Windows版YOLOv4目标检测实战:训练自己的数据集

HoloLens2开发入门教程

HoloLens2开发入门教程

微信小程序开发实战

微信小程序开发实战

Java8零基础入门视频教程

Java8零基础入门视频教程

Python可以这样学(第一季:Python内功修炼)

Python可以这样学(第一季:Python内功修炼)

C++语言基础视频教程

C++语言基础视频教程

Python可以这样学(第四季:数据分析与科学计算可视化)

Python可以这样学(第四季:数据分析与科学计算可视化)

网络工程师小白入门--【思科CCNA、华为HCNA等网络工程师认证】

网络工程师小白入门--【思科CCNA、华为HCNA等网络工程师认证】

Python数据分析与挖掘

Python数据分析与挖掘

微信小程序开发实战之番茄时钟开发

微信小程序开发实战之番茄时钟开发

相关热词 c# 开发接口 c# 中方法上面的限制 c# java 时间戳 c#单元测试入门 c# 数组转化成文本 c#实体类主外键关系设置 c# 子函数 局部 c#窗口位置设置 c# list 查询 c# 事件 执行顺序
立即提问
相关内容推荐