当前位置:网站首页>ssm网页访问数据库数据报错
ssm网页访问数据库数据报错
2022-08-02 10:53:00 【CSDN问答】
今天做ssm数据连接,tomcat服务器启动访问网页都正常,但是跳转网页获取数据库数据的时候就报错了,这是什么问题,是数据库没连接上嘛,还是配置信息缺文件,报错如下

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(); }}
包结构

边栏推荐
猜你喜欢

LeetCode每日一练 —— 225. 用队列实现栈

After 21 years of graduation, I switched to software testing. From 0 income to a monthly salary of over 10,000, I am really lucky...

C#/VB.NET to add more lines more columns image watermark into the Word document

周杰伦新歌发布,爬取《Mojito》MV弹幕,看看粉丝们都说的些啥!

软件测试岗位巨坑?阿里在职7年测试人告诉你千万别上当
![ASP.NET Core 6框架揭秘实例演示[31]:路由&quot;高阶&quot;用法](/img/57/821576ac28abc8d1c0d65df6a72fa3.png)
ASP.NET Core 6框架揭秘实例演示[31]:路由&quot;高阶&quot;用法

How to technically ensure the quality of LED display?

通过方法引用获取方法名

games202:三,实时环境光照IBL + PRT

Verilog's random number system task----$random
随机推荐
bgp与mpls综合实验
Nanny Level Tutorial: Write Your Own Mobile Apps and Mini Programs (Part 2)
外包学生管理系统架构文档
LayaBox---TypeScript---Symbols
MSYS2 QtCreator Clangd code analysis can not find mm_malloc.h problem remedy
21年毕业转行软件测试,从0收入到月薪过万,我真的很幸运...
全方位剖析Numpy中的np.diag源代码
多线程之生产者与消费者
Rear tube implements breadcrumb function
身为程序猿——谷歌浏览器的这些骚操作你真的废吗!【熬夜整理&建议收藏】[通俗易懂]
MySQL模糊查询性能优化
Com多进程通信实现
Jay Chou's new song is released, crawl the "Mojito" MV barrage, and see what the fans have to say!
ASP.NET Core 6框架揭秘实例演示[31]:路由&quot;高阶&quot;用法
idea常用插件
Why use BGP?
FPGA手撕代码——CRC校验码的多种Verilog实现方式 (2021乐鑫科技数字IC提前批代码编程)
Oracle查询提示 ORA-00933 SQL command not properly ended 原因排查
超赞!发现一个APP逆向神器!
LayaBox - TypeScript - merge statement