18.05.07

    1. sql 语句去重复

SELECT DISTINCT 列名称 FROM 表名称

    2. StringBuffer 追加字段

StringBuffer hql = new StringBuffer();
hql.append("    SELECT" );
hql.append("        *   ");
hql.append("    FROM    ");
hql.append("        TABLE   ");

    3. 释放最大连接池

// 每次的 sql 请求都要占用一个最大连接池,超过上限则会当机(页面卡死),所以需及时释放
releaseSession(session);

    4. “Cannot read property ‘length’ of null”报错

这里写图片描述
我的后台像前台传值为 null
原因没写这个

private List<Map<String, String>> message;
// 返回没写
public List<Map<String, String>> getMessage() {
    return message;
}

    5. Map

 Map<String, String> map = new HashMap<String, String>();  
  map.put("key1", "value1");  
  map.put("key2", "value2");  
  map.put("key3", "value3");  

  //第一种:普遍使用,二次取值  
  System.out.println("通过Map.keySet遍历key和value:");  
  for (String key : map.keySet()) {  
   System.out.println("key= "+ key + " and value= " + map.get(key));  
  }  

  //第二种  
  System.out.println("通过Map.entrySet使用iterator遍历key和value:");  
  Iterator<Map.Entry<String, String>> it = map.entrySet().iterator();  
  while (it.hasNext()) {  
   Map.Entry<String, String> entry = it.next();  
   System.out.println("key= " + entry.getKey() + " and value= " + entry.getValue());  
  }  

<span style="color:#FF0000;">  //第三种:推荐,尤其是容量大时</span>  
  System.out.println("通过Map.entrySet遍历key和value");  
  for (Map.Entry<String, String> entry : map.entrySet()) {  
   System.out.println("key= " + entry.getKey() + " and value= " + entry.getValue());  
  }  

  //第四种  
  System.out.println("通过Map.values()遍历所有的value,但不能遍历key");  
  for (String v : map.values()) {  
   System.out.println("value= " + v);  
  }  

    6. form 提交使用新路径

document.getElementById("showDetailForm").action="MST0010BInitAction!pageDInit";

猜你喜欢

转载自blog.csdn.net/yw2567/article/details/80239507