본문 바로가기

---- Contents ----164

response.setContentType("text/html; charset=UTF-8"); request.setCharacterEncoding("UTF-8"); response.setContentType("text/html; charset=UTF-8"); // 요청 시 한글 처리 request.setCharacterEncoding("UTF-8"); // 응답 시 한글 처리 response.setContentType("text/html; charset=UTF-8"); 한글 문자가 깨지므로 setContentType을 사용하여 charset을 UTF-8로 바꿔준다. 2019. 9. 4.
PrintWriter out=response.getWriter(); PrintWriter out=response.getWriter(); 먼저 위의 response는 서버가 클라이언트에게 '응답'한다는 의미를 가진 객체. 서버가 클라이언트에게 '응답'하려면 무조건 response라는 객체를 통해 작업을 해야함. 여기서 getWriter()는 '쓰기'를 통해 응답하겠다는 메서드. 데이터타입은 PrintWriter. out.print(""); 위에서 out이라는 객체가 생성되었으므로 out.print();를 통해 html페이지에 원하는 결과를 출력할 수 있습니다. 서버에서 클라이언트에게 응답할 장소는 html페이지 이기 때문에 ...형식을 지켜줘야합니다. 그래서 위와 같이 큰따옴표("")안에 html태그를 넣었습니다. 2019. 9. 4.
window.onload window.onload = function() { //window.onload : 현재 문서의 body 부분을 읽고 난 후 자바스크립트를 실행하라는 의미를 담고 있음. document.getElementById("btnChannel1").onclick = function() { var myDiv = document.getElementById("myDiv"); myDiv.style.backgroundColor = "yellow"; //css 변경하겠다.(배경색) myDiv.style.width = "150px"; document.getElementById("str").style.color = "red"; } } function go_change(){ alert("자바스크립트 DOM 테스트") } 불러오는.. 2019. 8. 30.