2018. 6. 12. 09:58

input form에 selection 및 deselection

$('#id').click(function() {
    $(this).select()
}).blur(function() {
    if(window.getSelection) {
        var sel = window.getSelection();
        if(sel.collapse)
            sel.collapse($(this)[0], 0); //firefox의 경우 removeAllRanges는 동작안되는 경우가 있음
        else
            sel.removeAllRanges();
    } else if(document.selection) {
        document.selection.empty();
    }
});
2018. 6. 11. 12:38

History.back() 차단

history.pushState(null, null, location.href);
window.onpopstate = function(event) {
    history.go(1);
};
2018. 3. 12. 10:15

[ColdFusion] DSN 없이 DB에 접속하는 방법

//Load the database driver using java class loader
classLoader = createObject("java", "java.lang.Class");
classLoader.forName("com.mysql.jdbc.Driver");

//Create a driver manager instance
driverManager = createObject("java","java sql.DriverManager");

//Create the connection to the DB
connection = driverManager.getConnection("jdbc:mysql://localhost:3306/demodb?user=demouser&password=demopass");

//Create a connection statement and run our query string
statement = connection.createStatement();
resultSet = statement.ExecuteQuery("SELECT * FROM testtable");

//Convert the resultset into a coldfusion query object
queryObj = createObject("java", "coldfusion sql.QueryTable").init(resultSet);

//Close the connection
connection.Close();
2017. 12. 26. 09:31

Java class 의 static 메소드 호출 방법

CreateObject 를 할때 init를 하지말고 생성 후 호출


systemObject = createObject("java", "java.lang.System");
writeOutput(systemObject.currentTimeMillis());