SSM总结
1 报错: cvc-complex-type.2.4.a: Invalid content was found starting with element 'async-supported'. One of '{"http://java.sun.com/xml/ns/javaee":init-param}' is expected.
将<web-app>标签内容换为
<web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance
http://www.springmodules.org/schema/cache/springmodules-cache.xsd http://www.springmodules.org/schema/cache/springmodules-ehcache.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
2 Referenced file contains errors (http://www.springframework.org/schema/beans/spring-beans-3.1.xsd) MyEcilpse2017里面则是在Preferences 中搜索关键字“Validation”,然后在里面把XML schema的两个勾去掉就OK
3 Spring常用注解 https://blog.csdn.net/sysware_carol/article/details/52793164
4 JsonConfig中setExcludes方法的使用 https://blog.csdn.net/finality_000/article/details/36418655
JsonConfig cfg = new JsonConfig();
cfg.setExcludes(new String[] { "d" });
使用JsonValueProcessor将date转换成希望的类型 https://www.cnblogs.com/zhujiabin/p/5142891.html
JSONObject result=new JSONObject();
JsonConfig jsonConfig=new JsonConfig();
jsonConfig.setExcludes(new String[]{"customer"});
jsonConfig.registerJsonValueProcessor(java.util.Date.class, new DateJsonValueProcessor("yyyy-MM-dd")); //详见工具类
JSONArray jsonArray=JSONArray.fromObject(contactList,jsonConfig);
5 前端的日期格式回传处理
@InitBinder
public void initBinder(WebDataBinder binder) {
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
dateFormat.setLenient(false);
binder.registerCustomEditor(Date.class, new CustomDateEditor(dateFormat, true)); //true:允许输入空值,false:不能为空值
}
6 mybatis在Mapper.xml文件中使用大于,小于时要用 > <
<if test="createTimefrom!=null and createTimefrom!='' ">
and createTime >= #{createTimefrom}
</if>
<if test="createTimeto!=null and createTimeto!='' ">
and createTime <= #{createTimeto}
</if>
7 MyBatis+MySQL 返回插入的主键ID https://blog.csdn.net/dyllove98/article/details/8866357 useGeneratedKeys="true" keyProperty="id"
8 transferto()方法,是springmvc封装的方法,用于图片上传时,把内存中图片写入磁盘
@RequestMapping("/save")
public String save(@RequestParam("imageFile") MultipartFile imageFile,Blogger blogger,HttpServletRequest request,HttpServletResponse response)throws Exception{
if(!imageFile.isEmpty()){
String filePath=request.getServletContext().getRealPath("/");
String imageName=DateUtil.getCurrentDateStr()+"."+imageFile.getOriginalFilename().split("\\.")[1];
imageFile.transferTo(new File(filePath+"static/userImages/"+imageName));
blogger.setImageName(imageName);
}
int resultTotal=bloggerService.update(blogger);
StringBuffer result=new StringBuffer();
if(resultTotal>0){
result.append("<script language='javascript'>alert('修改成功!');</script>");
}else{
result.append("<script language='javascript'>alert('修改失败!');</script>");
}
ResponseUtil.write(response, result);
return null;
}
SSM总结的更多相关文章
- 【SSM框架】Spring + Springmvc + Mybatis 基本框架搭建集成教程
本文将讲解SSM框架的基本搭建集成,并有一个简单demo案例 说明:1.本文暂未使用maven集成,jar包需要手动导入. 2.本文为基础教程,大神切勿见笑. 3.如果对您学习有帮助,欢迎各种转载,注 ...
- springmvc 多数据源 SSM java redis shiro ehcache 头像裁剪
获取下载地址 QQ 313596790 A 调用摄像头拍照,自定义裁剪编辑头像 B 集成代码生成器 [正反双向](单表.主表.明细表.树形表,开发利器)+快速构建表单; 技术:31359679 ...
- SSM项目搭建(提供源码)
1创建web动态项目,项目结构截图 2.配置日志文件 #\u5B9A\u4E49LOG\u8F93\u51FA\u7EA7\u522B log4j.rootLogger=INFO,Console,Fi ...
- activiti工作流的web流程设计器整合视频教程 SSM和独立部署
本视频为activiti工作流的web流程设计器整合视频教程 整合Acitiviti在线流程设计器(Activiti-Modeler 5.21.0 官方流程设计器) 本视频共讲了两种整合方式 1. 流 ...
- activiti工作流的web流程设计器整合视频教程 SSM 和 独立部署
本视频为activiti工作流的web流程设计器整合视频教程 整合Acitiviti在线流程设计器(Activiti-Modeler 5.21.0 官方流程设计器) 本视频共讲了两种整合方式 1. 流 ...
- SSM三大框架整合详细教程(Spring+SpringMVC+MyBatis)【转】
使用SSM(Spring.SpringMVC和Mybatis)已经有三个多月了,项目在技术上已经没有什么难点了,基于现有的技术就可以实现想要的功能,当然肯定有很多可以改进的地方.之前没有记录SSM整合 ...
- Maven+Spring+Spring MVC+MyBatis+MySQL,搭建SSM框架环境【转】
项目建设完成之后的结构: 数据库的表结构如下: 环境建设:搭建Maven环境.Tomcat环境.需要MySql 数据库支持,使用的编程工具Eclipse (这些是前期准备): 开始创建工程: 1.创建 ...
- java web后台开发SSM框架(Spring+SpringMVC+MyBaitis)搭建与优化
一.ssm框架搭建 1.1创建项目 新建项目后规划好各层的包. 1.2导入包 搭建SSM框架所需包百度云链接:http://pan.baidu.com/s/1cvKjL0 1.3整合spring与my ...
- SSM整合(三):Spring4与Mybatis3与SpringMVC整合
源码下载 SSMDemo 上一节整合了Mybatis3与Spring4,接下来整合SpringMVC! 说明:整合SpringMVC必须是在web项目中,所以前期,新建的就是web项目! 本节全部采用 ...
- SSM整合(二):Spring4与Mybatis3整合
上一节测试好了Mybatis3,接下来整合Spring4! 一.添加spring上下文配置 在src/main/resources/目录下的spring新建spring上下文配置文件applicati ...
随机推荐
- Kindle一周使用感受
为何选择Kindle 「Kindle」终于入手,心情十分愉悦^_^,入手的是499块「Kindle国行版」,个人感觉电子墨水屏显示效果很赞,很适合在光线比较充足的环境下阅读,即使在中午的阳光底下使用K ...
- Microsoft Dynamics CRM 4.0导入组织(Import Organization)时间过长的原因总结
952934 How to move the Microsoft Dynamics CRM 4.0 deployment http://support.microsoft.com/default ...
- 【python】正则表达式-group和group的区别
__author__ = 'paul' import re a = "123abc456" print re.search("([0-9]*)([a-z]*)([0-9] ...
- mysqldump的single-transaction
先看一下--lock-tables和--lock-all-tables --lock-all-tables 一次性锁定所有数据库的所有表,在整个dump期间一直获取global read lock: ...
- php 内容插入数据库需要mysql_escape_string处理一下 展示内容时候用htmlentities
php 内容插入数据库需要mysql_escape_string处理一下 mysql_escape_string (PHP 4 >= 4.0.3, PHP 5, 注意:在PHP5.3中已经弃用这 ...
- 关于 android 返回键 代码实现
转自:http://www.dewen.io/q/11313/android+%E6%A8%A1%E6%8B%9F%E8%BF%94%E5%9B%9E%E9%94%AE%E5%8A%9F%E8%83% ...
- web中显示中文名称的图片,可以这样配置filter
com.cy.filter.UrlFilter: package com.cy.filter; import java.io.IOException; import java.net.URLDecod ...
- CSS 标签实例二
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...
- Lua中的metatable详解
转自:http://www.jb51.net/article/56690.htm Lua 中 metatable 是一个普通的 table,但其主要有以下几个功能: 1.定义算术操作符和关系操作符的行 ...
- VS:error C3872: '0xe044': this character is not allowed in an identifier解决方法
从网上粘贴代码到编译器中直接编译的话,会报这个错误,但是代码看上去是没有问题的,实际的原因是因为我们粘贴代码的时候粘贴了中文字符进来. 解决方法:就是把这段代码放到记事本里,选择替换把中文输入空 ...