zoukankan      html  css  js  c++  java
  • 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>标签内容换为    

    1 <web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee"  
    2     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance  
    3     http://www.springmodules.org/schema/cache/springmodules-cache.xsd http://www.springmodules.org/schema/cache/springmodules-ehcache.xsd"   
    4      xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee   
    5     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文件中使用大于,小于时要用 &gt; &lt;   

        <if test="createTimefrom!=null and createTimefrom!='' ">
              and createTime &gt;= #{createTimefrom}
        </if>
        <if test="createTimeto!=null and createTimeto!='' ">
              and createTime &lt;= #{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;
        }
  • 相关阅读:
    别再乱升级 MySQL 驱动了。。
    Spring Boot + MyBatis + MySQL 实现读写分离
    多线程环境下,HashMap 为什么会出现死循环?
    亿级流量架构怎么做资源隔离?写得太好了!
    refdeveloptools for developers
    how to setup ppc2003 or smartphone 2003 to connect to internet
    转载:一篇java与C#的对比文章(英文)
    在sqlexpress中添加DB和在sql analyzer中操作DB.
    windows 2003下配置IIS6为iis5方式的隔离模式运行
    开源的pop3和smtp组件(支持中文及SSL)
  • 原文地址:https://www.cnblogs.com/duanwandao/p/9190483.html
Copyright © 2011-2022 走看看