使用:「java.net.URLEncoder.encode(String s, String encoding)

URLEncoder.encode( text, "UTF-8" );

提示:若用 HTML 的 form 送出(submit),送出的值會自動 encode,不需再處理。

參考:

文章標籤

Robert 發表在 痞客邦 留言(0) 人氣()

jstl 標準標籤函式庫的 <c:forEach>。

<c:forEach var="categoryName" items="${categoriesList}" varStatus="loop">
    <li><a onclick="getCategoryIndex(${loop.index})" href="#">${categoryName}</a></li>
</c:forEach>

參考:
java - How to get a index value from foreach loop in jstl - Stack Overflow

文章標籤

Robert 發表在 痞客邦 留言(0) 人氣()

在 微軟的 SQL Server 裡,
判斷值是否為NULL,
不是使用「!=」、「=」,

文章標籤

Robert 發表在 痞客邦 留言(0) 人氣()

 

例如:

class Car {
}

class Audi extends Car {
}

class Seat extends Car {
}

class Mercedes extends Car {
}
Car car = new Audi();
// car is instance of Audi, Seat or Mercedes ?

答:「使用 "instanceof" 關鍵字。」

文章標籤

Robert 發表在 痞客邦 留言(0) 人氣()

 

public class Test {

    static {
        System.out.println("Static");
    }

    {
        System.out.println("Non-static block");
    }

    public static void main(String[] args) {
        Test t = new Test();
        Test t2 = new Test();
    }
}

輸出結果:

Static
文章標籤

Robert 發表在 痞客邦 留言(0) 人氣()

java.util.Formatter、System.out.printf

一直看不懂「%3$d」中的「$」前字號(dollar sign)是什麼意思...
終於看懂了

文章標籤

Robert 發表在 痞客邦 留言(0) 人氣()

如果使用比較運算子:「==」、「!=」、「===」、「!==」,需要先使用「date.getTime()」,
例如:

    var d1 = new Date();
    var d2 = new Date(d1);
    var same = d1.getTime() === d2.getTime();
    var notSame = d1.getTime() !== d2.getTime();

建立 Date 物件:

文章標籤

Robert 發表在 痞客邦 留言(0) 人氣()

Java 8 u171

    String[] timeZoneIds = java.util.TimeZone.getAvailableIDs() ;
    for ( String aTimeZoneId : timeZoneIds ) {
        System.out.println( aTimeZoneId );
    }
    System.out.println( "Total: " + timeZoneIds.length );

Africa/Abidjan
Africa/Accra

文章標籤

Robert 發表在 痞客邦 留言(0) 人氣()

 

CSS:

  •     <div style="border:1px solid gray;">
            <p>This is some paragraph inside div tag.</p>
        </div>
  •  

 

文章標籤

Robert 發表在 痞客邦 留言(0) 人氣()

  • May 14 Mon 2018 16:24
  • 一般

 

副檔名 Filename Extension
   
   

 


文章標籤

Robert 發表在 痞客邦 留言(0) 人氣()