testjson1.jsp 부분 


<%@page import="javax.management.StringValueExp"%>


<%@page import="org.apache.catalina.util.StringParser"%>


<%@ page language="java" contentType="text/html; charset=EUC-KR"


    pageEncoding="EUC-KR"%>




<%@ page import="org.json.simple.*"%>


<%@ page import="java.sql.*"%>




<%




String connect="jdbc:oracle:thin:@lsw.c2lzj8znf3wg.ap-northeast-1.rds.amazonaws.com:1521:ORCL";




String user="lsw";


String passwd="";




Connection conn;


Statement stat;


JSONArray arr = new JSONArray();




try{


System.out.println("ddd");


Class.forName("oracle.jdbc.driver.OracleDriver");


System.out.println("zzzzzz");


conn= DriverManager.getConnection(connect ,user ,passwd);



if(conn!= null){


System.out.println("connect");


}


else{


System.out.println("not connect.");


}


stat= conn.createStatement();



/*String query="select * from TMP_TB";


System.out.println(query);*/


ResultSet rs = stat.executeQuery("select * from productBoard");








 






while(rs.next()){



//rs.next();



String goodsname=rs.getString(1);


String id=rs.getString(13);


//String earning =String.valueOf(rs.getInt(3));


int price=rs.getInt(4);






JSONObject obj = new JSONObject();


obj.put("goodsname", goodsname);


obj.put("id", id); 


obj.put("price", price);



//arr.add(0, obj);


 


if(obj != null){


arr.add(obj);


//out.println(arr.toJSONString());


}

//System.out.println(goodsname +"--"+ id + "--"+ price);



}

System.out.println(arr.toJSONString());

out.println(arr.toJSONString());


rs.close();


stat.close();


conn.close();



}catch(Exception er){



}




/*  String name= request.getParameter("name");


JSONArray jarray = new JSONArray();


JSONObject jobject=new JSONObject();




jobject.put("name", name);


jobject.put("age", "14");


jobject.put("nickname", "qwerty");




jarray.add(0, jobject);


 */


%>



ajaxtest1.html 부분 



<!DOCTYPE html>


<html>


<head>


<script src="http://code.jquery.com/jquery-latest.min.js"></script>


<script>


$(document).ready(function(){


jQuery.ajax({


type:"post",


url: "./testjson1.jsp",//"./test.html",


data:"name=junho",


dataType:"JSON",


success: function(data){


//alert(data);




$.each(data, function(){


//alert(this["name"]);


// 한줄은 되는데 배열은 오류가 난다 



alert(this.goodsname);


alert(this.id);


alert(this.price); 




});


},


complete: function(data){



},


error:function(xhr, status , error){


alert("에러발생");


}



})


})




</script>






<meta charset="EUC-KR">


<title>Insert title here</title>


</head>


<body>




</body>


</html>


'jquery, ajax' 카테고리의 다른 글

자바스크립트 제이쿼리 this  (0) 2016.01.28
jquery change()  (0) 2015.12.28
다중 셀렉터 다중 css처리  (0) 2015.11.16
ajax를 쓰는 목적  (0) 2015.09.23
ajax를 이용해서 json 배열 받기 예제  (1) 2015.04.07
Posted by 이상욱1
,

public class ParseExam {
    
    public static void main(String[] args) {
        
        String numStr = "54";
        
        // String값을 int형의 값으로 바꾸는 방법
        int numInt = Integer.parseInt(numStr);
        System.out.println(numInt);
        
        // int형의 값을 String으로 바꾸는 방법
        String numStr2 = String.valueOf(numInt);
        System.out.println(numStr2);
    }

}

'메소드 정리' 카테고리의 다른 글

concat 자체 구현  (0) 2015.05.07
return; break ; continue의 차이  (0) 2015.05.04
Posted by 이상욱1
,

rds 패스워드 바꾸기

aws 2015. 4. 6. 22:43

1. aws 콘솔을 웹상에서 로그인 합니다 

2. rds 인스턴스가 있는 웹창에 들어가서 오른쪽 마우스를 클릭 한 후 modify 를 클릭 합니다 

3.New Master Password 부분에 새로운 패스워드를 입력해준 후 

4. Apply Immediately 체크 후 continue를 클릭 해줍니다.



http://www.codetweet.com/amazon-web-services/quickly-change-amazon-rds-master-users-password/

'aws' 카테고리의 다른 글

php aws sdk 설치  (0) 2016.04.21
Posted by 이상욱1
,