学习记录1

1.使用java.math.BigDecimal类来进行精确计算

public class Test_1 {
    public static void main(String[] args) {
        System.out.println(0.07+0.01);
    }
}    

运行结果如下。

         0.07999999999999999

原因:我们的计算机是二进制的。浮点数没有办法是用二进制进行精确表示。float只能用来进行科学计算或工程计算,在大多数的商业计算中,一般采用java.math.BigDecimal类来进行精确计算。

2.UUID

3.css中父div与子div不在一个容器内

问题:子div显示不出父div的背景颜色。

原因:父div与子div不在一个容器内。

<html>
<head>
</head>

<body>
    <div style="width:600px;height:aoto;">
         <div style="float:left;width:65%;">111</div>
         <div style="float:right;width:30%;>222</div>
         <div style="clear:both;"></div>
    </div>
</body>
</html>

 4.ajax返回map类型、List类型数据

将方法类型定义为为List<Map<String,Object>>,返回出错。

  @RequestMapping(value = "/cjobPromote.html", method = RequestMethod.POST)
    public void cjobPromote(HttpServletRequest request,
            HttpServletResponse response) throws IOException{
        List<Map<String,Object>> result = cjobService.queryCJob();
        
        Map<String,List<Map<String,Object>>> rsltMap = new HashMap();
        rsltMap.put("cjobList", result);
        String json = JSONObject.toJSONString(rsltMap);
        try {
            PrintWriter out= null;
            out=response.getWriter();
            out.append(json);
            out.flush();
            out.close();
        } catch (Exception e) {
            e.printStackTrace();
        }

    }

5.二进制流绘制->图片

JAVA--将二进制流转换成图片文件

Servlet以流的形式返回图片

6.js获得上个页面的参数

 

在a.html页面
window.location="b.html?id=a";

在b.html页面
function parseUrl(){ //解析获得的参数
    var url=location.href;
    var i=url.indexOf('?');
    if(i==-1)return;
    var querystr=url.substr(i+1);
    var arr1=querystr.split('&');
    var arr2=new Object();
    for  (i in arr1){
        var ta=arr1[i].split('=');
        arr2[ta[0]]=ta[1];
    }
    return arr2;
}                  
 var v = parseUrl();//解析所有参数
 alert(v['id']);//就是你要的结果

 7. select * from table where 1=1

 

8.synchronized

 

9.Serializable

posted @ 2017-09-08 11:00  hy叶子  阅读(137)  评论(0编辑  收藏  举报