본문 바로가기

분류 전체보기

(268)
JSP- LoginServlet (GET , POST) =====코드===== GET 방식으로 만들어진 LoginServlet Jsp 실행순서를 3가지로 나누었다 @WebServlet("/login") url 요청을 받는 부분이다. login이 요청될때 호출되는것 // 1 Client(사용자)의 요청을 받아 오는 부분 String id = request.getParameter("id"); String passwd = request.getParameter("passwd"); String name = request.getParameter("name"); String age = request.getParameter("age"); //2. 어떤 형식으로 응답 해 줄것인가? response.setContentType("text/html;charset=UTF-8"); ..
10- Jsp TOMCAT (오전) 1 Jsp 프로그래밍에서 어떻게 배워야 하는가? (오리엔테이션) 1.1 꼭 알아야 하는 부분 (용어) HelloServlet 에 들어있는 코드와 역할 단어 정리 - 포워드, 리다이렉트, 쿠키, 세션, 커넥션풀, ... (예제 치면서 얻은 내용을 메모하자) MVC패턴 - 하나의 웹 어플리케이션을을 구현하기 위해 쓰인 파일구조 > 유지보수를 쉽게 하기 위해서 게시판을 만들면서 : 비지니스 로직(M) ,8뷰(V) ,컨트롤러(C) > 파일의 역할 분리. 웹 어플리케이션의 디버깅 유닛테스트 1.2 예제 한번 쳐보고 메모정도 죽은 기법 (요즘 쓰면 안되는 것들 = 유지보수에 도움이 되지 않음) > 스크립틀릿, jstl, ... 이런식으로 꼭 알아야하는 부분1.번과 한번 쳐보고 넘어가는 정도 2번을 잘 구문해서 배우..
Java- Example6번 ( p506~507 ) //p506~ 507 public class Main { public static void main(String[] args) { // FileExample7 : 506p 507p 'Buffer' FileWriter fw = null; BufferedWriter bw = null; try { fw = new FileWriter("./FileExample7/bufferedWriter.txt"); bw = new BufferedWriter(fw, 10); //sz= size bw.write('A'); // < 하나의 데이터 byte bw.write('B'); bw.write('C'); bw.write('D'); Scanner sc = new Scanner(System.in); String input = nu..
Java- FileExample5번 (p490 ~ 491) //p490 ~ 491 public class Main { //DataInputStream, DataOutputStream 테스트 public static void main(String[] args) { FileOutputStream fo = null; FileInputStream fi = null; DataOutputStream dos = null; DataInputStream dis = null; try{ fo= new FileOutputStream(".\\FileExample8\\demo\\dataFile.txt"); //파일 만들기 //파일이 가지고있는 컨텐츠 : 글, 사진, 영상... 이 컨텐츠들은 byte[] 배열의 모음이다. dos= new DataOutputStream(fo); // jav..
Java- FileExample4번 (p487) //p 487 import java.io.ByteArrayOutputStream; import java.io.IOException; public class Main { //ByteArrayOutPutStream 테스트 public static void main(String[] args) { String msg = "ByteArrayOutputStream test"; ByteArrayOutputStream bao = null; try{ bao = new ByteArrayOutputStream(); //bao는 ByteArrayOutPutStream 타입 변수 //ByteArrayOutputStream : Byte 계열 데이터를 출력하는 기능 bao.write(msg.getBytes()); //bao 문자열..
9- 파일IO (Input Output) 예제 / 정리 ==0813 오전 수업== * 절대경로와 상대경로 getAbsolutePath() : 절대경로 - C://dsaf/dafd/fdsa.jpg 상대경로 : 경로 자체를 호출하는 파일의 위치를 기준으로 한다 예 ) File file =new File("../ ../") 1. FIleExample p471~473 https://dwc04112.tistory.com/21 JAVA - FileExample1번 import java.io.File; import java.io.FilenameFilter; import java.io.IOException; //p 471 file예제 public class FileTest1 { public static class ImageNameFilter implements Filena..
JAVA - FileExample3번 import java.io.FileOutputStream; import java.io.IOException; import java.nio.charset.StandardCharsets; //p 485 public class FileOutputStreamTest { //FileOutputStream 테스트 public static void main(String[] args) { FileOutputStream fo = null; String msg = "안녕안녕안녕안녕"; byte [] byteArray = msg.getBytes(StandardCharsets.UTF_8); //문자열 msg를 byte로 가져온다 . // StandarCharsets.UTF_8을 넣어서 안전하게 한글도 사용가능하게 try{ /..
JAVA - FileExample2번 import java.io.FileInputStream; import java.io.IOException; //p 478 479 //예제의 의도 : 파일의 컨텐츠를 어떻게 핸들링? public class FileInputStreamTest { //FileInputStream 테스트 public static void main(String[] args) { FileInputStream fIn=null; try{ // C, C++ : 메모리에 객체를 적재 명령을 하면, 런타임에서 해당 객체를 다 쓰고 난 뒤에 '해제'하는 코드를 넣어야한다 // Java : GARBEGE COLLECTOR (쓰레기 수집기) : new Instance(); 객체를 메모리에 적재하고 GC가 '알아서'메모리 해제 // C, C++ ..