随笔分类 - SpringMVC
学习过程
摘要:@ResponseBody @PostMapping("/uploadPicture") public String insertPicture(MultipartFile file) { //获取上传图片的地址,保存图片的路径 String filePath = "XXX\\resources\\
阅读全文
摘要:1、xml文件放在src路径下,无法识别。pom.xml添加: <!--静态资源导出问题--> <build> <resources> <resource> <directory>src/main/java</directory> <includes> <include>**/*.propertie
阅读全文
摘要:如果更新操作中涉及关键字id,更新表单的jsp页面要回传id,不然id默认为0.而mysql的id从1开始。 可以使用隐藏域返回id <input type="hidden" name="bookID" class="form-control" value="${QBook.bookID}" > 完
阅读全文
摘要:1、新建一个config包和一个配置拦截类MyInterceptor,并继承接口HandlerInterceptor. 快捷键(Ctrl + o)实现该接口的三个方法: public class MyInterceptor implements HandlerInterceptor { public
阅读全文
摘要:1、前情提要: 注意事项: ①将maven项目添加web框架 ②项目结构新建lib包导入所有依赖(此步请在pom.cml导入依赖后完成) ③配置Tomcat ④项目结构概览 ⑤数据库 2、文件配置 2.1 pom.xml 配置依赖 <?xml version="1.0" encoding="UTF-
阅读全文
摘要:具体报错如下 1、rg.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.binding.BindingException: Parameter 'bookID' not found. Avail
阅读全文
摘要:写在前面:项目出现的问题: ①xml格式缩进要严格,不然会报红 ②配置项目结构,新建lib包带入所有依赖jar ③配置Tomcat添加本项目 ④database.properties文件配置每行后面不要留空格,鼠标点进去可以看到是否有空格 ⑤dao层数据库传进参数parametertype与返回参数
阅读全文
摘要:1、在peroperties文件中配置以下代码即可 <!-- 处理请求返回json字符串的中文乱码问题 --> <mvc:annotation-driven> <mvc:message-converters register-defaults="true"> <!-- StringHttpMessa
阅读全文
摘要:1、maven项目启动springMVC的前提: ①项目结构添加lib包并导入依赖 ②项目的Tomcat配置 2、pom.xml配置 <build> <resources> <resource> <directory>src/main/java</directory> <includes> <inc
阅读全文
摘要:1、pom.xml依赖 <dependencies> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.12</version> </dependency> <dependency> <gr
阅读全文
摘要:1、pom.xml导入依赖 <dependencies> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.12</version> </dependency> <dependency> <
阅读全文
摘要:1、SpingMVC的pom.xml依赖 <build> <resources> <resource> <directory>src/main/java</directory> <includes> <include>**/*.properties</include> <include>**/*.x
阅读全文

浙公网安备 33010602011771号