2013年7月31日 星期三

[JSTL]判斷該欄位是否為空值

在JSTL裡,判斷欄位是否為空值

用 empty

ex: empty each.remCuser             判斷rmeCuser為空的
      not empty each.remCuser     判斷rmeCuser不為空的

[JAVA]比對Collection的值是否一樣

可以用containsKey去檢查map的key是否一樣
如此就不用一個一個去比對


http://www.roseindia.net/tutorial/java/core/hashMap/containsKey.html

HashMapContainsKey.java
package net.roseindia.java;
import java.util.HashMap;
public class HashMapContainsKey {
public static void main(String[] arr) {
/* Create object of HashMap */
HashMap<Integer, String> obMap = new HashMap<Integer, String>();
/* Add value in HashMap */
obMap.put(new Integer(1), "Bharat");
obMap.put(new Integer(2), "Gyan");
obMap.put(new Integer(4), "Vrishti");
obMap.put(new Integer(3), "Sarika");
obMap.put(new Integer(5), "Rohit");
obMap.put(new Integer(6), "Parineeta");
/* Check key present in HashMap or not */
System.out.println("Returns :" + obMap.containsKey(1));
System.out.println("Returns :" + obMap.containsKey(8)); } }