개발공부

23DAY /

2017. 5. 8. 11:24


DriverDB.java


package kr.or.ksmart.driverdb;

import java.sql.Connection;

import java.sql.DriverManager;

import java.sql.SQLException;

 

public class DriverDB {

 

       public Connection driverDbcon() throws ClassNotFoundException, SQLException{

             System.out.println("driverDbcon DriverDB.java");

             Connection reconn = null;

             Class.forName("com.mysql.jdbc.Driver");

            

             String jdbcDriver = "포트번호";

             String dbUser = "dbid";

             String dbPass = "dbpwi";

            

             reconn = DriverManager.getConnection(jdbcDriverdbUserdbPass);

             return reconn;

       }

}


1) 기존파일 (ex - user_list) 에 import

<%@ page import ="kr.or.ksmart.driverdb.DriverDB" %>


2)드라이버 로딩 부분 삭제 후 입력


DriverDB db = new DriverDB();

conn = db.driverDbcon();



[JDBC] 쿼리 공백 에러

2017. 5. 1. 15:08

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '= 'id001'' at line 1


틀린 코드 ▼

수정한 코드▼


query = "select * from tb_member where "+sk+"= ?";


WHERE 조건문에서 공백을 주지않아서 쿼리에러가 발생하였다. 쿼리문장은 sql에서 실행후 복사,붙여넣기 하는것이 좋은것 같다






자바스크립트사용


자바스크립트 변수


변수타입


<!DOCTYPE html>
<html>
<head>
    <meta charset="EUC-KR">
    <title>Insert title here</title>
    <script>
    // db -> select -> 배열
    let card = [
                 {num:1,  kind:"spade"}
                ,{num:2,  kind:"spade"}
                ,{num:3,  kind:"spade"}
                ,{num:4,  kind:"spade"}
                ,{num:5,  kind:"spade"}
                ,{num:6,  kind:"spade"}
                ,{num:7,  kind:"spade"}
                ,{num:8,  kind:"spade"}
                ,{num:9,  kind:"spade"}
                ,{num:10, kind:"spade"}
                ,{num:11, kind:"spade"}
                ,{num:12, kind:"spade"}
                ,{num:13, kind:"spade"}
                ,{num:1,  kind:"heart"}
                ,{num:2,  kind:"heart"}
                ,{num:3,  kind:"heart"}
                ,{num:4,  kind:"heart"}
                ,{num:5,  kind:"heart"}
                ,{num:6,  kind:"heart"}
                ,{num:7,  kind:"heart"}
                ,{num:8,  kind:"heart"}
                ,{num:9,  kind:"heart"}
                ,{num:10, kind:"heart"}
                ,{num:11, kind:"heart"}
                ,{num:12, kind:"heart"}
                ,{num:13, kind:"heart"}
                ,{num:1,  kind:"diamond"}
                ,{num:2,  kind:"diamond"}
                ,{num:3,  kind:"diamond"}
                ,{num:4,  kind:"diamond"}
                ,{num:5,  kind:"diamond"}
                ,{num:6,  kind:"diamond"}
                ,{num:7,  kind:"diamond"}
                ,{num:8,  kind:"diamond"}
                ,{num:9,  kind:"diamond"}
                ,{num:10, kind:"diamond"}
                ,{num:11, kind:"diamond"}
                ,{num:12, kind:"diamond"}
                ,{num:13, kind:"diamond"}
                ,{num:1,  kind:"clover"}
                ,{num:2,  kind:"clover"}
                ,{num:3,  kind:"clover"}
                ,{num:4,  kind:"clover"}
                ,{num:5,  kind:"clover"}
                ,{num:6,  kind:"clover"}
                ,{num:7,  kind:"clover"}
                ,{num:8,  kind:"clover"}
                ,{num:9,  kind:"clover"}
                ,{num:10, kind:"clover"}
                ,{num:11, kind:"clover"}
                ,{num:12, kind:"clover"}
                ,{num:13, kind:"clover"}
                ];
    
        window.addEventListener("load",function(){
            let play = document.getElementById("play");
            play.addEventListener("click"function(){
                for(let i=0; i<10000; i++) {
                    let r = Math.floor(Math.random()*card.length); // 0 ~ 3
                    let temp = card[0];
                    card[0= card[r];
                    card[r] = temp;
                }
                let str ="";
                for(let i=0; i<5; i++) {
                    let fileName = card[i].kind+card[i].num+".JPG";
                    let path = "<img src='./imgs/"+fileName+"'>"
                    str += path;
                }
                let result = document.getElementById("result");
                result.innerHTML = str;
            });
        });
        
        
 
        
    </script>
</head>
<body class="container">
    <button id="play" class="btn btn-primary">play</button>
    <div id="result">
    </div>
</body>
</html>



19DAY /Bootstrap,CSS

2017. 4. 27. 13:41


JSP와 CSS

CSS구문

다이어리만들기







































Bootstrap(부트스트랩) 사용하기 


1)부트스트랩 다운로드

http://getbootstrap.com/


2)압축풀기 후 각각 파일 복사붙여넣기


3)웹페이지열어 Stylesheet 와 JAVAScript 영역에 관련된 파일의 경로를 추가한다.


3)JQuery라이브러리 추가하기

ㄴCDN방식으로 HTML내에서 참조


4)원하는 component 사용


참조사이트 https://www.w3schools.com/bootstrap/default.asp


+ Recent posts