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;
        }
  • 相关阅读:
    html 上传图片前预览
    php获取当月天数及当月第一天及最后一天、上月第一天及最后一天实现方法
    php 计算 pdf文件页数
    php 获取半年内每个月的订单数量, 总价, 月份
    php 获取两个数组之间不同的值
    小程序支付功能
    关于nginx的Job for nginx.service failed because the control process exited with error code.错误
    linux 安装 Apollo
    MongoDB待续。。。
    ABP vNext...待续
  • 原文地址:https://www.cnblogs.com/duanwandao/p/9190483.html
Copyright © 2011-2022 走看看