当前位置:网站首页>ssm web page access database data error
ssm web page access database data error
2022-08-02 11:00:00 【CSDN Q&A】
今天做ssm数据连接,tomcatThe server starts to access the web pages normally,But when I jump to the web page to get the database data, I get an error,这是什么问题,The database is not connected,The configuration file is still missing,报错如下

spring配置信息
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:context="http://www.springframework.org/schema/context" xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:p="http://www.springframework.org/schema/p" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=" http://www.springframework.org/schema/aop https://www.springframework.org/schema/aop/spring-aop.xsd http://www.springframework.org/schema/tx https://www.springframework.org/schema/tx/spring-tx.xsd http://www.springframework.org/schema/context https://www.springframework.org/schema/context/spring-context.xsd http://www.springframework.org/schema/mvc https://www.springframework.org/schema/mvc/spring-mvc.xsd http://www.springframework.org/schema/beans https://www.springframework.org/schema/beans/spring-beans.xsd">
<context:component-scan base-package="com.duing.service"/>
<context:property-placeholder location="classpath:druid.properties"/>
<bean id="datasource" class="com.alibaba.druid.pool.DruidDataSource"> <property name="url" value="${jdbc.url}"/> <property name="username" value="${jdbc.username}"/> <property name="password" value="${jdbc.password}"/>
bean>
<bean id="factory" class="org.mybatis.spring.SqlSessionFactoryBean"> <property name="dataSource" ref="datasource"/> <property name="configLocation" value="classpath:/mybatis.xml"/>
<property name="mapperLocations" value="classpath:mappers/*.xml"/>
bean>
<bean class="org.mybatis.spring.mapper.MapperScannerConfigurer"> <property name="sqlSessionFactoryBeanName" value="factory"/> <property name="basePackage" value="com.duing.dao"/>
bean>
beans>spring配置信息
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context" xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=" http://www.springframework.org/schema/context https://www.springframework.org/schema/context/spring-context.xsd http://www.springframework.org/schema/mvc https://www.springframework.org/schema/mvc/spring-mvc.xsd http://www.springframework.org/schema/beans https://www.springframework.org/schema/beans/spring-beans.xsd">
<context:component-scan base-package="com.duing.controller"/>
<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver"> <property name="prefix" value="/WEB-INF/jsp/"/> <property name="suffix" value=".jsp"/>
bean>
<mvc:annotation-driven/> <context:annotation-config/>
beans>mybatis配置信息
configuration PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-config.dtd"><configuration> <mappers> <package name="com.duing.dao"/>
mappers>
configuration>mapper配置信息
mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"><mapper namespace="com.duing.dao.FilmDao"> <select id="getAll" resultType="com.duing.entity.Film"> select id , film_id,`name`,director,player,`type`,country,`length`,synopsis,play_time,img_path from film
select>
mapper>
mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"><mapper namespace="com.duing.dao.UserDao"> <select id="getAll" resultType="com.duing.entity.User"> select `name` , age from user
select>
mapper>controller信息
package com.duing.controller;import com.duing.service.FilmService;import com.duing.vo.FilmVO;import org.springframework.beans.factory.annotation.Autowired;import org.springframework.stereotype.Controller;import org.springframework.web.bind.annotation.RequestMapping;import org.springframework.web.bind.annotation.ResponseBody;import java.util.List;@Controllerpublic class FilmController { @Autowired private FilmService filmService; @RequestMapping("/filmList") @ResponseBody public List
selectAll(){ List
filmVOS = filmService.selectAll();
return filmVOS; }}
package com.duing.controller;import com.duing.entity.User;import com.duing.service.UserService;import org.springframework.beans.factory.annotation.Autowired;import org.springframework.stereotype.Controller;import org.springframework.web.bind.annotation.RequestMapping;import org.springframework.web.bind.annotation.ResponseBody;import java.util.List;@Controllerpublic class UserController { @Autowired private UserService userService; @RequestMapping("/queryUser") @ResponseBody public List
queryUsers(){
return userService.getAll(); }}
包结构

边栏推荐
- SQL 经典50题(题目+解答)(1)
- Hongxing, donate another million
- Deep Learning 100 Examples - Convolutional Neural Network (CNN) for mnist handwritten digit recognition
- 从测试入门到测试架构师,这10年,他是这样让自己成才的
- Oracle 19c配置ob server
- mysql清除binlog日志文件
- org.apache.ibatis.binding.BindingException Invalidbound statement (not found)的解决方案和造成原因分析(超详细)
- yolo格式(txt)数据集转VOC(xml)
- Mysql环境变量的配置(详细图解)
- MapStruct
猜你喜欢

软件测试岗位巨坑?阿里在职7年测试人告诉你千万别上当

字母交换--字符串dp

Breaking the Boundary, Huawei's Storage Journey

Three.JS程序化建模入门

Hello, my new name is "Bronze Lock/Tongsuo"

Turning and anti-climbing attack and defense

SQL 经典50题(题目+解答)(1)

Nanny Level Tutorial: Write Your Own Mobile Apps and Mini Programs (Part 2)

365天挑战LeetCode1000题——Day 047 设计循环队列 循环队列

2022年8月初济南某外包公司全栈开发面试题整理
随机推荐
SQLAlchemy使用教程
3D激光slam:LeGO-LOAM---地面点提取方法及代码分析
The sitcom "Re-Walking the Long March" was staged
STM32+MPU6050 Design Portable Mini Desktop Clock (Automatically Adjust Time Display Direction)
循环结构--while循环
注意力机制
使用较广泛的安全测试工具有哪些?
Event object, do you know it well?
3年测试在职,月薪还不足2w,最近被裁员,用亲身经历给大家提个醒...
ansible模块--yum模块
利用二维数据学习纹理三维网格生成(CVPR 2020)
5G基础学习1、5G网络架构、网络接口及协议栈
21年毕业转行软件测试,从0收入到月薪过万,我真的很幸运...
循环语句综合练习
How to technically ensure the quality of LED display?
流动性质押挖矿系统开发如何制作?单双币系统开发成熟技术
Multithreading (Basic) - 40,000 word summary
LayaBox---TypeScript---Mixins
Oracle超全SQL,细节狂魔
Failed to configure mysql, what's going on?