├── java110-mybatis ├── src │ ├── main │ │ ├── java │ │ │ ├── README.md │ │ │ ├── ex03 │ │ │ │ ├── jdbc.properties │ │ │ │ ├── Test03.java │ │ │ │ ├── MemberDao-02.xml │ │ │ │ └── MemberDao-01.xml │ │ │ ├── ex04 │ │ │ │ ├── jdbc.properties │ │ │ │ ├── mybatis-config-02.xml │ │ │ │ ├── mybatis-config-03.xml │ │ │ │ └── mybatis-config-04.xml │ │ │ ├── ex05 │ │ │ │ ├── jdbc.properties │ │ │ │ └── mybatis-config-01.xml │ │ │ ├── ex06 │ │ │ │ ├── jdbc.properties │ │ │ │ └── mybatis-config-01.xml │ │ │ ├── ex07 │ │ │ │ ├── jdbc.properties │ │ │ │ └── mybatis-config-01.xml │ │ │ ├── ex08 │ │ │ │ ├── jdbc.properties │ │ │ │ ├── AttachFile.java │ │ │ │ └── mybatis-config-01.xml │ │ │ ├── ex02 │ │ │ │ ├── MemberDaoFactory.java │ │ │ │ ├── Test01.java │ │ │ │ ├── DaoException.java │ │ │ │ └── DaoBuilder.java │ │ │ └── ex01 │ │ │ │ ├── DaoException.java │ │ │ │ └── Test01.java │ │ └── resources │ │ │ └── README.md │ └── test │ │ ├── java │ │ └── README.md │ │ └── resources │ │ └── README.md ├── jdbc.properties ├── gradle │ └── wrapper │ │ └── gradle-wrapper.properties ├── settings.gradle ├── README.md └── build.gradle ├── java110-spring-webmvc ├── src │ ├── main │ │ ├── java │ │ │ ├── README.md │ │ │ ├── ex01 │ │ │ │ ├── AppConfig.java │ │ │ │ ├── Test01.java │ │ │ │ ├── MyWebApplicationInitializer2.java │ │ │ │ └── MyWebApplicationInitializer3.java │ │ │ ├── ex02 │ │ │ │ ├── Test11.java │ │ │ │ ├── Test08.java │ │ │ │ ├── Test09.java │ │ │ │ ├── Tire.java │ │ │ │ ├── DatePropertyEditor.java │ │ │ │ ├── Test10.java │ │ │ │ ├── Engine.java │ │ │ │ ├── CarPropertyEditor.java │ │ │ │ ├── Test18.java │ │ │ │ ├── Test17.java │ │ │ │ ├── Test06.java │ │ │ │ └── Test05.java │ │ │ └── ex03 │ │ │ │ └── Test29.java │ │ ├── webapp │ │ │ ├── README.md │ │ │ ├── upload │ │ │ │ └── README.md │ │ │ ├── ex03 │ │ │ │ ├── test23.jsp │ │ │ │ ├── Test23.html │ │ │ │ └── Test22.html │ │ │ ├── facebook │ │ │ │ ├── login08.jsp │ │ │ │ ├── test01.html │ │ │ │ ├── login09.jsp │ │ │ │ ├── test02.html │ │ │ │ └── test03.html │ │ │ ├── ex02 │ │ │ │ ├── Test15.jsp │ │ │ │ ├── Test02.jsp │ │ │ │ ├── Test03.jsp │ │ │ │ ├── Test12.jsp │ │ │ │ ├── Test13.jsp │ │ │ │ ├── Test15-2.jsp │ │ │ │ ├── Test10.html │ │ │ │ ├── Test17.html │ │ │ │ ├── Test14.jsp │ │ │ │ ├── Test20.html │ │ │ │ ├── Test03.html │ │ │ │ └── Test21.html │ │ │ └── WEB-INF │ │ │ │ └── jsp │ │ │ │ └── ex03 │ │ │ │ ├── test29 │ │ │ │ ├── m1.jsp │ │ │ │ ├── m2.jsp │ │ │ │ ├── no │ │ │ │ │ └── m4.jsp │ │ │ │ └── ok │ │ │ │ │ └── m3.jsp │ │ │ │ ├── test23 │ │ │ │ └── m2.jsp │ │ │ │ ├── Test23.jsp │ │ │ │ ├── Test24.jsp │ │ │ │ └── test26 │ │ │ │ ├── m1.jsp │ │ │ │ ├── m2.jsp │ │ │ │ ├── m3.jsp │ │ │ │ ├── m6.jsp │ │ │ │ ├── m8.jsp │ │ │ │ ├── m5.jsp │ │ │ │ ├── m4.jsp │ │ │ │ └── m7.jsp │ │ └── resources │ │ │ └── README.md │ └── test │ │ ├── java │ │ └── README.md │ │ └── resources │ │ └── README.md ├── gradle │ └── wrapper │ │ └── gradle-wrapper.properties └── settings.gradle ├── java110-project ├── data │ ├── README.md │ ├── manager.dat │ ├── teacher.dat │ ├── manager2.dat │ ├── student2.dat │ ├── teacher2.dat │ └── student.dat ├── src │ └── main │ │ ├── webapp │ │ ├── upload │ │ │ └── README.md │ │ ├── img │ │ │ └── anonymous.png │ │ ├── WEB-INF │ │ │ └── jsp │ │ │ │ ├── footer.jsp │ │ │ │ ├── error.jsp │ │ │ │ ├── teacher │ │ │ │ └── list.jsp │ │ │ │ ├── header.jsp │ │ │ │ ├── student │ │ │ │ └── list.jsp │ │ │ │ └── manager │ │ │ │ └── list.jsp │ │ ├── package.json │ │ ├── index.html │ │ └── css │ │ │ └── common.css │ │ ├── resources │ │ └── bitcamp │ │ │ └── java110 │ │ │ └── cms │ │ │ ├── conf │ │ │ └── jdbc.properties │ │ │ └── mapper │ │ │ ├── PhotoDao.xml │ │ │ └── MemberDao.xml │ │ └── java │ │ └── bitcamp │ │ └── java110 │ │ └── cms │ │ ├── dao │ │ ├── PhotoDao.java │ │ ├── MemberDao.java │ │ ├── ManagerDao.java │ │ ├── TeacherDao.java │ │ └── StudentDao.java │ │ ├── service │ │ ├── AuthService.java │ │ ├── ManagerService.java │ │ ├── StudentService.java │ │ └── TeacherService.java │ │ ├── domain │ │ ├── Manager.java │ │ ├── Teacher.java │ │ └── Student.java │ │ └── web │ │ └── interceptor │ │ └── AuthInterceptor.java ├── gradle │ └── wrapper │ │ ├── gradle-wrapper.jar │ │ └── gradle-wrapper.properties └── settings.gradle ├── java110-servlet ├── src │ ├── main │ │ ├── java │ │ │ ├── README.md │ │ │ └── bitcamp │ │ │ │ └── java110 │ │ │ │ ├── ex13 │ │ │ │ ├── Inventory.java │ │ │ │ ├── Inventory2.java │ │ │ │ └── Listener01.java │ │ │ │ ├── ex11 │ │ │ │ └── Listener01.java │ │ │ │ ├── ex02 │ │ │ │ ├── Servlet02.java │ │ │ │ └── Servlet03.java │ │ │ │ ├── ex07 │ │ │ │ └── Listener01.java │ │ │ │ ├── Member.java │ │ │ │ ├── ex05 │ │ │ │ ├── Servlet04.java │ │ │ │ └── Servlet03.java │ │ │ │ ├── ex01 │ │ │ │ └── Listener01.java │ │ │ │ └── ex09 │ │ │ │ ├── Servlet05.java │ │ │ │ └── Servlet06.java │ │ ├── webapp │ │ │ ├── upload │ │ │ │ └── README.md │ │ │ ├── pic1.jpeg │ │ │ ├── jsp │ │ │ │ ├── ex08_1.txt │ │ │ │ ├── ex08_2.txt │ │ │ │ ├── ex09_1.jsp │ │ │ │ ├── ex09_2.jsp │ │ │ │ ├── ex14_header.jsp │ │ │ │ ├── ex14_footer.jsp │ │ │ │ ├── ex02.jsp │ │ │ │ ├── ex04.jsp │ │ │ │ ├── ex05.jsp │ │ │ │ ├── ex15_error.jsp │ │ │ │ ├── ex09.jsp │ │ │ │ ├── ex03.jsp │ │ │ │ ├── ex12_2.jsp │ │ │ │ ├── ex12_6.jsp │ │ │ │ ├── ex14.jsp │ │ │ │ ├── ex08.jsp │ │ │ │ ├── test01.jsp │ │ │ │ ├── ex13.jsp │ │ │ │ └── ex15.jsp │ │ │ ├── WEB-INF │ │ │ │ └── pic2.jpeg │ │ │ ├── ex06 │ │ │ │ ├── index.html │ │ │ │ ├── hello.jsp │ │ │ │ └── index.jsp │ │ │ ├── index.html │ │ │ ├── test.jsp │ │ │ ├── ex05 │ │ │ │ ├── test1.html │ │ │ │ ├── test2.html │ │ │ │ ├── test3.html │ │ │ │ └── test4.html │ │ │ ├── el │ │ │ │ ├── ex05.jsp │ │ │ │ ├── ex04.jsp │ │ │ │ ├── ex07.jsp │ │ │ │ ├── ex02.jsp │ │ │ │ ├── ex06.jsp │ │ │ │ ├── ex08.jsp │ │ │ │ └── ex03.jsp │ │ │ ├── jstl │ │ │ │ ├── ex02.jsp │ │ │ │ ├── ex11.jsp │ │ │ │ ├── ex06.jsp │ │ │ │ ├── ex12.jsp │ │ │ │ ├── ex10.jsp │ │ │ │ ├── ex08.jsp │ │ │ │ ├── ex09.jsp │ │ │ │ ├── ex05.jsp │ │ │ │ ├── ex13.jsp │ │ │ │ └── ex03.jsp │ │ │ └── ex04 │ │ │ │ ├── get.html │ │ │ │ ├── post2.html │ │ │ │ ├── file.html │ │ │ │ ├── file2.html │ │ │ │ └── post.html │ │ └── resources │ │ │ ├── README.md │ │ │ └── bitcamp │ │ │ └── java110 │ │ │ └── conf │ │ │ └── test.properties │ └── test │ │ ├── java │ │ └── README.md │ │ └── resources │ │ └── README.md ├── gradle │ └── wrapper │ │ ├── gradle-wrapper.jar │ │ └── gradle-wrapper.properties ├── settings.gradle └── build.gradle ├── java110-spring-ioc ├── src │ ├── test │ │ └── java │ │ │ └── README.md │ └── main │ │ └── java │ │ ├── Hello.java │ │ ├── ex11 │ │ ├── step2 │ │ │ ├── Service.java │ │ │ ├── Dao1.java │ │ │ ├── Dao2.java │ │ │ ├── Dao3.java │ │ │ ├── ServiceImpl.java │ │ │ ├── ServiceProxy.java │ │ │ └── AppConfig.java │ │ ├── step1 │ │ │ ├── Dao1.java │ │ │ ├── Dao2.java │ │ │ ├── Dao3.java │ │ │ ├── AppConfig.java │ │ │ └── Service.java │ │ ├── step3 │ │ │ ├── Dao1.java │ │ │ ├── Dao2.java │ │ │ ├── Dao3.java │ │ │ ├── Service.java │ │ │ ├── Test01.java │ │ │ ├── ServiceImpl.java │ │ │ └── MethodFilter.java │ │ ├── step4 │ │ │ ├── Dao1.java │ │ │ ├── Dao2.java │ │ │ ├── Dao3.java │ │ │ ├── Service.java │ │ │ ├── MyAdvice.java │ │ │ └── ServiceImpl.java │ │ ├── step5 │ │ │ ├── Dao1.java │ │ │ ├── Dao2.java │ │ │ ├── Dao3.java │ │ │ ├── Service.java │ │ │ ├── MyAdvice.java │ │ │ └── ServiceImpl.java │ │ ├── step6 │ │ │ ├── Dao1.java │ │ │ ├── Dao2.java │ │ │ ├── Dao3.java │ │ │ ├── Service.java │ │ │ └── ServiceImpl.java │ │ ├── step7 │ │ │ ├── Dao1.java │ │ │ ├── Dao2.java │ │ │ ├── Dao3.java │ │ │ ├── Service.java │ │ │ ├── app-context-1.xml │ │ │ ├── MyAdvice.java │ │ │ └── ServiceImpl.java │ │ └── step8 │ │ │ ├── Dao1.java │ │ │ ├── Dao2.java │ │ │ ├── Dao3.java │ │ │ ├── Service.java │ │ │ ├── AppConfig.java │ │ │ ├── MyAdvice.java │ │ │ └── ServiceImpl.java │ │ ├── ex01 │ │ ├── Test02.java │ │ ├── Test01.java │ │ ├── Test03.java │ │ ├── app-context.xml │ │ ├── app-context2.xml │ │ ├── app-context3.xml │ │ ├── Test04.java │ │ ├── Test05.java │ │ ├── Test06.java │ │ ├── CarFactory1.java │ │ └── CarFactory2.java │ │ ├── ex02 │ │ ├── app-context-1.xml │ │ └── AppConfig.java │ │ ├── ex03 │ │ ├── app-context-1.xml │ │ ├── app-context-3.xml │ │ └── app-context-4.xml │ │ ├── ex09 │ │ ├── app-context-1.xml │ │ └── app-context-2.xml │ │ ├── ex05 │ │ ├── app-context-5.xml │ │ ├── CD.java │ │ ├── Test02_p1.java │ │ ├── app-context-3.xml │ │ └── app-context-4.xml │ │ ├── ex08 │ │ ├── MyBeanPostProcessor.java │ │ ├── app-context-3.xml │ │ ├── Engine.java │ │ └── app-context-2.xml │ │ ├── ex04 │ │ ├── app-context-3.xml │ │ └── Engine.java │ │ ├── ex06 │ │ ├── EngineFactory2.java │ │ ├── EngineFactory1.java │ │ └── Engine.java │ │ └── ex07 │ │ ├── EnginePropertyEditor.java │ │ └── Engine.java ├── gradle │ └── wrapper │ │ └── gradle-wrapper.properties ├── README.md ├── settings.gradle └── build.gradle ├── java110-db ├── modeling │ ├── ex.exerd │ ├── ex01.exerd │ ├── ex02.exerd │ ├── ex03.exerd │ ├── ex05.exerd │ ├── ex06.exerd │ ├── ex07.exerd │ ├── ex09.exerd │ ├── ex10.exerd │ ├── ex11.exerd │ ├── ex21.exerd │ ├── ex22.exerd │ ├── ex23.exerd │ └── ex24.exerd ├── team-model │ ├── LEADME.exerd │ ├── INDESKER.exerd │ ├── MODERNCLASS.exerd │ └── MOVIESTAGRAM.exerd ├── project-model │ └── model.exerd ├── gradle │ └── wrapper │ │ ├── gradle-wrapper.jar │ │ └── gradle-wrapper.properties ├── build.gradle ├── settings.gradle └── mariadb-setting.txt └── .gitignore /java110-mybatis/src/main/java/README.md: -------------------------------------------------------------------------------- 1 | # 자바 소스 폴더 -------------------------------------------------------------------------------- /java110-mybatis/src/test/java/README.md: -------------------------------------------------------------------------------- 1 | # 자바 소스 폴더 -------------------------------------------------------------------------------- /java110-spring-webmvc/src/main/java/README.md: -------------------------------------------------------------------------------- 1 | # 폴더 -------------------------------------------------------------------------------- /java110-spring-webmvc/src/main/webapp/README.md: -------------------------------------------------------------------------------- 1 | # 폴더 -------------------------------------------------------------------------------- /java110-spring-webmvc/src/test/java/README.md: -------------------------------------------------------------------------------- 1 | # 폴더 -------------------------------------------------------------------------------- /java110-project/data/README.md: -------------------------------------------------------------------------------- 1 | 학생, 강사, 매니저 등 데이터 파일을 두는 폴 -------------------------------------------------------------------------------- /java110-servlet/src/main/java/README.md: -------------------------------------------------------------------------------- 1 | 자바 소스 파일을 두는 폴더 -------------------------------------------------------------------------------- /java110-spring-webmvc/src/main/resources/README.md: -------------------------------------------------------------------------------- 1 | # 폴더 -------------------------------------------------------------------------------- /java110-spring-webmvc/src/main/webapp/upload/README.md: -------------------------------------------------------------------------------- 1 | # 폴더 -------------------------------------------------------------------------------- /java110-spring-webmvc/src/test/resources/README.md: -------------------------------------------------------------------------------- 1 | # 폴더 -------------------------------------------------------------------------------- /java110-mybatis/src/main/resources/README.md: -------------------------------------------------------------------------------- 1 | # 실행과 관련된 기타 파일 -------------------------------------------------------------------------------- /java110-mybatis/src/test/resources/README.md: -------------------------------------------------------------------------------- 1 | # 실행과 관련된 기타 파일 -------------------------------------------------------------------------------- /java110-servlet/src/test/java/README.md: -------------------------------------------------------------------------------- 1 | 단위 테스트용 자바 소스 파일을 두는 폴더 -------------------------------------------------------------------------------- /java110-project/src/main/webapp/upload/README.md: -------------------------------------------------------------------------------- 1 | # 업로드 파일을 저장하는 폴더 -------------------------------------------------------------------------------- /java110-servlet/src/main/webapp/upload/README.md: -------------------------------------------------------------------------------- 1 | 이 폴더에 업로드 파일을 저장한다. -------------------------------------------------------------------------------- /java110-project/data/manager.dat: -------------------------------------------------------------------------------- 1 | 10,10,10,10,10 2 | 12,11,11,11,12 3 | -------------------------------------------------------------------------------- /java110-servlet/src/main/resources/README.md: -------------------------------------------------------------------------------- 1 | 애플리케이션 실행에 관련된 설정 파일을 두는 폴더 -------------------------------------------------------------------------------- /java110-servlet/src/test/resources/README.md: -------------------------------------------------------------------------------- 1 | 단위 테스트 실행에 관련된 설정 파일을 두는 폴더 -------------------------------------------------------------------------------- /java110-spring-ioc/src/test/java/README.md: -------------------------------------------------------------------------------- 1 | # 단위 테스트 관련 자바 파일을 두는 소스 폴더 -------------------------------------------------------------------------------- /java110-servlet/src/main/resources/bitcamp/java110/conf/test.properties: -------------------------------------------------------------------------------- 1 | #test.properties -------------------------------------------------------------------------------- /java110-project/data/teacher.dat: -------------------------------------------------------------------------------- 1 | t1,t1,t1,1,t1,t1 2 | t2,t2,t2,1,t2,t2 3 | t3,t3,t3,1,t3,t3 4 | -------------------------------------------------------------------------------- /java110-db/modeling/ex.exerd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eomjinyoung/java110/HEAD/java110-db/modeling/ex.exerd -------------------------------------------------------------------------------- /java110-db/modeling/ex01.exerd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eomjinyoung/java110/HEAD/java110-db/modeling/ex01.exerd -------------------------------------------------------------------------------- /java110-db/modeling/ex02.exerd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eomjinyoung/java110/HEAD/java110-db/modeling/ex02.exerd -------------------------------------------------------------------------------- /java110-db/modeling/ex03.exerd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eomjinyoung/java110/HEAD/java110-db/modeling/ex03.exerd -------------------------------------------------------------------------------- /java110-db/modeling/ex05.exerd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eomjinyoung/java110/HEAD/java110-db/modeling/ex05.exerd -------------------------------------------------------------------------------- /java110-db/modeling/ex06.exerd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eomjinyoung/java110/HEAD/java110-db/modeling/ex06.exerd -------------------------------------------------------------------------------- /java110-db/modeling/ex07.exerd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eomjinyoung/java110/HEAD/java110-db/modeling/ex07.exerd -------------------------------------------------------------------------------- /java110-db/modeling/ex09.exerd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eomjinyoung/java110/HEAD/java110-db/modeling/ex09.exerd -------------------------------------------------------------------------------- /java110-db/modeling/ex10.exerd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eomjinyoung/java110/HEAD/java110-db/modeling/ex10.exerd -------------------------------------------------------------------------------- /java110-db/modeling/ex11.exerd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eomjinyoung/java110/HEAD/java110-db/modeling/ex11.exerd -------------------------------------------------------------------------------- /java110-db/modeling/ex21.exerd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eomjinyoung/java110/HEAD/java110-db/modeling/ex21.exerd -------------------------------------------------------------------------------- /java110-db/modeling/ex22.exerd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eomjinyoung/java110/HEAD/java110-db/modeling/ex22.exerd -------------------------------------------------------------------------------- /java110-db/modeling/ex23.exerd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eomjinyoung/java110/HEAD/java110-db/modeling/ex23.exerd -------------------------------------------------------------------------------- /java110-db/modeling/ex24.exerd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eomjinyoung/java110/HEAD/java110-db/modeling/ex24.exerd -------------------------------------------------------------------------------- /java110-db/team-model/LEADME.exerd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eomjinyoung/java110/HEAD/java110-db/team-model/LEADME.exerd -------------------------------------------------------------------------------- /java110-project/data/manager2.dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eomjinyoung/java110/HEAD/java110-project/data/manager2.dat -------------------------------------------------------------------------------- /java110-project/data/student2.dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eomjinyoung/java110/HEAD/java110-project/data/student2.dat -------------------------------------------------------------------------------- /java110-project/data/teacher2.dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eomjinyoung/java110/HEAD/java110-project/data/teacher2.dat -------------------------------------------------------------------------------- /java110-db/project-model/model.exerd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eomjinyoung/java110/HEAD/java110-db/project-model/model.exerd -------------------------------------------------------------------------------- /java110-db/team-model/INDESKER.exerd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eomjinyoung/java110/HEAD/java110-db/team-model/INDESKER.exerd -------------------------------------------------------------------------------- /java110-db/team-model/MODERNCLASS.exerd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eomjinyoung/java110/HEAD/java110-db/team-model/MODERNCLASS.exerd -------------------------------------------------------------------------------- /java110-project/data/student.dat: -------------------------------------------------------------------------------- 1 | s1,s1,1111,s1,s1,true 2 | s2,s2,s2,s2,s2,false 3 | s3,s3,s3,s3,s3,true 4 | s4,s4,s4,s4,s4,false 5 | -------------------------------------------------------------------------------- /java110-db/team-model/MOVIESTAGRAM.exerd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eomjinyoung/java110/HEAD/java110-db/team-model/MOVIESTAGRAM.exerd -------------------------------------------------------------------------------- /java110-servlet/src/main/webapp/pic1.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eomjinyoung/java110/HEAD/java110-servlet/src/main/webapp/pic1.jpeg -------------------------------------------------------------------------------- /java110-db/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eomjinyoung/java110/HEAD/java110-db/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /java110-mybatis/jdbc.properties: -------------------------------------------------------------------------------- 1 | driver=org.mariadb.jdbc.Driver 2 | url=jdbc:mariadb://localhost:3306/studydb 3 | username=study 4 | password=1111 -------------------------------------------------------------------------------- /java110-servlet/src/main/webapp/jsp/ex08_1.txt: -------------------------------------------------------------------------------- 1 | <%@ page 2 | pageEncoding="UTF-8" 3 | trimDirectiveWhitespaces="true"%> 4 |

ex08_1 내용

-------------------------------------------------------------------------------- /java110-servlet/src/main/webapp/jsp/ex08_2.txt: -------------------------------------------------------------------------------- 1 | <%@ page 2 | pageEncoding="UTF-8" 3 | trimDirectiveWhitespaces="true"%> 4 |

ex08_2 내용

-------------------------------------------------------------------------------- /java110-project/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eomjinyoung/java110/HEAD/java110-project/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /java110-project/src/main/webapp/img/anonymous.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eomjinyoung/java110/HEAD/java110-project/src/main/webapp/img/anonymous.png -------------------------------------------------------------------------------- /java110-servlet/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eomjinyoung/java110/HEAD/java110-servlet/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /java110-servlet/src/main/webapp/WEB-INF/pic2.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eomjinyoung/java110/HEAD/java110-servlet/src/main/webapp/WEB-INF/pic2.jpeg -------------------------------------------------------------------------------- /java110-mybatis/src/main/java/ex03/jdbc.properties: -------------------------------------------------------------------------------- 1 | driver=org.mariadb.jdbc.Driver 2 | url=jdbc:mariadb://localhost:3306/studydb 3 | username=study 4 | password=1111 -------------------------------------------------------------------------------- /java110-mybatis/src/main/java/ex04/jdbc.properties: -------------------------------------------------------------------------------- 1 | driver=org.mariadb.jdbc.Driver 2 | url=jdbc:mariadb://localhost:3306/studydb 3 | username=study 4 | password=1111 -------------------------------------------------------------------------------- /java110-mybatis/src/main/java/ex05/jdbc.properties: -------------------------------------------------------------------------------- 1 | driver=org.mariadb.jdbc.Driver 2 | url=jdbc:mariadb://localhost:3306/studydb 3 | username=study 4 | password=1111 -------------------------------------------------------------------------------- /java110-mybatis/src/main/java/ex06/jdbc.properties: -------------------------------------------------------------------------------- 1 | driver=org.mariadb.jdbc.Driver 2 | url=jdbc:mariadb://localhost:3306/studydb 3 | username=study 4 | password=1111 -------------------------------------------------------------------------------- /java110-mybatis/src/main/java/ex07/jdbc.properties: -------------------------------------------------------------------------------- 1 | driver=org.mariadb.jdbc.Driver 2 | url=jdbc:mariadb://localhost:3306/studydb 3 | username=study 4 | password=1111 -------------------------------------------------------------------------------- /java110-mybatis/src/main/java/ex08/jdbc.properties: -------------------------------------------------------------------------------- 1 | driver=org.mariadb.jdbc.Driver 2 | url=jdbc:mariadb://localhost:3306/studydb 3 | username=study 4 | password=1111 -------------------------------------------------------------------------------- /java110-project/src/main/resources/bitcamp/java110/cms/conf/jdbc.properties: -------------------------------------------------------------------------------- 1 | jdbc.driver=org.mariadb.jdbc.Driver 2 | #jdbc.url=jdbc:mariadb://localhost:3306/studydb 3 | -------------------------------------------------------------------------------- /java110-spring-ioc/src/main/java/Hello.java: -------------------------------------------------------------------------------- 1 | 2 | public class Hello { 3 | 4 | public static void main(String[] args) { 5 | System.out.println("Hello"); 6 | 7 | } 8 | 9 | } 10 | -------------------------------------------------------------------------------- /java110-servlet/src/main/webapp/ex06/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |

index.html

9 | 10 | -------------------------------------------------------------------------------- /java110-servlet/src/main/webapp/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Welcome! 6 | 7 | 8 |

환영합니다!

9 | 10 | -------------------------------------------------------------------------------- /java110-spring-ioc/src/main/java/ex11/step2/Service.java: -------------------------------------------------------------------------------- 1 | package ex11.step2; 2 | 3 | public interface Service { 4 | void add(); 5 | } 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /java110-project/src/main/java/bitcamp/java110/cms/dao/PhotoDao.java: -------------------------------------------------------------------------------- 1 | package bitcamp.java110.cms.dao; 2 | 3 | import java.util.Map; 4 | 5 | public interface PhotoDao { 6 | int insert(Map params); 7 | int delete(int no); 8 | } 9 | -------------------------------------------------------------------------------- /java110-project/src/main/webapp/WEB-INF/jsp/footer.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" 2 | contentType="text/html; charset=UTF-8" 3 | pageEncoding="UTF-8" 4 | trimDirectiveWhitespaces="true"%> 5 | -------------------------------------------------------------------------------- /java110-project/src/main/java/bitcamp/java110/cms/dao/MemberDao.java: -------------------------------------------------------------------------------- 1 | package bitcamp.java110.cms.dao; 2 | 3 | import bitcamp.java110.cms.domain.Member; 4 | 5 | public interface MemberDao { 6 | int insert(Member member); 7 | int delete(int no); 8 | } 9 | -------------------------------------------------------------------------------- /java110-spring-webmvc/src/main/webapp/ex03/test23.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" 2 | contentType="text/plain; charset=UTF-8" 3 | pageEncoding="UTF-8" 4 | trimDirectiveWhitespaces="true"%> 5 | Hello! 6 | <% 7 | Thread.currentThread().sleep(10000); 8 | %> -------------------------------------------------------------------------------- /java110-db/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.9-bin.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /java110-mybatis/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.9-bin.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /java110-project/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.10-bin.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /java110-servlet/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.9-bin.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /java110-spring-ioc/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.9-bin.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /java110-spring-webmvc/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.9-bin.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /java110-spring-ioc/src/main/java/ex11/step1/Dao1.java: -------------------------------------------------------------------------------- 1 | package ex11.step1; 2 | 3 | import org.springframework.stereotype.Component; 4 | 5 | @Component 6 | public class Dao1 { 7 | public void insert() { 8 | System.out.println("Dao1.insert()"); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /java110-spring-ioc/src/main/java/ex11/step1/Dao2.java: -------------------------------------------------------------------------------- 1 | package ex11.step1; 2 | 3 | import org.springframework.stereotype.Component; 4 | 5 | @Component 6 | public class Dao2 { 7 | public void insert() { 8 | System.out.println("Dao2.insert()"); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /java110-spring-ioc/src/main/java/ex11/step1/Dao3.java: -------------------------------------------------------------------------------- 1 | package ex11.step1; 2 | 3 | import org.springframework.stereotype.Component; 4 | 5 | @Component 6 | public class Dao3 { 7 | public void insert() { 8 | System.out.println("Dao3.insert()"); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /java110-spring-ioc/src/main/java/ex11/step2/Dao1.java: -------------------------------------------------------------------------------- 1 | package ex11.step2; 2 | 3 | import org.springframework.stereotype.Component; 4 | 5 | @Component 6 | public class Dao1 { 7 | public void insert() { 8 | System.out.println("Dao1.insert()"); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /java110-spring-ioc/src/main/java/ex11/step2/Dao2.java: -------------------------------------------------------------------------------- 1 | package ex11.step2; 2 | 3 | import org.springframework.stereotype.Component; 4 | 5 | @Component 6 | public class Dao2 { 7 | public void insert() { 8 | System.out.println("Dao2.insert()"); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /java110-spring-ioc/src/main/java/ex11/step2/Dao3.java: -------------------------------------------------------------------------------- 1 | package ex11.step2; 2 | 3 | import org.springframework.stereotype.Component; 4 | 5 | @Component 6 | public class Dao3 { 7 | public void insert() { 8 | System.out.println("Dao3.insert()"); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /java110-spring-ioc/src/main/java/ex11/step3/Dao1.java: -------------------------------------------------------------------------------- 1 | package ex11.step3; 2 | 3 | import org.springframework.stereotype.Component; 4 | 5 | @Component 6 | public class Dao1 { 7 | public void insert() { 8 | System.out.println("Dao1.insert()"); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /java110-spring-ioc/src/main/java/ex11/step3/Dao2.java: -------------------------------------------------------------------------------- 1 | package ex11.step3; 2 | 3 | import org.springframework.stereotype.Component; 4 | 5 | @Component 6 | public class Dao2 { 7 | public void insert() { 8 | System.out.println("Dao2.insert()"); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /java110-spring-ioc/src/main/java/ex11/step3/Dao3.java: -------------------------------------------------------------------------------- 1 | package ex11.step3; 2 | 3 | import org.springframework.stereotype.Component; 4 | 5 | @Component 6 | public class Dao3 { 7 | public void insert() { 8 | System.out.println("Dao3.insert()"); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /java110-spring-ioc/src/main/java/ex11/step4/Dao1.java: -------------------------------------------------------------------------------- 1 | package ex11.step4; 2 | 3 | import org.springframework.stereotype.Component; 4 | 5 | @Component 6 | public class Dao1 { 7 | public void insert() { 8 | System.out.println("Dao1.insert()"); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /java110-spring-ioc/src/main/java/ex11/step4/Dao2.java: -------------------------------------------------------------------------------- 1 | package ex11.step4; 2 | 3 | import org.springframework.stereotype.Component; 4 | 5 | @Component 6 | public class Dao2 { 7 | public void insert() { 8 | System.out.println("Dao2.insert()"); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /java110-spring-ioc/src/main/java/ex11/step4/Dao3.java: -------------------------------------------------------------------------------- 1 | package ex11.step4; 2 | 3 | import org.springframework.stereotype.Component; 4 | 5 | @Component 6 | public class Dao3 { 7 | public void insert() { 8 | System.out.println("Dao3.insert()"); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /java110-spring-ioc/src/main/java/ex11/step5/Dao1.java: -------------------------------------------------------------------------------- 1 | package ex11.step5; 2 | 3 | import org.springframework.stereotype.Component; 4 | 5 | @Component 6 | public class Dao1 { 7 | public void insert() { 8 | System.out.println("Dao1.insert()"); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /java110-spring-ioc/src/main/java/ex11/step5/Dao2.java: -------------------------------------------------------------------------------- 1 | package ex11.step5; 2 | 3 | import org.springframework.stereotype.Component; 4 | 5 | @Component 6 | public class Dao2 { 7 | public void insert() { 8 | System.out.println("Dao2.insert()"); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /java110-spring-ioc/src/main/java/ex11/step5/Dao3.java: -------------------------------------------------------------------------------- 1 | package ex11.step5; 2 | 3 | import org.springframework.stereotype.Component; 4 | 5 | @Component 6 | public class Dao3 { 7 | public void insert() { 8 | System.out.println("Dao3.insert()"); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /java110-spring-ioc/src/main/java/ex11/step6/Dao1.java: -------------------------------------------------------------------------------- 1 | package ex11.step6; 2 | 3 | import org.springframework.stereotype.Component; 4 | 5 | @Component 6 | public class Dao1 { 7 | public void insert() { 8 | System.out.println("Dao1.insert()"); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /java110-spring-ioc/src/main/java/ex11/step6/Dao2.java: -------------------------------------------------------------------------------- 1 | package ex11.step6; 2 | 3 | import org.springframework.stereotype.Component; 4 | 5 | @Component 6 | public class Dao2 { 7 | public void insert() { 8 | System.out.println("Dao2.insert()"); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /java110-spring-ioc/src/main/java/ex11/step6/Dao3.java: -------------------------------------------------------------------------------- 1 | package ex11.step6; 2 | 3 | import org.springframework.stereotype.Component; 4 | 5 | @Component 6 | public class Dao3 { 7 | public void insert() { 8 | System.out.println("Dao3.insert()"); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /java110-spring-ioc/src/main/java/ex11/step7/Dao1.java: -------------------------------------------------------------------------------- 1 | package ex11.step7; 2 | 3 | import org.springframework.stereotype.Component; 4 | 5 | @Component 6 | public class Dao1 { 7 | public void insert() { 8 | System.out.println("Dao1.insert()"); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /java110-spring-ioc/src/main/java/ex11/step7/Dao2.java: -------------------------------------------------------------------------------- 1 | package ex11.step7; 2 | 3 | import org.springframework.stereotype.Component; 4 | 5 | @Component 6 | public class Dao2 { 7 | public void insert() { 8 | System.out.println("Dao2.insert()"); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /java110-spring-ioc/src/main/java/ex11/step7/Dao3.java: -------------------------------------------------------------------------------- 1 | package ex11.step7; 2 | 3 | import org.springframework.stereotype.Component; 4 | 5 | @Component 6 | public class Dao3 { 7 | public void insert() { 8 | System.out.println("Dao3.insert()"); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /java110-spring-ioc/src/main/java/ex11/step8/Dao1.java: -------------------------------------------------------------------------------- 1 | package ex11.step8; 2 | 3 | import org.springframework.stereotype.Component; 4 | 5 | @Component 6 | public class Dao1 { 7 | public void insert() { 8 | System.out.println("Dao1.insert()"); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /java110-spring-ioc/src/main/java/ex11/step8/Dao2.java: -------------------------------------------------------------------------------- 1 | package ex11.step8; 2 | 3 | import org.springframework.stereotype.Component; 4 | 5 | @Component 6 | public class Dao2 { 7 | public void insert() { 8 | System.out.println("Dao2.insert()"); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /java110-spring-ioc/src/main/java/ex11/step8/Dao3.java: -------------------------------------------------------------------------------- 1 | package ex11.step8; 2 | 3 | import org.springframework.stereotype.Component; 4 | 5 | @Component 6 | public class Dao3 { 7 | public void insert() { 8 | System.out.println("Dao3.insert()"); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /java110-spring-ioc/src/main/java/ex11/step1/AppConfig.java: -------------------------------------------------------------------------------- 1 | package ex11.step1; 2 | 3 | import org.springframework.context.annotation.ComponentScan; 4 | 5 | @ComponentScan("ex11.step1") 6 | public class AppConfig { 7 | } 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /java110-db/build.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * This file was generated by the Gradle 'init' task. 3 | * 4 | * This is a general purpose Gradle build. 5 | * Learn how to create Gradle builds at https://guides.gradle.org/creating-new-gradle-builds/ 6 | */ 7 | plugins { 8 | id 'eclipse' 9 | } 10 | -------------------------------------------------------------------------------- /java110-servlet/src/main/webapp/ex06/hello.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" 2 | pageEncoding="UTF-8"%> 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |

hello.jsp

11 | 12 | -------------------------------------------------------------------------------- /java110-servlet/src/main/webapp/ex06/index.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" 2 | pageEncoding="UTF-8"%> 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |

index.jsp

11 | 12 | -------------------------------------------------------------------------------- /java110-spring-ioc/src/main/java/ex01/Test02.java: -------------------------------------------------------------------------------- 1 | // 객체 생성하기 : factory method 패턴 적용 2 | package ex01; 3 | 4 | public class Test02 { 5 | 6 | public static void main(String[] args) { 7 | Car c1 = CarFactory1.create("그랜저"); 8 | 9 | System.out.println(c1); 10 | } 11 | 12 | } 13 | -------------------------------------------------------------------------------- /java110-spring-ioc/src/main/java/ex11/step3/Service.java: -------------------------------------------------------------------------------- 1 | package ex11.step3; 2 | 3 | public interface Service { 4 | void add(); 5 | void update(); 6 | void delete(); 7 | void list(); 8 | void addPhoto(); 9 | } 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /java110-spring-ioc/src/main/java/ex11/step4/Service.java: -------------------------------------------------------------------------------- 1 | package ex11.step4; 2 | 3 | public interface Service { 4 | void add(); 5 | void update(); 6 | void delete(); 7 | void list(); 8 | void addPhoto(); 9 | } 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /java110-spring-webmvc/src/main/java/ex01/AppConfig.java: -------------------------------------------------------------------------------- 1 | package ex01; 2 | 3 | import org.springframework.context.annotation.ComponentScan; 4 | import org.springframework.web.servlet.config.annotation.EnableWebMvc; 5 | 6 | @ComponentScan("ex01") 7 | @EnableWebMvc 8 | public class AppConfig { 9 | 10 | } 11 | -------------------------------------------------------------------------------- /java110-spring-ioc/README.md: -------------------------------------------------------------------------------- 1 | # Spring IoC 컨테이너 사용법 2 | 3 | ## 스프링 IoC 프로젝트 준비 4 | - 프로젝트 폴더 준비 5 | - 'gradle init --type java-application' 실행 6 | - Spring IoC 컨테이너 라이브러리 추가 7 | - mvnrepository.com에서 'spring-context' 검색 8 | - build.gradle 에 추가 9 | - 'gradle eclipse' 실행 10 | - 이클립스로 프로젝트 import 하기 11 | -------------------------------------------------------------------------------- /java110-spring-ioc/src/main/java/ex11/step5/Service.java: -------------------------------------------------------------------------------- 1 | package ex11.step5; 2 | 3 | public interface Service { 4 | void add(); 5 | void update(); 6 | void delete(); 7 | void list(); 8 | int addPhoto(String filename); 9 | } 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /java110-spring-ioc/src/main/java/ex11/step6/Service.java: -------------------------------------------------------------------------------- 1 | package ex11.step6; 2 | 3 | public interface Service { 4 | void add(); 5 | void update(); 6 | void delete(); 7 | void list(); 8 | int addPhoto(String filename); 9 | } 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /java110-spring-ioc/src/main/java/ex11/step7/Service.java: -------------------------------------------------------------------------------- 1 | package ex11.step7; 2 | 3 | public interface Service { 4 | void add(); 5 | void update(); 6 | void delete(); 7 | void list(); 8 | int addPhoto(String filename); 9 | } 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /java110-spring-ioc/src/main/java/ex11/step8/Service.java: -------------------------------------------------------------------------------- 1 | package ex11.step8; 2 | 3 | public interface Service { 4 | void add(); 5 | void update(); 6 | void delete(); 7 | void list(); 8 | int addPhoto(String filename); 9 | } 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /java110-servlet/src/main/webapp/test.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" 2 | contentType="text/html; charset=UTF-8" 3 | pageEncoding="UTF-8"%> 4 | 5 | 6 | 7 | 8 | Welcome! 9 | 10 | 11 |

아~ 나도 백두산에 가고 싶다!

12 | 13 | -------------------------------------------------------------------------------- /java110-spring-ioc/src/main/java/ex01/Test01.java: -------------------------------------------------------------------------------- 1 | // 객체 생성하기 : new 명령 사용 2 | package ex01; 3 | 4 | public class Test01 { 5 | 6 | public static void main(String[] args) { 7 | Car c1 = new Car(); 8 | c1.setModel("티코"); 9 | c1.setCc(800); 10 | 11 | System.out.println(c1); 12 | } 13 | 14 | } 15 | -------------------------------------------------------------------------------- /java110-spring-webmvc/src/main/webapp/facebook/login08.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" 2 | contentType="text/html; charset=UTF-8" 3 | pageEncoding="UTF-8"%> 4 | 5 | 6 | 7 | 8 | Insert title here 9 | 10 | 11 | ${param.accessToken} 12 | 13 | -------------------------------------------------------------------------------- /java110-spring-ioc/src/main/java/ex11/step8/AppConfig.java: -------------------------------------------------------------------------------- 1 | package ex11.step8; 2 | 3 | import org.springframework.context.annotation.ComponentScan; 4 | import org.springframework.context.annotation.EnableAspectJAutoProxy; 5 | 6 | @ComponentScan(basePackages="ex11.step8") 7 | @EnableAspectJAutoProxy 8 | public class AppConfig { 9 | 10 | } 11 | -------------------------------------------------------------------------------- /java110-project/src/main/java/bitcamp/java110/cms/service/AuthService.java: -------------------------------------------------------------------------------- 1 | package bitcamp.java110.cms.service; 2 | 3 | import bitcamp.java110.cms.domain.Member; 4 | 5 | public interface AuthService { 6 | Member getMember(String email, String password, String memberType); 7 | Member getFacebookMember(String accessToken, String memberType); 8 | } 9 | -------------------------------------------------------------------------------- /java110-spring-webmvc/src/main/webapp/facebook/test01.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Insert title here 6 | 7 | 8 |

페이스북 Graph API 사용

9 |
10 | 1. 앱 등록
11 | - http://developers.facebook.com
12 | 2. 페이스북 로그인 API를 사용하기 위해 추가 및 설정한다.
13 | 
14 | 15 | -------------------------------------------------------------------------------- /java110-spring-ioc/src/main/java/ex01/Test03.java: -------------------------------------------------------------------------------- 1 | // 객체 생성하기 : factory method 패턴 적용 2 | package ex01; 3 | 4 | public class Test03 { 5 | 6 | public static void main(String[] args) { 7 | CarFactory2 f = new CarFactory2(); 8 | 9 | Car c1 = f.create("소나타"); 10 | 11 | System.out.println(c1); 12 | } 13 | 14 | } 15 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | .vscode/ 3 | .gradle/ 4 | .settings/ 5 | bin/ 6 | build/ 7 | temp/ 8 | Debug/ 9 | Release/ 10 | 11 | .DS_Store 12 | .classpath 13 | .project 14 | *.class 15 | *.log 16 | *.ctxt 17 | .mtj.tmp/ 18 | *.jar 19 | *.war 20 | *.ear 21 | *.zip 22 | *.tar.gz 23 | *.rar 24 | hs_err_pid* 25 | **/sec.properties 26 | 27 | !build.gradle 28 | -------------------------------------------------------------------------------- /java110-servlet/src/main/java/bitcamp/java110/ex13/Inventory.java: -------------------------------------------------------------------------------- 1 | package bitcamp.java110.ex13; 2 | 3 | import bitcamp.java110.Member; 4 | 5 | public class Inventory { 6 | Member member; 7 | 8 | public Member getMember() { 9 | return member; 10 | } 11 | 12 | public void setMember(Member member) { 13 | this.member = member; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /java110-spring-webmvc/src/main/webapp/ex02/Test15.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" 2 | pageEncoding="UTF-8"%> 3 | 4 | 5 | 6 | 7 | Insert title here 8 | 9 | 10 |

Test15 페이지 컨트롤러

11 | 12 | name: ${name}
13 | day: ${day}
14 | 15 | -------------------------------------------------------------------------------- /java110-project/src/main/webapp/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "webapp", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "author": "", 10 | "license": "ISC", 11 | "dependencies": { 12 | "handlebars": "^4.0.12", 13 | "jquery": "^3.3.1" 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /java110-spring-webmvc/src/main/webapp/WEB-INF/jsp/ex03/test29/m1.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" 2 | pageEncoding="UTF-8"%> 3 | 4 | 5 | 6 | 7 | Insert title here 8 | 9 | 10 | 11 |

Test29.m1()

12 | 13 | 14 | 15 | <% System.out.println("m1.jsp..."); %> -------------------------------------------------------------------------------- /java110-spring-webmvc/src/main/webapp/WEB-INF/jsp/ex03/test29/m2.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" 2 | pageEncoding="UTF-8"%> 3 | 4 | 5 | 6 | 7 | Insert title here 8 | 9 | 10 | 11 |

Test29.m2()

12 | 13 | 14 | 15 | <% System.out.println("m2.jsp..."); %> -------------------------------------------------------------------------------- /java110-project/src/main/java/bitcamp/java110/cms/service/ManagerService.java: -------------------------------------------------------------------------------- 1 | package bitcamp.java110.cms.service; 2 | 3 | import java.util.List; 4 | 5 | import bitcamp.java110.cms.domain.Manager; 6 | 7 | public interface ManagerService { 8 | void add(Manager manager); 9 | List list(int pageNo, int pageSize); 10 | Manager get(int no); 11 | void delete(int no); 12 | } 13 | -------------------------------------------------------------------------------- /java110-project/src/main/java/bitcamp/java110/cms/service/StudentService.java: -------------------------------------------------------------------------------- 1 | package bitcamp.java110.cms.service; 2 | 3 | import java.util.List; 4 | 5 | import bitcamp.java110.cms.domain.Student; 6 | 7 | public interface StudentService { 8 | void add(Student student); 9 | List list(int pageNo, int pageSize); 10 | Student get(int no); 11 | void delete(int no); 12 | } 13 | -------------------------------------------------------------------------------- /java110-project/src/main/java/bitcamp/java110/cms/service/TeacherService.java: -------------------------------------------------------------------------------- 1 | package bitcamp.java110.cms.service; 2 | 3 | import java.util.List; 4 | 5 | import bitcamp.java110.cms.domain.Teacher; 6 | 7 | public interface TeacherService { 8 | void add(Teacher teacher); 9 | List list(int pageNo, int pageSize); 10 | Teacher get(int no); 11 | void delete(int no); 12 | } 13 | -------------------------------------------------------------------------------- /java110-servlet/src/main/webapp/jsp/ex09_1.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" 2 | pageEncoding="UTF-8" 3 | trimDirectiveWhitespaces="true"%> 4 |

ex09_1 내용

5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /java110-servlet/src/main/webapp/jsp/ex09_2.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" 2 | pageEncoding="UTF-8" 3 | trimDirectiveWhitespaces="true"%> 4 |

ex09_2 내용

5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /java110-servlet/src/main/webapp/jsp/ex14_header.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" 2 | pageEncoding="UTF-8" 3 | trimDirectiveWhitespaces="true"%> 4 |

제목입니다.

5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /java110-spring-webmvc/src/main/webapp/WEB-INF/jsp/ex03/test29/no/m4.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" 2 | pageEncoding="UTF-8"%> 3 | 4 | 5 | 6 | 7 | Insert title here 8 | 9 | 10 | 11 |

Test29.m4()

12 | 13 | 14 | 15 | <% System.out.println("m4.jsp..."); %> -------------------------------------------------------------------------------- /java110-spring-webmvc/src/main/webapp/WEB-INF/jsp/ex03/test29/ok/m3.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" 2 | pageEncoding="UTF-8"%> 3 | 4 | 5 | 6 | 7 | Insert title here 8 | 9 | 10 | 11 |

Test29.m3()

12 | 13 | 14 | 15 | <% System.out.println("m3.jsp..."); %> -------------------------------------------------------------------------------- /java110-spring-webmvc/src/main/webapp/ex02/Test02.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" 2 | pageEncoding="UTF-8"%> 3 | 4 | 5 | 6 | 7 | Insert title here 8 | 9 | 10 |

Test02 페이지 컨트롤러

11 | 12 | name: ${requestScope.name}
13 | age: ${requestScope.age}
14 | 15 | 16 | -------------------------------------------------------------------------------- /java110-spring-webmvc/src/main/webapp/ex02/Test03.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" 2 | pageEncoding="UTF-8"%> 3 | 4 | 5 | 6 | 7 | Insert title here 8 | 9 | 10 |

Test03 페이지 컨트롤러

11 | 12 | name: ${requestScope.name}
13 | age: ${requestScope.age}
14 | 15 | 16 | -------------------------------------------------------------------------------- /java110-spring-webmvc/src/main/webapp/ex02/Test12.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" 2 | pageEncoding="UTF-8"%> 3 | 4 | 5 | 6 | 7 | Insert title here 8 | 9 | 10 |

Test12 페이지 컨트롤러

11 | 12 | name: ${requestScope.name}
13 | age: ${requestScope.age}
14 | 15 | 16 | -------------------------------------------------------------------------------- /java110-spring-ioc/src/main/java/ex02/app-context-1.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /java110-spring-ioc/src/main/java/ex03/app-context-1.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /java110-db/settings.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * This file was generated by the Gradle 'init' task. 3 | * 4 | * The settings file is used to specify which projects to include in your build. 5 | * 6 | * Detailed information about configuring a multi-project build in Gradle can be found 7 | * in the user guide at https://docs.gradle.org/4.9/userguide/multi_project_builds.html 8 | */ 9 | 10 | rootProject.name = 'java110-db' 11 | -------------------------------------------------------------------------------- /java110-servlet/src/main/webapp/ex05/test1.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | GET/POST 요청 6 | 7 | 8 |
9 | 10 |
11 | 12 |
13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /java110-servlet/src/main/webapp/ex05/test2.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | GET/POST 요청 6 | 7 | 8 |
9 | 10 |
11 | 12 |
13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /java110-servlet/src/main/webapp/ex05/test3.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | GET/POST 요청 6 | 7 | 8 |
9 | 10 |
11 | 12 |
13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /java110-servlet/src/main/webapp/ex05/test4.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | GET/POST 요청 6 | 7 | 8 |
9 | 10 |
11 | 12 |
13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /java110-servlet/src/main/webapp/jsp/ex14_footer.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" 2 | pageEncoding="UTF-8" 3 | trimDirectiveWhitespaces="true"%> 4 |
©비트캠프, 서울시 서초구
5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /java110-spring-ioc/src/main/java/ex03/app-context-3.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /java110-mybatis/settings.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * This file was generated by the Gradle 'init' task. 3 | * 4 | * The settings file is used to specify which projects to include in your build. 5 | * 6 | * Detailed information about configuring a multi-project build in Gradle can be found 7 | * in the user guide at https://docs.gradle.org/4.9/userguide/multi_project_builds.html 8 | */ 9 | 10 | rootProject.name = 'java110-mybatis' 11 | -------------------------------------------------------------------------------- /java110-project/settings.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * This file was generated by the Gradle 'init' task. 3 | * 4 | * The settings file is used to specify which projects to include in your build. 5 | * 6 | * Detailed information about configuring a multi-project build in Gradle can be found 7 | * in the user guide at https://docs.gradle.org/4.10/userguide/multi_project_builds.html 8 | */ 9 | 10 | rootProject.name = 'java110-project' 11 | -------------------------------------------------------------------------------- /java110-servlet/settings.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * This file was generated by the Gradle 'init' task. 3 | * 4 | * The settings file is used to specify which projects to include in your build. 5 | * 6 | * Detailed information about configuring a multi-project build in Gradle can be found 7 | * in the user guide at https://docs.gradle.org/4.9/userguide/multi_project_builds.html 8 | */ 9 | 10 | rootProject.name = 'java110-servlet' 11 | -------------------------------------------------------------------------------- /java110-spring-ioc/src/main/java/ex11/step4/MyAdvice.java: -------------------------------------------------------------------------------- 1 | package ex11.step4; 2 | 3 | // advice 클래스 4 | // - pointcut이 가리키는 메서드가 호출될 때 5 | // 그 호출 전/후에 실행될 메서드를 갖고 있는 클래스이다. 6 | // 7 | public class MyAdvice { 8 | 9 | public void advice1() { 10 | System.out.println("MyAdvice.advice1()"); 11 | } 12 | 13 | public void advice2() { 14 | System.out.println("MyAdvice.advice2()"); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /java110-spring-webmvc/src/main/webapp/WEB-INF/jsp/ex03/test23/m2.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" 2 | pageEncoding="UTF-8"%> 3 | 4 | 5 | 6 | 7 | Insert title here 8 | 9 | 10 |

Test23.m2() 테스트

11 | 12 | 모델: ${car.model}
13 | 제조사: ${car.maker}
14 | 오토기어: ${car.auto}
15 | 16 | 17 | -------------------------------------------------------------------------------- /java110-spring-ioc/settings.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * This file was generated by the Gradle 'init' task. 3 | * 4 | * The settings file is used to specify which projects to include in your build. 5 | * 6 | * Detailed information about configuring a multi-project build in Gradle can be found 7 | * in the user guide at https://docs.gradle.org/4.9/userguide/multi_project_builds.html 8 | */ 9 | 10 | rootProject.name = 'java110-spring-ioc' 11 | -------------------------------------------------------------------------------- /java110-spring-webmvc/src/main/webapp/WEB-INF/jsp/ex03/Test23.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" 2 | pageEncoding="UTF-8"%> 3 | 4 | 5 | 6 | 7 | Insert title here 8 | 9 | 10 |

Test23 페이지 컨트롤러 테스트

11 | 12 | 모델: ${car.model}
13 | 제조사: ${car.maker}
14 | 오토기어: ${car.auto}
15 | 16 | 17 | -------------------------------------------------------------------------------- /java110-spring-webmvc/settings.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * This file was generated by the Gradle 'init' task. 3 | * 4 | * The settings file is used to specify which projects to include in your build. 5 | * 6 | * Detailed information about configuring a multi-project build in Gradle can be found 7 | * in the user guide at https://docs.gradle.org/4.9/userguide/multi_project_builds.html 8 | */ 9 | 10 | rootProject.name = 'java110-spring-webmvc' 11 | -------------------------------------------------------------------------------- /java110-spring-webmvc/src/main/webapp/ex02/Test13.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" 2 | pageEncoding="UTF-8"%> 3 | 4 | 5 | 6 | 7 | Insert title here 8 | 9 | 10 |

Test13 페이지 컨트롤러

11 | 12 | name: ${requestScope.name}
13 | age: ${requestScope.age}
14 | tel: ${requestScope.tel}
15 | 16 | 17 | -------------------------------------------------------------------------------- /java110-spring-webmvc/src/main/webapp/ex02/Test15-2.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" 2 | pageEncoding="UTF-8"%> 3 | 4 | 5 | 6 | 7 | Insert title here 8 | 9 | 10 |

Test15-2 페이지 컨트롤러

11 | 12 |

Car

13 | model: ${car.model}
14 | maker: ${car.maker}
15 | auto: ${car.auto}
16 | 17 | -------------------------------------------------------------------------------- /java110-spring-webmvc/src/main/webapp/ex02/Test10.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Insert title here 6 | 7 | 8 |

Test10 페이지 컨트롤러 테스트하기

9 | 10 |

GET 요청

11 | test10 요청
12 | 13 |

POST 요청

14 |
15 | 16 |
17 | 18 | 19 | -------------------------------------------------------------------------------- /java110-project/src/main/java/bitcamp/java110/cms/domain/Manager.java: -------------------------------------------------------------------------------- 1 | package bitcamp.java110.cms.domain; 2 | 3 | public class Manager extends Member { 4 | private static final long serialVersionUID = 1L; 5 | 6 | protected String position; 7 | 8 | public String getPosition() { 9 | return position; 10 | } 11 | public void setPosition(String position) { 12 | this.position = position; 13 | } 14 | } 15 | 16 | -------------------------------------------------------------------------------- /java110-spring-webmvc/src/main/webapp/ex02/Test17.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Insert title here 6 | 7 | 8 |

Test17 페이지 컨트롤러 테스트하기

9 | 10 |

GET 요청

11 | test17 요청
12 | 13 |

POST 요청

14 |
15 | 16 |
17 | 18 | 19 | -------------------------------------------------------------------------------- /java110-spring-webmvc/src/main/webapp/WEB-INF/jsp/ex03/Test24.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" 2 | pageEncoding="UTF-8"%> 3 | 4 | 5 | 6 | 7 | Insert title here 8 | 9 | 10 |

Test24 페이지 컨트롤러 테스트

11 | 12 | 번호: ${car.no}
13 | 모델: ${car.model}
14 | 제조사: ${car.maker}
15 | 오토기어: ${car.auto}
16 | 17 | 18 | -------------------------------------------------------------------------------- /java110-servlet/src/main/java/bitcamp/java110/ex13/Inventory2.java: -------------------------------------------------------------------------------- 1 | package bitcamp.java110.ex13; 2 | 3 | import bitcamp.java110.Member; 4 | 5 | public class Inventory2 { 6 | // Member 객체를 각 Thread의 변수로 만든다. 7 | ThreadLocal myLocal = new ThreadLocal<>(); 8 | 9 | public Member getMember() { 10 | return myLocal.get(); 11 | } 12 | 13 | public void setMember(Member member) { 14 | this.myLocal.set(member); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /java110-spring-ioc/src/main/java/ex01/app-context.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /java110-spring-webmvc/src/main/webapp/WEB-INF/jsp/ex03/test26/m1.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" 2 | pageEncoding="UTF-8"%> 3 | 4 | 5 | 6 | 7 | Insert title here 8 | 9 | 10 |

Test26 - 1 페이지

11 | 12 |
13 | 이름:
14 | 15 | 16 |
17 | 18 | -------------------------------------------------------------------------------- /java110-spring-webmvc/src/main/webapp/WEB-INF/jsp/ex03/test26/m2.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" 2 | pageEncoding="UTF-8"%> 3 | 4 | 5 | 6 | 7 | Insert title here 8 | 9 | 10 |

Test26 - 2 페이지

11 | 12 |
13 | 나이:
14 | 15 | 16 |
17 | 18 | -------------------------------------------------------------------------------- /java110-spring-webmvc/src/main/webapp/WEB-INF/jsp/ex03/test26/m3.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" 2 | pageEncoding="UTF-8"%> 3 | 4 | 5 | 6 | 7 | Insert title here 8 | 9 | 10 |

Test26 - 3 페이지

11 | 12 |
13 | 강사
14 | 15 | 16 |
17 | 18 | -------------------------------------------------------------------------------- /java110-spring-webmvc/src/main/java/ex01/Test01.java: -------------------------------------------------------------------------------- 1 | // 페이지 컨트롤러 만들기 2 | // 3 | package ex01; 4 | 5 | import org.springframework.stereotype.Controller; 6 | import org.springframework.web.bind.annotation.RequestMapping; 7 | import org.springframework.web.bind.annotation.ResponseBody; 8 | 9 | @Controller 10 | public class Test01 { 11 | 12 | @RequestMapping("/ex01/hello") 13 | @ResponseBody 14 | public String hello() { 15 | return "Hello!"; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /java110-project/src/main/java/bitcamp/java110/cms/dao/ManagerDao.java: -------------------------------------------------------------------------------- 1 | package bitcamp.java110.cms.dao; 2 | 3 | import java.util.List; 4 | import java.util.Map; 5 | 6 | import bitcamp.java110.cms.domain.Manager; 7 | 8 | public interface ManagerDao { 9 | int insert(Manager manager); 10 | List findAll(Map params); 11 | Manager findByEmail(String email); 12 | Manager findByNo(int no); 13 | int delete(int no); 14 | Manager findByEmailPassword(Map params); 15 | } 16 | -------------------------------------------------------------------------------- /java110-project/src/main/java/bitcamp/java110/cms/dao/TeacherDao.java: -------------------------------------------------------------------------------- 1 | package bitcamp.java110.cms.dao; 2 | 3 | import java.util.List; 4 | import java.util.Map; 5 | 6 | import bitcamp.java110.cms.domain.Teacher; 7 | 8 | public interface TeacherDao { 9 | int insert(Teacher teacher); 10 | List findAll(Map params); 11 | Teacher findByEmail(String email); 12 | Teacher findByNo(int no); 13 | int delete(int no); 14 | Teacher findByEmailPassword(Map params); 15 | } 16 | -------------------------------------------------------------------------------- /java110-spring-webmvc/src/main/webapp/WEB-INF/jsp/ex03/test26/m6.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" 2 | pageEncoding="UTF-8"%> 3 | <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> 4 | 5 | 6 | 7 | 8 | Insert title here 9 | 10 | 11 |

Test26 - 6 페이지

12 | 13 | 입력 확인하기 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /java110-spring-webmvc/src/main/webapp/WEB-INF/jsp/ex03/test26/m8.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" 2 | pageEncoding="UTF-8"%> 3 | <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> 4 | 5 | 6 | 7 | 8 | Insert title here 9 | 10 | 11 |

Test26 - 8 페이지

12 | 13 |

14 | 세션을 무효화시켰습니다! 15 |

16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /java110-spring-webmvc/src/main/java/ex01/MyWebApplicationInitializer2.java: -------------------------------------------------------------------------------- 1 | package ex01; 2 | 3 | import javax.servlet.ServletContext; 4 | import javax.servlet.ServletException; 5 | 6 | public class MyWebApplicationInitializer2 7 | /*implements WebApplicationInitializer*/ { 8 | 9 | public void onStartup(ServletContext servletContext) throws ServletException { 10 | System.out.println("MyWebApplicationInitializer2"); 11 | 12 | } 13 | } 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /java110-spring-webmvc/src/main/java/ex01/MyWebApplicationInitializer3.java: -------------------------------------------------------------------------------- 1 | package ex01; 2 | 3 | import javax.servlet.ServletContext; 4 | import javax.servlet.ServletException; 5 | 6 | public class MyWebApplicationInitializer3 7 | /*implements WebApplicationInitializer*/ { 8 | 9 | public void onStartup(ServletContext servletContext) throws ServletException { 10 | System.out.println("MyWebApplicationInitializer3"); 11 | 12 | } 13 | } 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /java110-spring-ioc/src/main/java/ex03/app-context-4.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /java110-spring-webmvc/src/main/webapp/ex02/Test14.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" 2 | pageEncoding="UTF-8"%> 3 | 4 | 5 | 6 | 7 | Insert title here 8 | 9 | 10 |

Test14 페이지 컨트롤러

11 | 12 | [Car]
13 | model: ${car.model}
14 | maker: ${car.maker}
15 | auto: ${car.auto}
16 | 17 | [Engine]
18 | name: ${car.engine.name}
19 | cc: ${car.engine.cc}
20 | valve: ${car.engine.valve}
21 | 22 | -------------------------------------------------------------------------------- /java110-spring-ioc/src/main/java/ex02/AppConfig.java: -------------------------------------------------------------------------------- 1 | package ex02; 2 | 3 | import org.springframework.context.annotation.Bean; 4 | 5 | public class AppConfig { 6 | 7 | public AppConfig() { 8 | System.out.println("AppConfig() 호출됨!"); 9 | } 10 | 11 | @Bean // <== 빈 컨테이너에게 이 메서드를 호출해서 리턴 값을 보관하라는 명령 12 | public Car getCar() { 13 | System.out.println("getCar() 호출됨!"); 14 | Car c = new Car(); 15 | c.setModel("소나타"); 16 | c.setCc(1998); 17 | c.setMaker("현대자동차"); 18 | return c; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /java110-project/src/main/java/bitcamp/java110/cms/dao/StudentDao.java: -------------------------------------------------------------------------------- 1 | package bitcamp.java110.cms.dao; 2 | 3 | import java.util.List; 4 | import java.util.Map; 5 | 6 | import bitcamp.java110.cms.domain.Student; 7 | 8 | public interface StudentDao { 9 | int insert(Student student); 10 | List findAll(Map params); 11 | Student findByEmail(String email); 12 | Student findByNo(int no); 13 | int delete(int no); 14 | Student findByEmailPassword(Map params); 15 | } 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /java110-spring-ioc/src/main/java/ex01/app-context2.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /java110-mybatis/README.md: -------------------------------------------------------------------------------- 1 | # Mybatis persistence framework 2 | 3 | ## 라이브러리 준비 4 | - mvnrepository.com 에서 'mybatis'로 검색한다. 5 | - build.gradle에 mybatis 의존 라이브러리를 추가한다. 6 | - 콘솔에서 'gradle eclipse' 실행한다. 7 | - 이클립스에서 프로젝트를 리프래시 한다. 8 | 9 | ## mybatis 적용 10 | - SqlSessionFactory 객체 준비 11 | - 'Getting started' 문서에서 코드 발췌하여 자바 소스 파일에 둔다. 12 | - Mybatis 설정 파일 준비 13 | - 'Getting started' 문서에서 코드를 발췌한다. 14 | - mybatis-config.xml(이름 변경 가능) 설정 파일에 붙여 넣는다. 15 | - Sql 맵퍼 파일 준비 16 | - 'Getting started' 문서를 참조하여 SQL 맵퍼 파일을 만든다. 17 | - MemberDao.xml 파일 생성 18 | - Dao에 적용 19 | -------------------------------------------------------------------------------- /java110-servlet/src/main/webapp/jsp/ex02.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" 2 | contentType="text/html; charset=UTF-8" 3 | pageEncoding="UTF-8"%> 4 | 5 | 6 | 7 | 8 | JSP 9 | 10 | 11 |

템플릿 데이터(template data)

12 |
13 | - JSP 파일에 JSP 문법에 상관없이 작성하는 텍스트이다.
14 | - 자바 코드:
15 |   다음과 같은 출력문을 _jspService() 메서드 안에 만든다.
16 | 
17 |     out.write("템플릿 데이터");
18 |     out.print("템플릿 데이터");
19 |     
20 | 
21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /java110-servlet/src/main/webapp/el/ex05.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" 2 | contentType="text/html; charset=UTF-8" 3 | pageEncoding="UTF-8" 4 | trimDirectiveWhitespaces="true"%> 5 | 6 | 7 | 8 | 9 | EL 10 | 11 | 12 |

EL - 배열에서 값 꺼내기

13 | <% 14 | pageContext.setAttribute("names", new String[]{"홍길동","임꺽정","유관순"}); 15 | %> 16 | 17 | ${names[0]}
18 | ${names[1]}
19 | ${names[2]}
20 | ${names[3]}
21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /java110-spring-ioc/src/main/java/ex11/step2/ServiceImpl.java: -------------------------------------------------------------------------------- 1 | package ex11.step2; 2 | 3 | import org.springframework.beans.factory.annotation.Autowired; 4 | 5 | // 원래의 객체를 IoC 컨테이너에 등록하지 않고 6 | // 프록시 클래스의 객체를 등록할 것이다. 7 | //@Component 8 | public class ServiceImpl implements Service { 9 | 10 | @Autowired Dao1 dao1; 11 | @Autowired Dao2 dao2; 12 | @Autowired Dao3 dao3; 13 | 14 | @Override 15 | public void add() { 16 | dao1.insert(); 17 | dao2.insert(); 18 | dao3.insert(); 19 | } 20 | } 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /java110-project/src/main/java/bitcamp/java110/cms/domain/Teacher.java: -------------------------------------------------------------------------------- 1 | package bitcamp.java110.cms.domain; 2 | 3 | public class Teacher extends Member { 4 | private static final long serialVersionUID = 1L; 5 | 6 | protected int pay; 7 | protected String subjects; 8 | 9 | public int getPay() { 10 | return pay; 11 | } 12 | public void setPay(int pay) { 13 | this.pay = pay; 14 | } 15 | public String getSubjects() { 16 | return subjects; 17 | } 18 | public void setSubjects(String subjects) { 19 | this.subjects = subjects; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /java110-spring-webmvc/src/main/webapp/WEB-INF/jsp/ex03/test26/m5.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" 2 | pageEncoding="UTF-8"%> 3 | 4 | 5 | 6 | 7 | Insert title here 8 | 9 | 10 |

Test26 - 5 페이지

11 | 12 |
13 | 여성
14 | 남성
15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /java110-servlet/src/main/webapp/el/ex04.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" 2 | contentType="text/html; charset=UTF-8" 3 | pageEncoding="UTF-8" 4 | trimDirectiveWhitespaces="true"%> 5 | 6 | 7 | 8 | 9 | EL 10 | 11 | 12 |

EL - 리터럴(literal)

13 |
14 | - EL에서 문자열이나 숫자를 표현하는 방법
15 | 
16 | 17 | 문자열: ${"홍길동"}
18 | 문자열: ${'홍길동'}
19 | 정수: ${100}
20 | 부동소수점: ${3.14}
21 | 논리값: ${true}
22 | null: ${null}
23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /java110-spring-webmvc/src/main/webapp/ex02/Test20.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Insert title here 6 | 7 | 8 |

Test20 페이지 컨트롤러 테스트하기

9 | 10 |

파일 업로드

11 |
13 | 이름:
14 | 나이:
15 | 사진1:
16 | 사진2:
17 | 18 |
19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /java110-mybatis/src/main/java/ex02/MemberDaoFactory.java: -------------------------------------------------------------------------------- 1 | package ex02; 2 | 3 | public class MemberDaoFactory { 4 | 5 | DataSource dataSource; 6 | 7 | public void setDataSource(DataSource dataSource) { 8 | this.dataSource = dataSource; 9 | } 10 | 11 | // 객체를 생성해주는 메서드 12 | // => "Factory Method" 설계 패턴이다. 13 | // => 객체 생성 과정이 복잡하거나 번거로울 경우 주로 사용한다. 14 | // 15 | public MemberDao createMemberDao() throws Exception { 16 | MemberDao memberDao = new MemberDao(); 17 | memberDao.setDataSource(dataSource); 18 | 19 | return memberDao; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /java110-project/src/main/java/bitcamp/java110/cms/domain/Student.java: -------------------------------------------------------------------------------- 1 | package bitcamp.java110.cms.domain; 2 | 3 | public class Student extends Member { 4 | private static final long serialVersionUID = 1L; 5 | 6 | protected String school; 7 | protected boolean working; 8 | 9 | public String getSchool() { 10 | return school; 11 | } 12 | public void setSchool(String school) { 13 | this.school = school; 14 | } 15 | public boolean isWorking() { 16 | return working; 17 | } 18 | public void setWorking(boolean working) { 19 | this.working = working; 20 | } 21 | } -------------------------------------------------------------------------------- /java110-servlet/src/main/webapp/jsp/ex04.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" 2 | contentType="text/html; charset=UTF-8" 3 | pageEncoding="UTF-8"%> 4 | 5 | 6 | 7 | 8 | JSP 9 | 10 | 11 |

스크립트릿(scriptlet) 응용

12 | <% // _jspService() 메서드 안에 자바코드를 작성한다는 것을 절대 잊지말자! 13 | String[] names = {"홍길동", "임꺽정", "유관순"}; 14 | %> 15 | 16 |
    17 | <%for (String name : names) { %> 18 |
  • <%out.write(name);%>
  • 19 | <%} %> 20 |
21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /java110-spring-ioc/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id 'java' 3 | id 'eclipse' 4 | } 5 | 6 | dependencies { 7 | // Spring IoC 컨테이너 8 | compile group: 'org.springframework', name: 'spring-context', version: '5.1.1.RELEASE' 9 | 10 | // JSR-250 Injection 관련 애노테이션 라이브러리 11 | compile group: 'javax.annotation', name: 'javax.annotation-api', version: '1.3.2' 12 | 13 | // AOP 라이브러리 14 | compile group: 'org.aspectj', name: 'aspectjweaver', version: '1.9.2' 15 | 16 | compile 'com.google.guava:guava:23.0' 17 | testCompile 'junit:junit:4.12' 18 | } 19 | 20 | repositories { 21 | mavenCentral(); 22 | } 23 | -------------------------------------------------------------------------------- /java110-servlet/src/main/java/bitcamp/java110/ex13/Listener01.java: -------------------------------------------------------------------------------- 1 | package bitcamp.java110.ex13; 2 | 3 | import javax.servlet.ServletContextEvent; 4 | import javax.servlet.ServletContextListener; 5 | import javax.servlet.annotation.WebListener; 6 | 7 | @WebListener 8 | public class Listener01 implements ServletContextListener { 9 | @Override 10 | public void contextInitialized(ServletContextEvent sce) { 11 | // ex13 패키지의 서블릿 객체들이 사용할 Inventory를 준비한다. 12 | sce.getServletContext().setAttribute("inventory", new Inventory()); 13 | sce.getServletContext().setAttribute("inventory2", new Inventory2()); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /java110-project/src/main/webapp/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Insert title here 6 | 15 | 16 | 17 |

안녕하세요!

18 | 19 |

이 시각 주요뉴스

20 | 21 |

이 시각 주요뉴스

22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /java110-spring-webmvc/src/main/java/ex02/Test11.java: -------------------------------------------------------------------------------- 1 | // @RequestMapping 다루기 : URL 다루기 IV 2 | package ex02; 3 | 4 | import org.springframework.stereotype.Controller; 5 | import org.springframework.web.bind.annotation.RequestMapping; 6 | import org.springframework.web.bind.annotation.ResponseBody; 7 | 8 | @Controller 9 | @RequestMapping("/ex02/test11") 10 | public class Test11 { 11 | 12 | // 클래스에 URL을 지정했으면, 메서드에도 @RequestMapping을 붙여야 한다. 13 | // 14 | 15 | @RequestMapping 16 | @ResponseBody 17 | public String m1() { 18 | return "ex02.Test11.m1()"; 19 | } 20 | } 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /java110-spring-ioc/src/main/java/ex11/step5/MyAdvice.java: -------------------------------------------------------------------------------- 1 | package ex11.step5; 2 | 3 | // advice 클래스 4 | // - pointcut이 가리키는 메서드가 호출될 때 5 | // 그 호출 전/후에 실행될 메서드를 갖고 있는 클래스이다. 6 | // 7 | public class MyAdvice { 8 | 9 | public void before() { 10 | System.out.println("MyAdvice.before()"); 11 | } 12 | 13 | public void after() { 14 | System.out.println("MyAdvice.after()"); 15 | } 16 | 17 | public void afterReturning() { 18 | System.out.println("MyAdvice.afterReturning()"); 19 | } 20 | 21 | public void afterThrowing() { 22 | System.out.println("MyAdvice.afterThrowing()"); 23 | } 24 | 25 | 26 | } 27 | -------------------------------------------------------------------------------- /java110-servlet/src/main/webapp/jsp/ex05.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" 2 | contentType="text/html; charset=UTF-8" 3 | pageEncoding="UTF-8"%> 4 | 5 | 6 | 7 | 8 | JSP 9 | 10 | 11 |

표현식(Expression Element)

12 |
13 | - 실행 결과를 출력할 때 사용한다.
14 |     <%= 표현식 %> 
15 | - 자바코드:
16 |     표현식 안에 작성한 코드가 출력문의 파라미터로 복사된다.
17 |     out.print(표현식)
18 | - 표현식(express)?
19 |     어떤 결과를 리턴하는 코드이다.
20 | 
21 |

100 + 200 = <% out.print(100 + 200); %>

22 |

100 + 200 = <%= 100 + 200%>

23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /java110-mybatis/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id 'java' 3 | id 'eclipse' 4 | } 5 | 6 | tasks.withType(JavaCompile) { 7 | options.encoding = 'UTF-8' 8 | sourceCompatibility = '1.8' 9 | targetCompatibility = '1.8' 10 | } 11 | 12 | dependencies { 13 | // mariadb jdbc driver 14 | compile group: 'org.mariadb.jdbc', name: 'mariadb-java-client', version: '2.3.0' 15 | 16 | // mybatis 라이브러리 17 | compile group: 'org.mybatis', name: 'mybatis', version: '3.4.6' 18 | 19 | compile 'com.google.guava:guava:23.0' 20 | testCompile 'junit:junit:4.12' 21 | } 22 | 23 | repositories { 24 | mavenCentral() //https://repo.maven.apache.org/maven2/ 25 | } 26 | -------------------------------------------------------------------------------- /java110-spring-ioc/src/main/java/ex01/app-context3.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /java110-spring-webmvc/src/main/webapp/facebook/login09.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" 2 | contentType="text/html; charset=UTF-8" 3 | pageEncoding="UTF-8"%> 4 | <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | Insert title here 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /java110-db/mariadb-setting.txt: -------------------------------------------------------------------------------- 1 | CREATE DATABASE projectdb 2 | CHARACTER SET utf8 3 | COLLATE utf8_general_ci; 4 | 5 | CREATE USER 'project'@'localhost' IDENTIFIED BY '1111'; 6 | CREATE USER 'project'@'%' IDENTIFIED BY '1111'; 7 | 8 | GRANT ALL ON projectdb.* TO 'project'@'localhost'; 9 | GRANT ALL ON projectdb.* TO 'project'@'%'; 10 | 11 | 12 | 13 | 14 | 15 | 16 | CREATE DATABASE studydb 17 | CHARACTER SET utf8 18 | COLLATE utf8_general_ci; 19 | 20 | CREATE USER 'study'@'localhost' IDENTIFIED BY '1111'; 21 | CREATE USER 'study'@'%' IDENTIFIED BY '1111'; 22 | 23 | GRANT ALL ON studydb.* TO 'study'@'localhost'; 24 | GRANT ALL ON studydb.* TO 'study'@'%'; 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /java110-spring-ioc/src/main/java/ex11/step2/ServiceProxy.java: -------------------------------------------------------------------------------- 1 | package ex11.step2; 2 | 3 | public class ServiceProxy implements Service { 4 | 5 | Service original; 6 | 7 | public ServiceProxy(Service original) { 8 | this.original = original; 9 | } 10 | 11 | @Override 12 | public void add() { 13 | // step1에서는 add() 메서드 앞/뒤에 직접 코드를 삽입하였다. 14 | // step2에서는 다음과 같이 프록시 클래스에 코드를 삽입한다. 15 | System.out.println("ServiceProxy: Service.add() 호출 전에 해야할 일!"); 16 | 17 | // 즉 다음과 같이 원래의 클래스는 손대지 않는다. 18 | original.add(); 19 | 20 | System.out.println("ServiceProxy: Service.add() 호출 후에 해야할 일!"); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /java110-spring-webmvc/src/main/webapp/ex02/Test03.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Insert title here 6 | 7 | 8 |

Test03 페이지 컨트롤러 테스트하기

9 | 10 |

GET 요청

11 | test03/m1 요청
12 |
13 | 14 |
15 | test03/m2 요청
16 | 17 |

POST 요청

18 |
19 | 20 |
21 |
22 | 23 |
24 | 25 | 26 | -------------------------------------------------------------------------------- /java110-mybatis/src/main/java/ex08/AttachFile.java: -------------------------------------------------------------------------------- 1 | package ex08; 2 | 3 | public class AttachFile { 4 | protected int no; 5 | protected String filename; 6 | protected int boardNo; 7 | 8 | public int getNo() { 9 | return no; 10 | } 11 | public void setNo(int no) { 12 | this.no = no; 13 | } 14 | public String getFilename() { 15 | return filename; 16 | } 17 | public void setFilename(String filename) { 18 | this.filename = filename; 19 | } 20 | public int getBoardNo() { 21 | return boardNo; 22 | } 23 | public void setBoardNo(int boardNo) { 24 | this.boardNo = boardNo; 25 | } 26 | 27 | 28 | } 29 | -------------------------------------------------------------------------------- /java110-project/src/main/resources/bitcamp/java110/cms/mapper/PhotoDao.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | 8 | 9 | insert into p1_memb_phot(mno,photo) 10 | values(#{no},#{photo}) 11 | 12 | 13 | 14 | delete from p1_memb_phot 15 | where mno=#{value} 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /java110-servlet/src/main/webapp/jsp/ex15_error.jsp: -------------------------------------------------------------------------------- 1 | <%@page import="java.util.ArrayList"%> 2 | <%@ page language="java" 3 | contentType="text/html; charset=UTF-8" 4 | pageEncoding="UTF-8" 5 | trimDirectiveWhitespaces="true" 6 | isErrorPage="true"%> 7 | 8 | 9 | 10 | 11 | JSP액션태그 12 | 13 | 14 | 15 |

연산자 '<%=request.getParameter("op")%>'를 지원하지 않습니다!

16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /java110-spring-ioc/src/main/java/ex01/Test04.java: -------------------------------------------------------------------------------- 1 | // 객체 생성하기 : Spring IoC 컨테이너 사용 2 | package ex01; 3 | 4 | import org.springframework.context.support.ClassPathXmlApplicationContext; 5 | 6 | public class Test04 { 7 | 8 | public static void main(String[] args) { 9 | 10 | // 객체의 생성, 소멸과 의존객체 주입을 관리하는 11 | // bean container(=IoC 컨테이너) 생성하기 12 | ClassPathXmlApplicationContext iocContainer = 13 | new ClassPathXmlApplicationContext("ex01/app-context.xml"); 14 | 15 | // IoC 컨테이너에서 객체 꺼내기 16 | Car obj = (Car)iocContainer.getBean("c1"); 17 | 18 | System.out.println(obj); 19 | 20 | iocContainer.close(); 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /java110-spring-ioc/src/main/java/ex01/Test05.java: -------------------------------------------------------------------------------- 1 | // 객체 생성하기 : Spring IoC 컨테이너 사용 II 2 | package ex01; 3 | 4 | import org.springframework.context.support.ClassPathXmlApplicationContext; 5 | 6 | public class Test05 { 7 | 8 | public static void main(String[] args) { 9 | 10 | // 객체의 생성, 소멸과 의존객체 주입을 관리하는 11 | // bean container(=IoC 컨테이너) 생성하기 12 | ClassPathXmlApplicationContext iocContainer = 13 | new ClassPathXmlApplicationContext("ex01/app-context2.xml"); 14 | 15 | // IoC 컨테이너에서 객체 꺼내기 16 | Car obj = (Car)iocContainer.getBean("c1"); 17 | 18 | System.out.println(obj); 19 | 20 | iocContainer.close(); 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /java110-spring-ioc/src/main/java/ex01/Test06.java: -------------------------------------------------------------------------------- 1 | // 객체 생성하기 : Spring IoC 컨테이너 사용 III 2 | package ex01; 3 | 4 | import org.springframework.context.support.ClassPathXmlApplicationContext; 5 | 6 | public class Test06 { 7 | 8 | public static void main(String[] args) { 9 | 10 | // 객체의 생성, 소멸과 의존객체 주입을 관리하는 11 | // bean container(=IoC 컨테이너) 생성하기 12 | ClassPathXmlApplicationContext iocContainer = 13 | new ClassPathXmlApplicationContext("ex01/app-context3.xml"); 14 | 15 | // IoC 컨테이너에서 객체 꺼내기 16 | Car obj = (Car)iocContainer.getBean("c1"); 17 | 18 | System.out.println(obj); 19 | 20 | iocContainer.close(); 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /java110-spring-ioc/src/main/java/ex09/app-context-1.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /java110-spring-ioc/src/main/java/ex09/app-context-2.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /java110-servlet/src/main/webapp/el/ex07.jsp: -------------------------------------------------------------------------------- 1 | <%@page import="java.util.HashMap"%> 2 | <%@ page language="java" 3 | contentType="text/html; charset=UTF-8" 4 | pageEncoding="UTF-8" 5 | trimDirectiveWhitespaces="true"%> 6 | 7 | 8 | 9 | 10 | EL 11 | 12 | 13 |

EL - Map 객체에서 값 꺼내기

14 | <% 15 | HashMap map = new HashMap<>(); 16 | map.put("s01", "김구"); 17 | map.put("s02", "안중근"); 18 | map.put("s03", "윤봉길"); 19 | 20 | pageContext.setAttribute("map", map); 21 | %> 22 | 23 | ${map["s01"]}
24 | ${map['s01']}
25 | ${map.s01}
26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /java110-servlet/src/main/webapp/jsp/ex09.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" 2 | contentType="text/html; charset=UTF-8" 3 | pageEncoding="UTF-8" 4 | trimDirectiveWhitespaces="true"%> 5 | 6 | 7 | 8 | 9 | JSP 10 | 11 | 12 |

RequestDispatcher의 including vs include 지시명령

13 | 14 | 15 | 16 |
17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | -------------------------------------------------------------------------------- /java110-mybatis/src/main/java/ex02/Test01.java: -------------------------------------------------------------------------------- 1 | // 주제: factory method 및 builder 디자인 패턴 적용 2 | package ex02; 3 | 4 | import java.util.List; 5 | 6 | public class Test01 { 7 | 8 | public static void main(String[] args) throws Exception { 9 | MemberDaoFactory factory = new DaoBuilder().build(); 10 | MemberDao memberDao = factory.createMemberDao(); 11 | 12 | List list = memberDao.findAll(); 13 | 14 | for (Member m : list) { 15 | System.out.printf("%d, %s, %s, %s\n", 16 | m.getNo(), m.getName(), m.getEmail(), m.getTel()); 17 | } 18 | 19 | 20 | 21 | } 22 | 23 | } 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /java110-spring-ioc/src/main/java/ex11/step2/AppConfig.java: -------------------------------------------------------------------------------- 1 | package ex11.step2; 2 | 3 | import org.springframework.context.annotation.Bean; 4 | import org.springframework.context.annotation.ComponentScan; 5 | 6 | @ComponentScan("ex11.step2") 7 | public class AppConfig { 8 | 9 | // IoC 컨테이너가 관리하는 객체라면 다음과 같이 10 | // 파라미터로 달라고 요청하면 IoC 컨테이너가 메서드를 호출할 때 11 | // 넘겨줄 것이다. 12 | @Bean 13 | public Service service(Dao1 dao1, Dao2 dao2, Dao3 dao3) { 14 | ServiceImpl worker = new ServiceImpl(); 15 | worker.dao1 = dao1; 16 | worker.dao2 = dao2; 17 | worker.dao3 = dao3; 18 | 19 | return new ServiceProxy(worker); 20 | } 21 | } 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /java110-mybatis/src/main/java/ex01/DaoException.java: -------------------------------------------------------------------------------- 1 | package ex01; 2 | 3 | public class DaoException extends RuntimeException { 4 | private static final long serialVersionUID = 1L; 5 | 6 | public DaoException() { 7 | super(); 8 | } 9 | 10 | public DaoException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) { 11 | super(message, cause, enableSuppression, writableStackTrace); 12 | } 13 | 14 | public DaoException(String message, Throwable cause) { 15 | super(message, cause); 16 | } 17 | 18 | public DaoException(String message) { 19 | super(message); 20 | } 21 | 22 | public DaoException(Throwable cause) { 23 | super(cause); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /java110-mybatis/src/main/java/ex02/DaoException.java: -------------------------------------------------------------------------------- 1 | package ex02; 2 | 3 | public class DaoException extends RuntimeException { 4 | private static final long serialVersionUID = 1L; 5 | 6 | public DaoException() { 7 | super(); 8 | } 9 | 10 | public DaoException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) { 11 | super(message, cause, enableSuppression, writableStackTrace); 12 | } 13 | 14 | public DaoException(String message, Throwable cause) { 15 | super(message, cause); 16 | } 17 | 18 | public DaoException(String message) { 19 | super(message); 20 | } 21 | 22 | public DaoException(Throwable cause) { 23 | super(cause); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /java110-servlet/src/main/webapp/jsp/ex03.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" 2 | contentType="text/html; charset=UTF-8" 3 | pageEncoding="UTF-8"%> 4 | 5 | 6 | <% // 스크립트릿: 자바 코드를 두는 태그 7 | int a; 8 | %> 9 | 10 | 11 | JSP 12 | 13 | 14 | <% 15 | a = 100; 16 | int b = a++; 17 | %> 18 |

스크립트릿(scriptlet)

19 |
20 | - JSP 파일에 안에 작성하는 자바 코드이다.
21 |     <% 자바코드 %>
22 | - 자바 코드:
23 |   스크립트릿 태그 안에 작성한 자바 코드는 _jspService() 안에 순서 그대로 복사된다. 
24 |     
25 | 
26 | 27 | <% 28 | out.println("

a = " + a + "

"); 29 | out.println("

b = " + b + "

"); 30 | %> 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /java110-spring-ioc/src/main/java/ex11/step1/Service.java: -------------------------------------------------------------------------------- 1 | package ex11.step1; 2 | 3 | import org.springframework.beans.factory.annotation.Autowired; 4 | import org.springframework.stereotype.Component; 5 | 6 | @Component 7 | public class Service { 8 | 9 | @Autowired Dao1 dao1; 10 | @Autowired Dao2 dao2; 11 | @Autowired Dao3 dao3; 12 | 13 | 14 | public void add() { 15 | // 메서드가 호출되기 전/후에 실행될 코드는 16 | // 다음과 같이 직접 삽입해야 한다. 17 | 18 | System.out.println("Service.add() 호출 전에 해야할 일!"); 19 | dao1.insert(); 20 | dao2.insert(); 21 | dao3.insert(); 22 | System.out.println("Service.add() 호출 후에 해야할 일!"); 23 | } 24 | } 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /java110-spring-webmvc/src/main/webapp/WEB-INF/jsp/ex03/test26/m4.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" 2 | pageEncoding="UTF-8"%> 3 | 4 | 5 | 6 | 7 | Insert title here 8 | 9 | 10 |

Test26 - 4 페이지

11 | 12 |
13 | Java
14 | C/C++
15 | SQL
16 | Python
17 | JavaScript
18 | 19 | 20 |
21 | 22 | -------------------------------------------------------------------------------- /java110-spring-ioc/src/main/java/ex05/app-context-5.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /java110-spring-webmvc/src/main/java/ex02/Test08.java: -------------------------------------------------------------------------------- 1 | // @RequestMapping 다루기 : URL 다루기 I 2 | package ex02; 3 | 4 | import org.springframework.stereotype.Controller; 5 | import org.springframework.web.bind.annotation.RequestMapping; 6 | import org.springframework.web.bind.annotation.ResponseBody; 7 | 8 | @Controller 9 | public class Test08 { 10 | 11 | // 각 메서드에 URL을 지정하기 12 | 13 | @RequestMapping(value="/ex02/test08/m1") 14 | @ResponseBody 15 | public String m1() { 16 | return "ex02.Test08.m1()"; 17 | } 18 | 19 | @RequestMapping(value="/ex02/test08/m2") 20 | @ResponseBody 21 | public String m2() { 22 | return "ex02.Test08.m2()"; 23 | } 24 | 25 | 26 | } 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /java110-spring-webmvc/src/main/java/ex02/Test09.java: -------------------------------------------------------------------------------- 1 | // @RequestMapping 다루기 : URL 다루기 II 2 | package ex02; 3 | 4 | import org.springframework.stereotype.Controller; 5 | import org.springframework.web.bind.annotation.RequestMapping; 6 | import org.springframework.web.bind.annotation.ResponseBody; 7 | 8 | @Controller 9 | @RequestMapping("/ex02/test09") 10 | public class Test09 { 11 | 12 | // 공통 URL은 클래스에 선언한다. 13 | 14 | @RequestMapping("m1") 15 | @ResponseBody 16 | public String m1() { 17 | return "ex02.Test09.m1()"; 18 | } 19 | 20 | @RequestMapping("m2") 21 | @ResponseBody 22 | public String m2() { 23 | return "ex02.Test09.m2()"; 24 | } 25 | 26 | 27 | } 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /java110-spring-webmvc/src/main/webapp/WEB-INF/jsp/ex03/test26/m7.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" 2 | pageEncoding="UTF-8"%> 3 | <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> 4 | 5 | 6 | 7 | 8 | Insert title here 9 | 10 | 11 |

Test26 - 7 페이지

12 | 13 | 이름: ${sessionScope.name}
14 | 나이: ${sessionScope.age}
15 | 강사여부: ${sessionScope.teacher}
16 | 과목: 17 | 18 | ${lang}, 19 | 20 |
21 | 성별: ${sessionScope.gender}
22 | 23 |

24 | 세션 무효화시키기 25 |

26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /java110-servlet/src/main/webapp/jstl/ex02.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" 2 | contentType="text/html; charset=UTF-8" 3 | pageEncoding="UTF-8" 4 | trimDirectiveWhitespaces="true"%> 5 | <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> 6 | 7 | 8 | 9 | 10 | JSTL 11 | 12 | 13 |

JSTL - c:out

14 |
15 | - 출력문을 만드는 태그이다.
16 |   <c:out value="출력될 값" default="기본 값"/>
17 |   <c:out value="출력될 값>기본값<c:out>
18 | 
19 | 20 |
21 |
22 | 홍길동
23 |
24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /java110-servlet/src/main/webapp/el/ex02.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" 2 | contentType="text/html; charset=UTF-8" 3 | pageEncoding="UTF-8" 4 | trimDirectiveWhitespaces="true"%> 5 | 6 | 7 | 8 | 9 | EL 10 | 11 | 12 |

EL - 보관소에 값 꺼내기

13 | <% 14 | pageContext.setAttribute("name", "홍길동"); 15 | request.setAttribute("name", "임꺽정"); 16 | session.setAttribute("name", "유관순"); 17 | application.setAttribute("name", "안중근"); 18 | %> 19 | 20 | PageContext 보관소 : ${pageScope.name}
21 | ServletRequest 보관소 : ${requestScope.name}
22 | HttpSession 보관소 : ${sessionScope.name}
23 | ServletContext 보관소 : ${applicationScope.name}
24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /java110-spring-webmvc/src/main/java/ex02/Tire.java: -------------------------------------------------------------------------------- 1 | package ex02; 2 | 3 | public class Tire { 4 | String name; 5 | int radius; 6 | 7 | @Override 8 | public String toString() { 9 | return "Tire [name=" + name + ", radius=" + radius + "]"; 10 | } 11 | 12 | public Tire() {} 13 | 14 | public Tire(String name, int radius) { 15 | super(); 16 | this.name = name; 17 | this.radius = radius; 18 | } 19 | 20 | public String getName() { 21 | return name; 22 | } 23 | public void setName(String name) { 24 | this.name = name; 25 | } 26 | public int getRadius() { 27 | return radius; 28 | } 29 | public void setRadius(int radius) { 30 | this.radius = radius; 31 | } 32 | 33 | 34 | } 35 | -------------------------------------------------------------------------------- /java110-servlet/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'java' 2 | apply plugin: 'eclipse-wtp' 3 | apply plugin: 'war' 4 | 5 | tasks.withType(JavaCompile) { 6 | options.encoding = 'UTF-8' 7 | sourceCompatibility = '1.8' 8 | targetCompatibility = '1.8' 9 | } 10 | 11 | dependencies { 12 | // Servlet API 라이브러리 13 | providedCompile group: 'javax.servlet', name: 'javax.servlet-api', version: '4.0.1' 14 | 15 | // JSTL 구현 라이브러리 16 | compile group: 'javax.servlet', name: 'jstl', version: '1.2' 17 | 18 | // File Upload 처리 라이브러리 19 | compile group: 'commons-fileupload', name: 'commons-fileupload', version: '1.3.3' 20 | 21 | compile 'com.google.guava:guava:23.0' 22 | testCompile 'junit:junit:4.12' 23 | } 24 | 25 | repositories { 26 | mavenCentral() //https://repo.maven.apache.org/maven2/ 27 | } -------------------------------------------------------------------------------- /java110-project/src/main/resources/bitcamp/java110/cms/mapper/MemberDao.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | 8 | 10 | insert into p1_memb(name,email,pwd,tel,cdt) 11 | values(#{name},#{email},password(#{password}),#{tel},now()) 12 | 13 | 14 | 15 | delete from p1_memb 16 | where mno=#{value} 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /java110-servlet/src/main/webapp/el/ex06.jsp: -------------------------------------------------------------------------------- 1 | <%@page import="java.util.ArrayList"%> 2 | <%@ page language="java" 3 | contentType="text/html; charset=UTF-8" 4 | pageEncoding="UTF-8" 5 | trimDirectiveWhitespaces="true"%> 6 | 7 | 8 | 9 | 10 | EL 11 | 12 | 13 |

EL - List 객체에서 값 꺼내기

14 | <% 15 | ArrayList nameList = new ArrayList<>(); 16 | nameList.add("김구"); 17 | nameList.add("안중근"); 18 | nameList.add("윤봉길"); 19 | 20 | pageContext.setAttribute("names", nameList); 21 | %> 22 | 23 | ${names[0]}
24 | ${names[1]}
25 | ${names[2]}
26 | ${names[3]}
27 | 28 | <%-- 보관소가 아닌 로컬 변수는 EL에서 사용할 수 없다. --%> 29 | ${nameList[0]}
30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /java110-project/src/main/webapp/WEB-INF/jsp/error.jsp: -------------------------------------------------------------------------------- 1 | <%@page import="java.io.PrintWriter"%> 2 | <%@ page language="java" 3 | contentType="text/html; charset=UTF-8" 4 | pageEncoding="UTF-8" 5 | trimDirectiveWhitespaces="true"%> 6 | 7 | 8 | 9 | 10 | 실행 오류 11 | 12 | 13 | 14 | 15 | 16 | 17 | <% 18 | String message = (String)request.getAttribute("message"); 19 | Exception error = (Exception)request.getAttribute("error"); 20 | %> 21 |

JSP:<%=message%>

22 |

<%=error.getMessage()%>

23 |
24 | <%
25 | error.printStackTrace(new PrintWriter(out));
26 | %>
27 | 
28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /java110-mybatis/src/main/java/ex01/Test01.java: -------------------------------------------------------------------------------- 1 | // 주제: JDBC API 사용하기 2 | package ex01; 3 | 4 | import java.util.List; 5 | 6 | public class Test01 { 7 | 8 | public static void main(String[] args) throws Exception { 9 | DataSource ds = new DataSource( 10 | "org.mariadb.jdbc.Driver", 11 | "jdbc:mariadb://localhost:3306/studydb", 12 | "study", 13 | "1111"); 14 | MemberDao memberDao = new MemberDao(); 15 | memberDao.setDataSource(ds); 16 | 17 | List list = memberDao.findAll(); 18 | 19 | for (Member m : list) { 20 | System.out.printf("%d, %s, %s, %s\n", 21 | m.getNo(), m.getName(), m.getEmail(), m.getTel()); 22 | } 23 | } 24 | 25 | } 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /java110-servlet/src/main/webapp/el/ex08.jsp: -------------------------------------------------------------------------------- 1 | <%@page import="bitcamp.java110.Member"%> 2 | <%@page import="java.util.HashMap"%> 3 | <%@ page language="java" 4 | contentType="text/html; charset=UTF-8" 5 | pageEncoding="UTF-8" 6 | trimDirectiveWhitespaces="true"%> 7 | 8 | 9 | 10 | 11 | EL 12 | 13 | 14 |

EL - 일반 객체에서 값 꺼내기

15 | <% 16 | Member member = new Member(); 17 | member.setNo(100); 18 | member.setName("홍길동"); 19 | member.setEmail("hong@test.com"); 20 | member.setTel("1111-2222"); 21 | 22 | pageContext.setAttribute("member", member); 23 | %> 24 | 25 | ${member.no}
26 | ${member["no"]}
27 | ${member['no']}
28 | ${member.getNo()}
29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /java110-servlet/src/main/webapp/jstl/ex11.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" 2 | contentType="text/html; charset=UTF-8" 3 | pageEncoding="UTF-8" 4 | trimDirectiveWhitespaces="true"%> 5 | <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> 6 | 7 | 8 | 9 | 10 | JSTL 11 | 12 | 13 |

JSTL - c:redirect

14 |
15 | - redirect 응답하기
16 | 
17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 |

search 라는 이름으로 검색 엔진을 지정하세요!
27 | 유효한 엔진은 'naver', 'daum' 입니다.

28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /java110-project/src/main/webapp/css/common.css: -------------------------------------------------------------------------------- 1 | @charset "UTF-8"; 2 | 3 | header { 4 | overflow: hidden; 5 | padding: 0px; 6 | } 7 | 8 | header > h1 { 9 | margin: 0px; 10 | float: left; 11 | background: url('http://bitcamp.co.kr/img/logo2.jpg') no-repeat -25px 50%; 12 | background-size: contain; 13 | height: 0; 14 | padding-top: 40px; 15 | overflow: hidden; 16 | } 17 | 18 | header ul { 19 | float: right; 20 | } 21 | 22 | header li { 23 | list-style: none; 24 | display: inline-block; 25 | margin: 0px 5px; 26 | } 27 | 28 | footer { 29 | background-color: navy; 30 | color: white; 31 | } 32 | 33 | footer > p { 34 | padding: 10px; 35 | text-align: center; 36 | } 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /java110-servlet/src/main/java/bitcamp/java110/ex11/Listener01.java: -------------------------------------------------------------------------------- 1 | // 세션 생성, 소멸 모니터링하기 2 | package bitcamp.java110.ex11; 3 | 4 | import javax.servlet.annotation.WebListener; 5 | import javax.servlet.http.HttpSessionEvent; 6 | import javax.servlet.http.HttpSessionListener; 7 | 8 | @WebListener 9 | public class Listener01 implements HttpSessionListener{ 10 | @Override 11 | public void sessionCreated(HttpSessionEvent se) { 12 | // 세션이 생성되면 이 메서드가 호출된다. 13 | System.out.printf("ex11.Listener01.sessionCreated():%s\n", 14 | se.getSession().getId()); 15 | } 16 | 17 | @Override 18 | public void sessionDestroyed(HttpSessionEvent se) { 19 | // 세션이 소멸되면 이 메서드가 호출된다. 20 | System.out.printf("ex11.Listener01.sessionDestroyed():%s\n", 21 | se.getSession().getId()); 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /java110-spring-ioc/src/main/java/ex05/CD.java: -------------------------------------------------------------------------------- 1 | package ex05; 2 | 3 | import java.util.List; 4 | 5 | public class CD { 6 | private String title; 7 | private String publisher; 8 | private List songs; 9 | 10 | public String getTitle() { 11 | return title; 12 | } 13 | public void setTitle(String title) { 14 | this.title = title; 15 | } 16 | public String getPublisher() { 17 | return publisher; 18 | } 19 | public void setPublisher(String publisher) { 20 | this.publisher = publisher; 21 | } 22 | public List getSongs() { 23 | return songs; 24 | } 25 | public void setSongs(List songs) { 26 | this.songs = songs; 27 | } 28 | @Override 29 | public String toString() { 30 | return "CD [title=" + title + ", publisher=" + publisher + ", songs=" + songs + "]"; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /java110-spring-webmvc/src/main/java/ex02/DatePropertyEditor.java: -------------------------------------------------------------------------------- 1 | package ex02; 2 | 3 | import java.beans.PropertyEditorSupport; 4 | import java.text.SimpleDateFormat; 5 | 6 | // String ==> java.util.Date 프로퍼티 값 변환기 7 | // 8 | public class DatePropertyEditor extends PropertyEditorSupport { 9 | 10 | SimpleDateFormat format; 11 | 12 | public DatePropertyEditor(SimpleDateFormat format) { 13 | this.format = format; 14 | } 15 | 16 | @Override 17 | public void setAsText(String text) throws IllegalArgumentException { 18 | try { 19 | this.setValue(format.parse(text)); 20 | 21 | } catch (Exception e) { 22 | throw new IllegalArgumentException(e); 23 | } 24 | } 25 | 26 | @Override 27 | public Object getValue() { 28 | return super.getValue(); 29 | } 30 | } 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /java110-servlet/src/main/webapp/el/ex03.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" 2 | contentType="text/html; charset=UTF-8" 3 | pageEncoding="UTF-8" 4 | trimDirectiveWhitespaces="true"%> 5 | 6 | 7 | 8 | 9 | EL 10 | 11 | 12 |

EL - 보관소에 값 꺼내기 II

13 |
14 | - 보관소의 이름을 지정하지 않으면 다음 순서로 값을 찾는다.
15 |     pageScope ==> requestScope ==> sessionScope ==> applicationScope
16 |     
17 | - 보관소에 저장된 값을 찾지 못하면 빈 문자열을 리턴한다.
18 | 
19 | <% 20 | session.setAttribute("name", null); 21 | application.setAttribute("name", null); 22 | 23 | //pageContext.setAttribute("name", "홍길동"); 24 | //request.setAttribute("name", "임꺽정"); 25 | //session.setAttribute("name", "유관순"); 26 | //application.setAttribute("name", "안중근"); 27 | %> 28 | 29 |

보관소에서 값 꺼내기 : ${name}

30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /java110-servlet/src/main/webapp/jstl/ex06.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" 2 | contentType="text/html; charset=UTF-8" 3 | pageEncoding="UTF-8" 4 | trimDirectiveWhitespaces="true"%> 5 | <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> 6 | 7 | 8 | 9 | 10 | JSTL 11 | 12 | 13 |

JSTL - c:choose

14 |
15 | - 다중 조건문을 만든다.
16 | - 자바의 switch와 유사하다.
17 | 
18 | 19 | 20 | 21 | 22 | 23 | 24 |

미성년입니다.

25 |
26 | 27 |

성년입니다.

28 |
29 | 30 |

노인입니다.

31 |
32 |
33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /java110-spring-ioc/src/main/java/ex08/MyBeanPostProcessor.java: -------------------------------------------------------------------------------- 1 | package ex08; 2 | 3 | import org.springframework.beans.BeansException; 4 | import org.springframework.beans.factory.config.BeanPostProcessor; 5 | 6 | public class MyBeanPostProcessor implements BeanPostProcessor { 7 | @Override 8 | public Object postProcessBeforeInitialization( 9 | Object bean, String beanName) throws BeansException { 10 | System.out.println("MyBeanPostProcessor.postProcessBeforeInitialization()"); 11 | System.out.printf("==> %s\n", bean.toString()); 12 | return bean; 13 | } 14 | 15 | @Override 16 | public Object postProcessAfterInitialization( 17 | Object bean, String beanName) throws BeansException { 18 | System.out.println("MyBeanPostProcessor.postProcessAfterInitialization()"); 19 | System.out.printf("==> %s\n", bean.toString()); 20 | return bean; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /java110-servlet/src/main/webapp/jsp/ex12_2.jsp: -------------------------------------------------------------------------------- 1 | <%@page import="java.util.ArrayList"%> 2 | <%@ page language="java" 3 | contentType="text/html; charset=UTF-8" 4 | pageEncoding="UTF-8" 5 | trimDirectiveWhitespaces="true" 6 | isErrorPage="true"%> 7 | 8 | 9 | 10 | 11 | JSP액션태그 12 | 13 | 14 |

jsp:useBean - scope의 기본 값은 page이다.

15 | <% 16 | request.setAttribute("name", "유관순");//ServletRequest 보관소 17 | //pageContext.setAttribute("name", "안중근");//PageContext 보관소 18 | %> 19 | 20 | 23 | 24 |

이름: <%=name%>

25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | -------------------------------------------------------------------------------- /java110-servlet/src/main/webapp/jsp/ex12_6.jsp: -------------------------------------------------------------------------------- 1 | <%@page import="java.util.ArrayList"%> 2 | <%@ page language="java" 3 | contentType="text/html; charset=UTF-8" 4 | pageEncoding="UTF-8" 5 | trimDirectiveWhitespaces="true" 6 | isErrorPage="true"%> 7 | 8 | 9 | 10 | 11 | JSP액션태그 12 | 13 | 14 |

jsp:useBean - 사용자 정의 객체 생성 테스트

15 | 19 | 20 |

21 | 번호:<%=m1.getNo()%>
22 | 이름:<%=m1.getName()%>
23 | 이메일:<%=m1.getEmail()%>
24 | 전화:<%=m1.getTel()%>
25 |

26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | -------------------------------------------------------------------------------- /java110-servlet/src/main/webapp/jsp/ex14.jsp: -------------------------------------------------------------------------------- 1 | <%@page import="java.util.ArrayList"%> 2 | <%@ page language="java" 3 | contentType="text/html; charset=UTF-8" 4 | pageEncoding="UTF-8" 5 | trimDirectiveWhitespaces="true" 6 | isErrorPage="true"%> 7 | 8 | 9 | 10 | 11 | JSP액션태그 12 | 13 | 14 |

jsp:include - RequestDispatcher.include()

15 |
16 | - 다른 서블릿(또는 JSP)의 실행을 포함할 때 사용한다.
17 |     <jsp:include page="서블릿 또는 JSP URL">
18 | 
19 | 20 | 21 | 22 |

내용입니다.

23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | -------------------------------------------------------------------------------- /java110-spring-webmvc/src/main/webapp/facebook/test02.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Insert title here 6 | 7 | 8 |

페이스북 로그인

9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /java110-servlet/src/main/webapp/ex04/get.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | GET 요청 6 | 7 | 8 |

GET 요청 보내기

9 | 22 | 23 |
24 | 이름:
25 | 나이:
26 | 재직여부:
30 | 31 | 32 |
33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /java110-servlet/src/main/webapp/ex04/post2.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | POST 요청 6 | 7 | 8 |

POST 요청 보내기 - 한글 깨짐 해결

9 | 22 |
23 | 이름:
24 | 나이:
25 | 재직여부:
29 | 30 | 31 |
32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /java110-servlet/src/main/webapp/jstl/ex12.jsp: -------------------------------------------------------------------------------- 1 | <%@page import="java.util.Date"%> 2 | <%@ page language="java" 3 | contentType="text/html; charset=UTF-8" 4 | pageEncoding="UTF-8" 5 | trimDirectiveWhitespaces="true"%> 6 | <%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %> 7 | 8 | 9 | 10 | 11 | JSTL 12 | 13 | 14 |

JSTL - fmt:parseDate

15 |
16 | - 문자열로 지정된 날짜 값을 java.util.Date 객체로 만들기
17 | 
18 | 19 | 20 | 21 | 22 | <% 23 | Date date1 = (Date)pageContext.getAttribute("d1"); 24 | Date date2 = (Date)pageContext.getAttribute("d2"); 25 | 26 | out.println(date1.toString() + "
"); 27 | out.println(date2.toString() + "
"); 28 | 29 | %> 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /java110-servlet/src/main/java/bitcamp/java110/ex02/Servlet02.java: -------------------------------------------------------------------------------- 1 | /* 서블릿 만들기 II 2 | * - javax.servlet.GenericServlet 상속 받기 3 | * 4 | */ 5 | package bitcamp.java110.ex02; 6 | 7 | import java.io.IOException; 8 | 9 | import javax.servlet.GenericServlet; 10 | import javax.servlet.ServletException; 11 | import javax.servlet.ServletRequest; 12 | import javax.servlet.ServletResponse; 13 | import javax.servlet.annotation.WebServlet; 14 | 15 | @WebServlet("/ex02/servlet02") 16 | public class Servlet02 extends GenericServlet { 17 | private static final long serialVersionUID = 1L; 18 | 19 | @Override 20 | public void service(ServletRequest req, ServletResponse res) throws ServletException, IOException { 21 | System.out.println("Servlet02.service() 호출됨."); 22 | 23 | } 24 | } 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | -------------------------------------------------------------------------------- /java110-spring-webmvc/src/main/java/ex02/Test10.java: -------------------------------------------------------------------------------- 1 | // @RequestMapping 다루기 : URL 다루기 III 2 | package ex02; 3 | 4 | import org.springframework.stereotype.Controller; 5 | import org.springframework.web.bind.annotation.RequestMapping; 6 | import org.springframework.web.bind.annotation.RequestMethod; 7 | import org.springframework.web.bind.annotation.ResponseBody; 8 | 9 | @Controller 10 | @RequestMapping("/ex02/test10") 11 | public class Test10 { 12 | 13 | // 클래스에 URL을 지정하고 메서드에 GET/POST/... 등을 지정할 수 있다. 14 | // 테스트: 15 | // http://localhost:8888/ex02/Test10.html 16 | // 17 | 18 | @RequestMapping(method=RequestMethod.GET) 19 | @ResponseBody 20 | public String m1() { 21 | return "ex02.Test10.m1()"; 22 | } 23 | 24 | @RequestMapping(method=RequestMethod.POST) 25 | @ResponseBody 26 | public String m2() { 27 | return "ex02.Test10.m2()"; 28 | } 29 | 30 | 31 | } 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /java110-servlet/src/main/java/bitcamp/java110/ex02/Servlet03.java: -------------------------------------------------------------------------------- 1 | /* 서블릿 만들기 III 2 | * - javax.servlet.http.HttpServlet 상속 받기 3 | * 4 | */ 5 | package bitcamp.java110.ex02; 6 | 7 | import java.io.IOException; 8 | 9 | import javax.servlet.ServletException; 10 | import javax.servlet.annotation.WebServlet; 11 | import javax.servlet.http.HttpServlet; 12 | import javax.servlet.http.HttpServletRequest; 13 | import javax.servlet.http.HttpServletResponse; 14 | 15 | @WebServlet("/ex02/servlet03") 16 | public class Servlet03 extends HttpServlet { 17 | private static final long serialVersionUID = 1L; 18 | 19 | @Override 20 | protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { 21 | System.out.println("Servlet03.doGet() 호출됨."); 22 | } 23 | } 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | -------------------------------------------------------------------------------- /java110-servlet/src/main/java/bitcamp/java110/ex07/Listener01.java: -------------------------------------------------------------------------------- 1 | package bitcamp.java110.ex07; 2 | 3 | import javax.servlet.ServletContext; 4 | import javax.servlet.ServletContextEvent; 5 | import javax.servlet.ServletContextListener; 6 | 7 | //@WebListener 8 | public class Listener01 implements ServletContextListener { 9 | @Override 10 | public void contextInitialized(ServletContextEvent sce) { 11 | // 웹애플리케이션이 시작될 때 호출된다. 12 | System.out.println("ex07.Listener01.contextInitialized() 호출됨!"); 13 | 14 | // ServletContext 보관소를 알아낸다. 15 | ServletContext sc = sce.getServletContext(); 16 | 17 | // ServletContext 보관소에 값을 보관한다. 18 | sc.setAttribute("aaa", "홍길동"); 19 | } 20 | 21 | @Override 22 | public void contextDestroyed(ServletContextEvent sce) { 23 | // 웹애플리케이션이 종료될 때 호출된다. 24 | System.out.println("ex07.Listener01.contextDestroyed() 호출됨!"); 25 | } 26 | } 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /java110-servlet/src/main/webapp/jstl/ex10.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" 2 | contentType="text/html; charset=UTF-8" 3 | pageEncoding="UTF-8" 4 | trimDirectiveWhitespaces="true"%> 5 | <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> 6 | 7 | 8 | 9 | 10 | JSTL 11 | 12 | 13 |

JSTL - c:import

14 |
15 | - HTTP 요청을 수행하는 코드를 만든다.
16 | 
17 | 18 |

HTTP 요청하기

19 | 20 | 21 | 22 | 23 | 24 | 25 | <%-- 지정된 URL을 요청하고 서버로부터 받은 콘텐트를 contents라는 이름으로 26 | PageContext 보관소에 저장한다. --%> 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /java110-spring-webmvc/src/main/java/ex02/Engine.java: -------------------------------------------------------------------------------- 1 | package ex02; 2 | 3 | public class Engine { 4 | String name; 5 | int cc; 6 | int valve; 7 | 8 | @Override 9 | public String toString() { 10 | return "Engine [name=" + name + ", cc=" + cc + ", valve=" + valve + "]"; 11 | } 12 | 13 | public Engine() {} 14 | 15 | public Engine(String name, int cc, int valve) { 16 | super(); 17 | this.name = name; 18 | this.cc = cc; 19 | this.valve = valve; 20 | } 21 | 22 | public String getName() { 23 | return name; 24 | } 25 | public void setName(String name) { 26 | this.name = name; 27 | } 28 | public int getCc() { 29 | return cc; 30 | } 31 | public void setCc(int cc) { 32 | this.cc = cc; 33 | } 34 | public int getValve() { 35 | return valve; 36 | } 37 | public void setValve(int valve) { 38 | this.valve = valve; 39 | } 40 | 41 | 42 | } 43 | -------------------------------------------------------------------------------- /java110-servlet/src/main/webapp/jsp/ex08.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" 2 | contentType="text/html; charset=UTF-8" 3 | pageEncoding="UTF-8" 4 | trimDirectiveWhitespaces="true"%> 5 | 6 | 7 | 8 | 9 | JSP 10 | 11 | 12 |

지시명령문 (Directive Element) - include

13 |
14 | - 외부 파일의 내용을 JSP에 포함할 때 사용한다.
15 |     <%@ include file="포함할 파일"%> 
16 | - RequestDispatcher의 include가 아니다.
17 | - 즉 include 지시명령은 실행을 위임하는 것이 아니라,
18 |   파일의 내용을 포함하는 것이다. 
19 | - 동작원리
20 |     - 일단 지정한 파일의 내용을 JSP에 포함한다.
21 |     - 그런 후 서블릿 클래스를 만든다. 
22 |     
23 | 
24 | 25 | <%@ include file="ex08_1.txt"%> 26 | 27 |
28 | 29 | <%@ include file="ex08_2.txt"%> 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | -------------------------------------------------------------------------------- /java110-spring-webmvc/src/main/java/ex02/CarPropertyEditor.java: -------------------------------------------------------------------------------- 1 | package ex02; 2 | 3 | import java.beans.PropertyEditorSupport; 4 | 5 | // String ==> ex02.Car 프로퍼티 값 변환기 6 | // 7 | public class CarPropertyEditor extends PropertyEditorSupport { 8 | 9 | @Override 10 | public void setAsText(String text) throws IllegalArgumentException { 11 | System.out.println("CarPropertyEditor.setAsText()"); 12 | try { 13 | String[] values = text.split(","); 14 | Car car = new Car(); 15 | car.setModel(values[0]); 16 | car.setMaker(values[1]); 17 | car.setAuto(Boolean.parseBoolean(values[2])); 18 | 19 | this.setValue(car); 20 | 21 | } catch (Exception e) { 22 | throw new IllegalArgumentException(e); 23 | } 24 | } 25 | 26 | @Override 27 | public Object getValue() { 28 | return super.getValue(); 29 | } 30 | } 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /java110-spring-ioc/src/main/java/ex05/Test02_p1.java: -------------------------------------------------------------------------------- 1 | // 인스턴스 비교 I : equals() overriding 전 2 | // 3 | package ex05; 4 | 5 | public class Test02_p1 { 6 | 7 | static class Member { 8 | String name; 9 | int age; 10 | public Member(String name, int age) { 11 | this.name = name; 12 | this.age = age; 13 | } 14 | } 15 | 16 | public static void main(String[] args) { 17 | 18 | Member obj1 = new Member("홍길동", 20); 19 | Member obj2 = new Member("홍길동", 20); 20 | 21 | // 인스턴스 비교 22 | // 1) == 연산자는 레퍼런스에 저장된 인스턴스의 주소를 비교한다. 23 | if (obj1 == obj2) System.out.println("obj1 == obj2"); 24 | else System.out.println("obj1 != obj2"); 25 | 26 | // 2) Object에서 상속 받은 equals() 메서드는 == 연산자와 같다. 27 | if (obj1.equals(obj2)) System.out.println("obj1 == obj2"); 28 | else System.out.println("obj1 != obj2"); 29 | 30 | } 31 | 32 | } 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /java110-servlet/src/main/webapp/ex04/file.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 멀티파트 요청 6 | 7 | 8 |

POST 요청 보내기 - 멀티파트

9 | 19 |
22 | 23 | 이름:
24 | 나이:
25 | 재직여부:
29 | 사진1:
30 | 사진2:
31 | 32 | 33 | 34 |
35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /java110-spring-ioc/src/main/java/ex04/app-context-3.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 15 | 16 | 18 | 19 | 21 | 22 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /java110-spring-webmvc/src/main/java/ex02/Test18.java: -------------------------------------------------------------------------------- 1 | // HTTP 요청 헤더 알아내기 2 | package ex02; 3 | 4 | import org.springframework.stereotype.Controller; 5 | import org.springframework.web.bind.annotation.RequestHeader; 6 | import org.springframework.web.bind.annotation.RequestMapping; 7 | import org.springframework.web.bind.annotation.ResponseBody; 8 | 9 | @Controller 10 | @RequestMapping("/ex02/test18") 11 | public class Test18 { 12 | 13 | @RequestMapping(value="m1", produces="text/plain") 14 | @ResponseBody 15 | public String m1( 16 | @RequestHeader("User-Agent") 17 | String userAgent, 18 | 19 | @RequestHeader(value="Content-Type", required=false) 20 | String contentType, 21 | 22 | @RequestHeader("Accept") 23 | String accept) { 24 | 25 | return String.format("%s\n %s\n %s\n", 26 | userAgent, contentType, accept); 27 | } 28 | 29 | } 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /java110-servlet/src/main/webapp/ex04/file2.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 멀티파트 요청 6 | 7 | 8 |

POST 요청 보내기 - 멀티파트 II

9 | 19 |
22 | 23 | 이름:
24 | 나이:
25 | 재직여부:
29 | 사진1:
30 | 사진2:
31 | 32 | 33 | 34 |
35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /java110-servlet/src/main/webapp/jstl/ex08.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" 2 | contentType="text/html; charset=UTF-8" 3 | pageEncoding="UTF-8" 4 | trimDirectiveWhitespaces="true"%> 5 | <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> 6 | 7 | 8 | 9 | 10 | JSTL 11 | 12 | 13 |

JSTL - c:forTokens

14 |
15 | - 반복문을 만든다.
16 | 
17 | 18 |

CVS 문자열

19 | <% 20 | pageContext.setAttribute("names1", "홍길동,임꺽정,유관순,김구"); 21 | %> 22 | 23 |
    24 | 25 |
  • ${n}
  • 26 |
    27 |
28 | 29 | 30 |

Query String 문자열

31 | <% 32 | pageContext.setAttribute("qs", "name=홍길동&age=20&tel=1111-2222"); 33 | %> 34 | 35 |
    36 | 37 |
  • ${n}
  • 38 |
    39 |
40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | -------------------------------------------------------------------------------- /java110-spring-webmvc/src/main/webapp/ex02/Test21.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Insert title here 6 | 7 | 8 |

Test21 페이지 컨트롤러 테스트하기

9 |
10 | JSON 데이터 받기 11 | 12 | 13 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /java110-mybatis/src/main/java/ex06/mybatis-config-01.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /java110-servlet/src/main/webapp/jstl/ex09.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" 2 | contentType="text/html; charset=UTF-8" 3 | pageEncoding="UTF-8" 4 | trimDirectiveWhitespaces="true"%> 5 | <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> 6 | 7 | 8 | 9 | 10 | JSTL 11 | 12 | 13 |

JSTL - c:url

14 |
15 | - 복잡한 형식의 URL을 만들 수 있다.
16 | 
17 | 18 |

네이버 검색 URL 만들기

19 |
20 | https://search.naver.com/search.naver?where=nexearch&sm=top_hty&fbm=1&ie=utf8&query=%ED%99%8D%EA%B8%B8%EB%8F%99
21 | 
22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 |
${naverUrl}
32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /java110-mybatis/src/main/java/ex04/mybatis-config-02.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /java110-mybatis/src/main/java/ex04/mybatis-config-03.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /java110-mybatis/src/main/java/ex04/mybatis-config-04.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /java110-spring-ioc/src/main/java/ex11/step7/app-context-1.xml: -------------------------------------------------------------------------------- 1 | 2 | 12 | 13 | 14 | 15 | 16 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /java110-servlet/src/main/webapp/jstl/ex05.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" 2 | contentType="text/html; charset=UTF-8" 3 | pageEncoding="UTF-8" 4 | trimDirectiveWhitespaces="true"%> 5 | <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> 6 | 7 | 8 | 9 | 10 | JSTL 11 | 12 | 13 |

JSTL - c:if

14 |
15 | - 조건문을 만든다.
16 | 
17 | 18 | 19 | 20 | 21 | 22 | 23 |

${name}님 환영합니다! 24 | 25 | 26 |

미성년입니다.

27 |
28 | 29 |

성년입니다.

30 |
31 | 32 |

조건문의 결과를 보관소에 저장하기

33 |
34 | var 속성으로 변수이름을 설정하면, 조건문의 테스트 결과는 지정된 이름으로 보관소에 저장된다.
35 | 
36 | 37 | 38 | ${pageScope.r1 ? "여성" : "남성"}
39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /java110-spring-ioc/src/main/java/ex06/EngineFactory2.java: -------------------------------------------------------------------------------- 1 | package ex06; 2 | 3 | public class EngineFactory2 { 4 | 5 | public Engine create(String model) { 6 | Engine e = new Engine(); 7 | 8 | switch (model) { 9 | case "B100": 10 | e.setMaker("비트자동차"); 11 | e.setValve(16); 12 | e.setDiesel(false); 13 | break; 14 | case "B200": 15 | e.setMaker("비트자동차"); 16 | e.setValve(32); 17 | e.setDiesel(true); 18 | break; 19 | case "H01": 20 | e.setMaker("현대자동차"); 21 | e.setValve(16); 22 | e.setDiesel(false); 23 | break; 24 | case "HX9": 25 | e.setMaker("현대자동차"); 26 | e.setValve(32); 27 | e.setDiesel(true); 28 | break; 29 | default: 30 | e.setMaker("오호라자동차"); 31 | e.setValve(8); 32 | e.setDiesel(false); 33 | } 34 | 35 | return e; 36 | } 37 | } 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /java110-spring-webmvc/src/main/webapp/facebook/test03.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Insert title here 6 | 7 | 8 |

페이스북 로그인

9 | 10 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /java110-spring-webmvc/src/main/java/ex02/Test17.java: -------------------------------------------------------------------------------- 1 | // @GetMapping, @PostMapping 2 | package ex02; 3 | 4 | import org.springframework.stereotype.Controller; 5 | import org.springframework.web.bind.annotation.GetMapping; 6 | import org.springframework.web.bind.annotation.PostMapping; 7 | import org.springframework.web.bind.annotation.RequestMapping; 8 | import org.springframework.web.bind.annotation.ResponseBody; 9 | 10 | @Controller 11 | @RequestMapping("/ex02/test17") 12 | public class Test17 { 13 | 14 | // 테스트: 15 | // http://localhost:8888/ex02/Test17.html 16 | 17 | //@RequestMapping(value="m1", method=RequestMethod.GET) 18 | //위의 애노테이션 대신 다음 애노테이션을 사용해도 된다. 19 | @GetMapping("m1") 20 | @ResponseBody 21 | public String m1_1() { 22 | return "ex02.Test17.m1_1()"; 23 | } 24 | 25 | //@RequestMapping(value="m1", method=RequestMethod.POST) 26 | @PostMapping("m1") 27 | @ResponseBody 28 | public String m1_2() { 29 | return "ex02.Test17.m1_2()"; 30 | } 31 | 32 | } 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /java110-spring-ioc/src/main/java/ex06/EngineFactory1.java: -------------------------------------------------------------------------------- 1 | package ex06; 2 | 3 | public class EngineFactory1 { 4 | 5 | public static Engine create(String model) { 6 | Engine e = new Engine(); 7 | 8 | switch (model) { 9 | case "B100": 10 | e.setMaker("비트자동차"); 11 | e.setValve(16); 12 | e.setDiesel(false); 13 | break; 14 | case "B200": 15 | e.setMaker("비트자동차"); 16 | e.setValve(32); 17 | e.setDiesel(true); 18 | break; 19 | case "H01": 20 | e.setMaker("현대자동차"); 21 | e.setValve(16); 22 | e.setDiesel(false); 23 | break; 24 | case "HX9": 25 | e.setMaker("현대자동차"); 26 | e.setValve(32); 27 | e.setDiesel(true); 28 | break; 29 | default: 30 | e.setMaker("오호라자동차"); 31 | e.setValve(8); 32 | e.setDiesel(false); 33 | } 34 | 35 | return e; 36 | } 37 | } 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /java110-spring-ioc/src/main/java/ex11/step3/Test01.java: -------------------------------------------------------------------------------- 1 | // 메서드 호출 앞 또는 뒤에 코드 붙이기 : 프록시 클래스 자동 생성하기 2 | // 3 | package ex11.step3; 4 | 5 | import org.springframework.context.ApplicationContext; 6 | import org.springframework.context.annotation.AnnotationConfigApplicationContext; 7 | 8 | public class Test01 { 9 | 10 | public static void main(String[] args) { 11 | 12 | ApplicationContext iocContainer = 13 | //new ClassPathXmlApplicationContext("ex11/step1/app-context.xml"); 14 | new AnnotationConfigApplicationContext(AppConfig.class); 15 | 16 | // 이 시점에서 IoC 컨테이너에 들어있는 객체의 목록 출력하기 17 | AppConfig.printObjectList(iocContainer); 18 | 19 | 20 | Service proxy = (Service)iocContainer.getBean(Service.class); 21 | proxy.add(); // proxy.xxx() --> MethodFilter.invoke() --> orignal.xxx() 22 | proxy.update(); 23 | proxy.delete(); 24 | proxy.list(); 25 | proxy.addPhoto(); 26 | 27 | 28 | } 29 | 30 | } 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /java110-spring-ioc/src/main/java/ex11/step3/ServiceImpl.java: -------------------------------------------------------------------------------- 1 | package ex11.step3; 2 | 3 | import org.springframework.beans.factory.annotation.Autowired; 4 | import org.springframework.stereotype.Component; 5 | 6 | @Component 7 | public class ServiceImpl implements Service { 8 | 9 | @Autowired Dao1 dao1; 10 | @Autowired Dao2 dao2; 11 | @Autowired Dao3 dao3; 12 | 13 | @Override 14 | public void add() { 15 | dao1.insert(); 16 | dao2.insert(); 17 | dao3.insert(); 18 | } 19 | 20 | @Override 21 | public void update() { 22 | System.out.println("update()"); 23 | 24 | } 25 | 26 | @Override 27 | public void delete() { 28 | System.out.println("delete()"); 29 | 30 | } 31 | 32 | @Override 33 | public void list() { 34 | System.out.println("list()"); 35 | 36 | } 37 | 38 | @Override 39 | public void addPhoto() { 40 | System.out.println("addPhoto()"); 41 | 42 | } 43 | 44 | 45 | } 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | -------------------------------------------------------------------------------- /java110-spring-ioc/src/main/java/ex11/step4/ServiceImpl.java: -------------------------------------------------------------------------------- 1 | package ex11.step4; 2 | 3 | import org.springframework.beans.factory.annotation.Autowired; 4 | import org.springframework.stereotype.Component; 5 | 6 | @Component 7 | public class ServiceImpl implements Service { 8 | 9 | @Autowired Dao1 dao1; 10 | @Autowired Dao2 dao2; 11 | @Autowired Dao3 dao3; 12 | 13 | @Override 14 | public void add() { 15 | dao1.insert(); 16 | dao2.insert(); 17 | dao3.insert(); 18 | } 19 | 20 | @Override 21 | public void update() { 22 | System.out.println("update()"); 23 | 24 | } 25 | 26 | @Override 27 | public void delete() { 28 | System.out.println("delete()"); 29 | 30 | } 31 | 32 | @Override 33 | public void list() { 34 | System.out.println("list()"); 35 | 36 | } 37 | 38 | @Override 39 | public void addPhoto() { 40 | System.out.println("addPhoto()"); 41 | 42 | } 43 | 44 | 45 | } 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | -------------------------------------------------------------------------------- /java110-spring-webmvc/src/main/webapp/ex03/Test23.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Insert title here 6 | 7 | 8 |

동기 요청의 문제점

9 |
10 | 11 |
12 | 13 | 14 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /java110-project/src/main/java/bitcamp/java110/cms/web/interceptor/AuthInterceptor.java: -------------------------------------------------------------------------------- 1 | package bitcamp.java110.cms.web.interceptor; 2 | 3 | import javax.servlet.http.HttpServletRequest; 4 | import javax.servlet.http.HttpServletResponse; 5 | import javax.servlet.http.HttpSession; 6 | 7 | import org.springframework.web.servlet.HandlerInterceptor; 8 | 9 | public class AuthInterceptor implements HandlerInterceptor { 10 | 11 | @Override 12 | public boolean preHandle( 13 | HttpServletRequest request, 14 | HttpServletResponse response, 15 | Object handler) throws Exception { 16 | 17 | System.out.println("AuthInterceptor.preHandler()..."); 18 | 19 | HttpSession session = request.getSession(); 20 | if (session.getAttribute("loginUser") == null) { // 로그인하지 않았으면 21 | response.sendRedirect("/app/auth/form"); 22 | return false; // 페이지 컨트롤러의 request handler를 실행하지 말라! 23 | } 24 | 25 | return true; 26 | } 27 | 28 | } 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /java110-servlet/src/main/webapp/jstl/ex13.jsp: -------------------------------------------------------------------------------- 1 | <%@page import="java.util.Date"%> 2 | <%@ page language="java" 3 | contentType="text/html; charset=UTF-8" 4 | pageEncoding="UTF-8" 5 | trimDirectiveWhitespaces="true"%> 6 | <%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %> 7 | 8 | 9 | 10 | 11 | JSTL 12 | 13 | 14 |

JSTL - fmt:formatDate

15 |
16 | - java.util.Date 객체의 값을 문자열로 만들기
17 | 
18 | 19 | <% 20 | pageContext.setAttribute("today", new Date()); 21 | %> 22 | 23 |
25 |
27 |
29 | 30 | 33 | 34 |

오늘 날짜는 '${pageScope.str1}'입니다.

35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /java110-spring-ioc/src/main/java/ex07/EnginePropertyEditor.java: -------------------------------------------------------------------------------- 1 | package ex07; 2 | 3 | import java.beans.PropertyEditorSupport; 4 | 5 | // String ==> ex07.Engine 프로퍼티 값 변환기 6 | // 7 | public class EnginePropertyEditor extends PropertyEditorSupport { 8 | 9 | public EnginePropertyEditor() { 10 | System.out.println("EnginePropertyEditor() 호출됨!"); 11 | } 12 | 13 | @Override 14 | public void setAsText(String text) throws IllegalArgumentException { 15 | System.out.println("EnginePropertyEditor.setAsText(String)"); 16 | 17 | String[] values = text.split(","); 18 | Engine engine = new Engine(); 19 | engine.setMaker(values[0]); 20 | engine.setValve(Integer.parseInt(values[1])); 21 | engine.setDiesel(Boolean.parseBoolean(values[2])); 22 | 23 | this.setValue(engine); 24 | } 25 | 26 | @Override 27 | public Object getValue() { 28 | System.out.println("EnginePropertyEditor.getValue()"); 29 | return super.getValue(); 30 | } 31 | } 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /java110-mybatis/src/main/java/ex07/mybatis-config-01.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /java110-servlet/src/main/webapp/ex04/post.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | POST 요청 6 | 7 | 8 |

POST 요청 보내기

9 | 22 |
23 | 이름:
24 | 나이:
25 | 재직여부:
29 | 30 | 31 | 32 | 33 | 34 | 35 |
36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /java110-servlet/src/main/webapp/jsp/test01.jsp: -------------------------------------------------------------------------------- 1 | <%@ page 2 | language="java" 3 | contentType="text/html; charset=UTF-8" 4 | pageEncoding="UTF-8"%> 5 | 6 | 7 | 8 | 9 | 로그인 10 | 15 | 16 | 17 |

로그인

18 |
19 | 20 | 21 | 22 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 |
23 | 학생 24 | 강사 25 | 매니저 26 |
이메일
암호
이메일 저장
45 |
46 | 47 | 48 | -------------------------------------------------------------------------------- /java110-spring-ioc/src/main/java/ex08/app-context-3.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /java110-project/src/main/webapp/WEB-INF/jsp/teacher/list.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" 2 | contentType="text/html; charset=UTF-8" 3 | pageEncoding="UTF-8" 4 | trimDirectiveWhitespaces="true"%> 5 | <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> 6 | 7 | 8 | 9 | 10 | 강사 관리 11 | 12 | 17 | 18 | 19 | 20 | 21 | 22 |

강사 목록(MVC)

23 |

추가

24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 |
번호이름이메일 강의료강의과목
${t.no}${t.name}${t.email}${t.pay}${t.subjects}
44 | 45 | 46 | 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /java110-servlet/src/main/webapp/jstl/ex03.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" 2 | contentType="text/html; charset=UTF-8" 3 | pageEncoding="UTF-8" 4 | trimDirectiveWhitespaces="true"%> 5 | <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> 6 | 7 | 8 | 9 | 10 | JSTL 11 | 12 | 13 |

JSTL - c:set

14 |
15 | - 보관소에 값을 저장한다.
16 | 
17 | 18 | 19 | 1: ${requestScope.name1}
20 | 2: ${pageScope.name1}
21 | 22 | 23 | 1: ${requestScope.name2}
24 | 2: ${pageScope.name2}
25 | 26 | 유관순 27 | 1: ${requestScope.name3}
28 | 2: ${pageScope.name3}
29 | 30 |

객체의 프로퍼티 값 설정하기

31 | 32 | 33 | 34 | 35 | ${pageScope.m1.no}
36 | ${pageScope.m1.email}
37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /java110-mybatis/src/main/java/ex05/mybatis-config-01.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /java110-mybatis/src/main/java/ex08/mybatis-config-01.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /java110-servlet/src/main/java/bitcamp/java110/Member.java: -------------------------------------------------------------------------------- 1 | package bitcamp.java110; 2 | 3 | import java.io.Serializable; 4 | 5 | public class Member implements Serializable { 6 | private static final long serialVersionUID = 1L; 7 | 8 | protected int no; 9 | protected String name; 10 | protected String email; 11 | protected String password; 12 | protected String tel; 13 | 14 | public int getNo() { 15 | return no; 16 | } 17 | public void setNo(int no) { 18 | this.no = no; 19 | } 20 | public String getName() { 21 | return name; 22 | } 23 | public void setName(String name) { 24 | this.name = name; 25 | } 26 | public String getEmail() { 27 | return email; 28 | } 29 | public void setEmail(String email) { 30 | this.email = email; 31 | } 32 | public String getPassword() { 33 | return password; 34 | } 35 | public void setPassword(String password) { 36 | this.password = password; 37 | } 38 | public String getTel() { 39 | return tel; 40 | } 41 | public void setTel(String tel) { 42 | this.tel = tel; 43 | } 44 | } -------------------------------------------------------------------------------- /java110-mybatis/src/main/java/ex02/DaoBuilder.java: -------------------------------------------------------------------------------- 1 | package ex02; 2 | 3 | import java.io.FileReader; 4 | import java.util.Properties; 5 | 6 | public class DaoBuilder { 7 | 8 | String settingFilename = "jdbc.properties"; 9 | 10 | String driver; 11 | String url; 12 | String username; 13 | String password; 14 | 15 | public DaoBuilder() throws Exception { 16 | 17 | Properties props = new Properties(); 18 | props.load(new FileReader(settingFilename)); 19 | 20 | this.driver = props.getProperty("driver"); 21 | this.url = props.getProperty("url"); 22 | this.username = props.getProperty("username"); 23 | this.password = props.getProperty("password"); 24 | } 25 | 26 | public MemberDaoFactory build() throws Exception { 27 | 28 | DataSource dataSource = new DataSource( 29 | this.driver, this.url, this.username, this.password); 30 | 31 | MemberDaoFactory factory = new MemberDaoFactory(); 32 | factory.setDataSource(dataSource); 33 | 34 | return factory; 35 | } 36 | } 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /java110-project/src/main/webapp/WEB-INF/jsp/header.jsp: -------------------------------------------------------------------------------- 1 | <%@page import="bitcamp.java110.cms.domain.Teacher"%> 2 | <%@page import="bitcamp.java110.cms.domain.Manager"%> 3 | <%@page import="bitcamp.java110.cms.domain.Member"%> 4 | <%@ page language="java" 5 | contentType="text/html; charset=UTF-8" 6 | pageEncoding="UTF-8" 7 | trimDirectiveWhitespaces="true"%> 8 |
9 |

비트캠프

10 |
    11 | <% 12 | Member loginUser = (Member)session.getAttribute("loginUser"); 13 | if (loginUser == null) { 14 | %> 15 |
  • 로그인
  • 16 | <% 17 | } else { 18 | String loginType = "학생"; 19 | if (loginUser instanceof Manager) { 20 | loginType = "매니저"; 21 | } else if (loginUser instanceof Teacher) { 22 | loginType = "강사"; 23 | } 24 | %> 25 |
  • [<%=loginType%>]<%=loginUser.getName()%>(로그아웃)
  • 26 | <% 27 | } 28 | %> 29 |
  • 학생관리
  • 30 |
  • 강사관리
  • 31 |
  • 매니저관리
  • 32 |
33 |
34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /java110-spring-ioc/src/main/java/ex05/app-context-3.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | 홍길동 11 | 임꺽정 12 | 유관순 13 | 홍길동 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 홍길동 22 | 임꺽정 23 | 유관순 24 | 홍길동 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /java110-spring-webmvc/src/main/webapp/ex03/Test22.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Insert title here 6 | 7 | 8 |

Test22 페이지 컨트롤러 테스트하기

9 |
10 | 11 | 12 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /java110-spring-ioc/src/main/java/ex11/step7/MyAdvice.java: -------------------------------------------------------------------------------- 1 | package ex11.step7; 2 | 3 | import org.aspectj.lang.annotation.AfterReturning; 4 | import org.aspectj.lang.annotation.AfterThrowing; 5 | import org.aspectj.lang.annotation.Aspect; 6 | import org.aspectj.lang.annotation.Before; 7 | import org.springframework.stereotype.Component; 8 | 9 | @Component 10 | @Aspect 11 | public class MyAdvice { 12 | 13 | @Before("execution(* ex11.step7.ServiceImpl.*(..)) and args(f)") 14 | public void before(String f) { 15 | System.out.println("MyAdvice.before(): " + f); 16 | } 17 | 18 | @AfterReturning( 19 | pointcut="execution(* ex11.step7.ServiceImpl.*(..))", 20 | returning="rt") 21 | public void afterReturning(Object rt) { 22 | System.out.println("MyAdvice.afterReturning(): " + rt.toString()); 23 | } 24 | 25 | @AfterThrowing( 26 | pointcut="execution(* ex11.step7.ServiceImpl.*(..))", 27 | throwing="err") 28 | public void afterThrowing(Exception err) { 29 | System.out.println("MyAdvice.afterThrowing(): " + err.getMessage()); 30 | } 31 | 32 | 33 | } 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /java110-spring-ioc/src/main/java/ex11/step8/MyAdvice.java: -------------------------------------------------------------------------------- 1 | package ex11.step8; 2 | 3 | import org.aspectj.lang.annotation.AfterReturning; 4 | import org.aspectj.lang.annotation.AfterThrowing; 5 | import org.aspectj.lang.annotation.Aspect; 6 | import org.aspectj.lang.annotation.Before; 7 | import org.springframework.stereotype.Component; 8 | 9 | @Component 10 | @Aspect 11 | public class MyAdvice { 12 | 13 | @Before("execution(* ex11.step8.ServiceImpl.*(..)) and args(f)") 14 | public void before(String f) { 15 | System.out.println("MyAdvice.before(): " + f); 16 | } 17 | 18 | @AfterReturning( 19 | pointcut="execution(* ex11.step8.ServiceImpl.*(..))", 20 | returning="rt") 21 | public void afterReturning(Object rt) { 22 | System.out.println("MyAdvice.afterReturning(): " + rt.toString()); 23 | } 24 | 25 | @AfterThrowing( 26 | pointcut="execution(* ex11.step8.ServiceImpl.*(..))", 27 | throwing="err") 28 | public void afterThrowing(Exception err) { 29 | System.out.println("MyAdvice.afterThrowing(): " + err.getMessage()); 30 | } 31 | 32 | 33 | } 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /java110-servlet/src/main/java/bitcamp/java110/ex05/Servlet04.java: -------------------------------------------------------------------------------- 1 | /* GET/POST 구분하기 IV 2 | * 3 | */ 4 | package bitcamp.java110.ex05; 5 | 6 | import java.io.IOException; 7 | import java.io.PrintWriter; 8 | 9 | import javax.servlet.ServletException; 10 | import javax.servlet.annotation.WebServlet; 11 | import javax.servlet.http.HttpServlet; 12 | import javax.servlet.http.HttpServletRequest; 13 | import javax.servlet.http.HttpServletResponse; 14 | 15 | @WebServlet("/ex05/servlet04") 16 | public class Servlet04 extends HttpServlet { 17 | private static final long serialVersionUID = 1L; 18 | 19 | @Override 20 | public void doGet( 21 | HttpServletRequest req, 22 | HttpServletResponse res) 23 | throws ServletException, IOException { 24 | 25 | // 테스트: 26 | // => http://localhost:8888/ex05/test4.html 27 | 28 | res.setContentType("text/plain;charset=UTF-8"); 29 | PrintWriter out = res.getWriter(); 30 | out.println("GET 요청입니다."); 31 | } 32 | } 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | -------------------------------------------------------------------------------- /java110-servlet/src/main/java/bitcamp/java110/ex01/Listener01.java: -------------------------------------------------------------------------------- 1 | // 리스너 만들기 2 | // - 리스너(listener)? 특정 상황에 놓이면 실행되는 객체이다. 3 | // - javax.servlet.XxxListener 4 | // 5 | package bitcamp.java110.ex01; 6 | 7 | import javax.servlet.ServletContextEvent; 8 | import javax.servlet.ServletContextListener; 9 | 10 | // 웹애플리케이션이 시작되거나 종료되는 상황일 때 실행되는 리스너 만들기 11 | // 리스너를 만들었으면 서블릿 컨테이너에 등록해야 한다. 12 | //@WebListener 13 | public class Listener01 implements ServletContextListener { 14 | 15 | public Listener01() { 16 | System.out.println("Listener01() 호출됨."); 17 | } 18 | 19 | @Override 20 | public void contextInitialized(ServletContextEvent sce) { 21 | // 웹 애플리케이션이 시작될 때 이 메서드가 호출된다. 22 | // 이 웹 애플리케이션에 소속된 서블릿들이 23 | // 공통으로 사용하는 자원은 이 메서드에서 준비한다. 24 | // 예를 들면, IoC 컨테이너, DAO, DB 커넥션 등 25 | System.out.println("Listener01.contextInitialized()"); 26 | } 27 | 28 | @Override 29 | public void contextDestroyed(ServletContextEvent sce) { 30 | // 웹 애플리케이션이 종료될 때 이 메서드가 호출된다. 31 | // contextInitialized()에서 준비했던 자원을 해제시킨다. 32 | System.out.println("Listener01.contextDestroyed()"); 33 | } 34 | } 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /java110-spring-ioc/src/main/java/ex04/Engine.java: -------------------------------------------------------------------------------- 1 | package ex04; 2 | 3 | public class Engine { 4 | private String maker; 5 | private int valve; 6 | private boolean isDiesel; 7 | 8 | public Engine() { 9 | System.out.println("Engine() 호출됨!"); 10 | } 11 | 12 | public Engine(String maker, int valve, boolean isDiesel) { 13 | this.maker = maker; 14 | this.valve = valve; 15 | this.isDiesel = isDiesel; 16 | System.out.println("Engine(String,int,boolean) 호출됨!"); 17 | } 18 | 19 | public String getMaker() { 20 | return maker; 21 | } 22 | public void setMaker(String maker) { 23 | this.maker = maker; 24 | } 25 | public int getValve() { 26 | return valve; 27 | } 28 | public void setValve(int valve) { 29 | this.valve = valve; 30 | } 31 | public boolean isDiesel() { 32 | return isDiesel; 33 | } 34 | public void setDiesel(boolean isDiesel) { 35 | this.isDiesel = isDiesel; 36 | } 37 | 38 | @Override 39 | public String toString() { 40 | return "Engine [maker=" + maker + ", valve=" + valve + ", isDiesel=" + isDiesel + "]"; 41 | } 42 | 43 | 44 | 45 | } 46 | -------------------------------------------------------------------------------- /java110-spring-ioc/src/main/java/ex06/Engine.java: -------------------------------------------------------------------------------- 1 | package ex06; 2 | 3 | public class Engine { 4 | private String maker; 5 | private int valve; 6 | private boolean isDiesel; 7 | 8 | public Engine() { 9 | System.out.println("Engine() 호출됨!"); 10 | } 11 | 12 | public Engine(String maker, int valve, boolean isDiesel) { 13 | this.maker = maker; 14 | this.valve = valve; 15 | this.isDiesel = isDiesel; 16 | System.out.println("Engine(String,int,boolean) 호출됨!"); 17 | } 18 | 19 | public String getMaker() { 20 | return maker; 21 | } 22 | public void setMaker(String maker) { 23 | this.maker = maker; 24 | } 25 | public int getValve() { 26 | return valve; 27 | } 28 | public void setValve(int valve) { 29 | this.valve = valve; 30 | } 31 | public boolean isDiesel() { 32 | return isDiesel; 33 | } 34 | public void setDiesel(boolean isDiesel) { 35 | this.isDiesel = isDiesel; 36 | } 37 | 38 | @Override 39 | public String toString() { 40 | return "Engine [maker=" + maker + ", valve=" + valve + ", isDiesel=" + isDiesel + "]"; 41 | } 42 | 43 | 44 | 45 | } 46 | -------------------------------------------------------------------------------- /java110-spring-ioc/src/main/java/ex07/Engine.java: -------------------------------------------------------------------------------- 1 | package ex07; 2 | 3 | public class Engine { 4 | private String maker; 5 | private int valve; 6 | private boolean isDiesel; 7 | 8 | public Engine() { 9 | System.out.println("Engine() 호출됨!"); 10 | } 11 | 12 | public Engine(String maker, int valve, boolean isDiesel) { 13 | this.maker = maker; 14 | this.valve = valve; 15 | this.isDiesel = isDiesel; 16 | System.out.println("Engine(String,int,boolean) 호출됨!"); 17 | } 18 | 19 | public String getMaker() { 20 | return maker; 21 | } 22 | public void setMaker(String maker) { 23 | this.maker = maker; 24 | } 25 | public int getValve() { 26 | return valve; 27 | } 28 | public void setValve(int valve) { 29 | this.valve = valve; 30 | } 31 | public boolean isDiesel() { 32 | return isDiesel; 33 | } 34 | public void setDiesel(boolean isDiesel) { 35 | this.isDiesel = isDiesel; 36 | } 37 | 38 | @Override 39 | public String toString() { 40 | return "Engine [maker=" + maker + ", valve=" + valve + ", isDiesel=" + isDiesel + "]"; 41 | } 42 | 43 | 44 | 45 | } 46 | -------------------------------------------------------------------------------- /java110-spring-ioc/src/main/java/ex08/Engine.java: -------------------------------------------------------------------------------- 1 | package ex08; 2 | 3 | public class Engine { 4 | private String maker; 5 | private int valve; 6 | private boolean isDiesel; 7 | 8 | public Engine() { 9 | System.out.println("Engine() 호출됨!"); 10 | } 11 | 12 | public Engine(String maker, int valve, boolean isDiesel) { 13 | this.maker = maker; 14 | this.valve = valve; 15 | this.isDiesel = isDiesel; 16 | System.out.println("Engine(String,int,boolean) 호출됨!"); 17 | } 18 | 19 | public String getMaker() { 20 | return maker; 21 | } 22 | public void setMaker(String maker) { 23 | this.maker = maker; 24 | } 25 | public int getValve() { 26 | return valve; 27 | } 28 | public void setValve(int valve) { 29 | this.valve = valve; 30 | } 31 | public boolean isDiesel() { 32 | return isDiesel; 33 | } 34 | public void setDiesel(boolean isDiesel) { 35 | this.isDiesel = isDiesel; 36 | } 37 | 38 | @Override 39 | public String toString() { 40 | return "Engine [maker=" + maker + ", valve=" + valve + ", isDiesel=" + isDiesel + "]"; 41 | } 42 | 43 | 44 | 45 | } 46 | -------------------------------------------------------------------------------- /java110-spring-ioc/src/main/java/ex01/CarFactory1.java: -------------------------------------------------------------------------------- 1 | package ex01; 2 | 3 | import java.sql.Date; 4 | 5 | public class CarFactory1 { 6 | public static Car create(String model) { 7 | Car c = new Car(); 8 | 9 | switch (model) { 10 | case "티코": 11 | c.setModel("Tico"); 12 | c.setCc(890); 13 | c.setMaker("대우자동차"); 14 | c.setCreatedDate(new Date(System.currentTimeMillis())); 15 | break; 16 | case "소나타": 17 | c.setModel("Sonata"); 18 | c.setCc(1980); 19 | c.setMaker("현대자동차"); 20 | c.setCreatedDate(new Date(System.currentTimeMillis())); 21 | break; 22 | case "그랜저": 23 | c.setModel("Grandeur"); 24 | c.setCc(1980); 25 | c.setMaker("현대자동차"); 26 | c.setCreatedDate(new Date(System.currentTimeMillis())); 27 | break; 28 | default: 29 | c.setModel("Avante"); 30 | c.setCc(1500); 31 | c.setMaker("현대자동차"); 32 | c.setCreatedDate(new Date(System.currentTimeMillis())); 33 | } 34 | return c; 35 | } 36 | } 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /java110-spring-ioc/src/main/java/ex11/step3/MethodFilter.java: -------------------------------------------------------------------------------- 1 | package ex11.step3; 2 | 3 | import java.lang.reflect.InvocationHandler; 4 | import java.lang.reflect.Method; 5 | 6 | public class MethodFilter implements InvocationHandler { 7 | 8 | public Object original; 9 | 10 | public MethodFilter(Object original) { 11 | this.original = original; 12 | } 13 | 14 | // 메서드 호출 과정 15 | // App 16 | // --> [자동 생성된 프록시] 메서드 호출 17 | // --> [MethodFilter] invoke()를 호출 18 | // --> [원래 객체] 메서드 호출 19 | @Override 20 | public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { 21 | // add() 메서드 호출 전 수행할 작업 22 | if (method.getName().startsWith("add")) { 23 | System.out.println("MethodFilter: 호출 전 작업수행!"); 24 | } 25 | 26 | // 원래 객체의 메서드 호출 27 | Object rv = method.invoke(original, args); 28 | 29 | // add() 메서드 호출 후 수행할 작업 30 | if (method.getName().startsWith("add")) { 31 | System.out.println("MethodFilter: 호출 후 작업수행!"); 32 | } 33 | 34 | return rv; 35 | } 36 | } 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /java110-spring-ioc/src/main/java/ex01/CarFactory2.java: -------------------------------------------------------------------------------- 1 | package ex01; 2 | 3 | import java.sql.Date; 4 | 5 | public class CarFactory2 { 6 | 7 | public Car create(String model) { 8 | Car c = new Car(); 9 | 10 | switch (model) { 11 | case "티코": 12 | c.setModel("Tico"); 13 | c.setCc(890); 14 | c.setMaker("대우자동차"); 15 | c.setCreatedDate(new Date(System.currentTimeMillis())); 16 | break; 17 | case "소나타": 18 | c.setModel("Sonata"); 19 | c.setCc(1980); 20 | c.setMaker("현대자동차"); 21 | c.setCreatedDate(new Date(System.currentTimeMillis())); 22 | break; 23 | case "그랜저": 24 | c.setModel("Grandeur"); 25 | c.setCc(1980); 26 | c.setMaker("현대자동차"); 27 | c.setCreatedDate(new Date(System.currentTimeMillis())); 28 | break; 29 | default: 30 | c.setModel("Avante"); 31 | c.setCc(1500); 32 | c.setMaker("현대자동차"); 33 | c.setCreatedDate(new Date(System.currentTimeMillis())); 34 | } 35 | return c; 36 | } 37 | } 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /java110-spring-ioc/src/main/java/ex05/app-context-4.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | sunroof 18 | true 19 | 20 | true 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /java110-servlet/src/main/webapp/jsp/ex13.jsp: -------------------------------------------------------------------------------- 1 | <%@page import="java.util.ArrayList"%> 2 | <%@ page language="java" 3 | contentType="text/html; charset=UTF-8" 4 | pageEncoding="UTF-8" 5 | trimDirectiveWhitespaces="true" 6 | isErrorPage="true"%> 7 | 8 | 9 | 10 | 11 | JSP액션태그 12 | 13 | 14 |

jsp:setProperty - 객체의 셋터 호출하기

15 | 16 | 20 | 21 | 22 | 23 | 24 | 25 | 26 |

27 | 번호:<%=m1.getNo()%>, ${m1.no}
28 | 이름:<%=m1.getName()%>, ${m1.name}
29 | 이메일:<%=m1.getEmail()%>, ${m1.email}
30 | 전화:<%=m1.getTel()%>, ${m1.tel}
31 |

32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | -------------------------------------------------------------------------------- /java110-mybatis/src/main/java/ex03/Test03.java: -------------------------------------------------------------------------------- 1 | // 주제: Mybatis 적용 - 삭제 테스트 2 | package ex03; 3 | 4 | import java.io.InputStream; 5 | 6 | import org.apache.ibatis.io.Resources; 7 | import org.apache.ibatis.session.SqlSessionFactory; 8 | import org.apache.ibatis.session.SqlSessionFactoryBuilder; 9 | 10 | public class Test03 { 11 | 12 | public static void main(String[] args) throws Exception { 13 | 14 | // 1) mybatis 설정 파일 경로 15 | String resource = "ex03/mybatis-config.xml"; 16 | 17 | // 2) 설정 파일을 읽을 InputStream 준비 18 | // => 자바 classpath에서 설정 파일을 찾는다. 19 | InputStream inputStream = Resources.getResourceAsStream(resource); 20 | 21 | // 3) SqlSession 객체를 생성해 줄 팩토리 객체를 준비 22 | // => mybatis 설정 파일에 정의된 대로 객체를 준비한다. 23 | SqlSessionFactory sqlSessionFactory = 24 | new SqlSessionFactoryBuilder().build(inputStream); 25 | 26 | MemberDao memberDao = new MemberDao(); 27 | 28 | // 4) Mybatis 객체를 MemberDao에게 넘겨준다. 29 | memberDao.setSqlSessionFactory(sqlSessionFactory); 30 | 31 | memberDao.delete(93); 32 | 33 | 34 | } 35 | 36 | } 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /java110-servlet/src/main/webapp/jsp/ex15.jsp: -------------------------------------------------------------------------------- 1 | <%@page import="java.util.ArrayList"%> 2 | <%@ page language="java" 3 | contentType="text/html; charset=UTF-8" 4 | pageEncoding="UTF-8" 5 | trimDirectiveWhitespaces="true" 6 | isErrorPage="true"%> 7 | 8 | 9 | 10 | 11 | JSP액션태그 12 | 13 | 14 |

jsp:forward - RequestDispatcher.forward()

15 |
16 | - 다른 서블릿(또는 JSP)으로 실행을 위임한다.
17 |     <jsp:forward page="서블릿 또는 JSP URL">
18 | 
19 | 20 | <% 21 | int a = Integer.parseInt(request.getParameter("a")); 22 | int b = Integer.parseInt(request.getParameter("b")); 23 | String op = request.getParameter("op"); 24 | 25 | int result = 0; 26 | 27 | switch(op) { 28 | case "+": result = a + b; break; 29 | case "-": result = a - b; break; 30 | default:%> 31 | 32 | <% 33 | return; 34 | } 35 | %> 36 | 37 |

<%=a%> <%=op%> <%=b%> = <%=result%>

38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | -------------------------------------------------------------------------------- /java110-spring-ioc/src/main/java/ex08/app-context-2.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /java110-mybatis/src/main/java/ex03/MemberDao-02.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | 8 | 11 | 19 | 20 | 29 | 30 | 32 | insert into p1_memb(name,email,pwd,tel,cdt) 33 | values(#{name},#{email},password(#{password}),#{tel},now()) 34 | 35 | 36 | 37 | delete from p1_memb 38 | where mno=#{okok} 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /java110-project/src/main/webapp/WEB-INF/jsp/student/list.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" 2 | contentType="text/html; charset=UTF-8" 3 | pageEncoding="UTF-8" 4 | trimDirectiveWhitespaces="true"%> 5 | <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> 6 | 7 | 8 | 9 | 10 | 학생 관리 11 | 12 | 17 | 18 | 19 | 20 | 21 | 22 |

학생 목록

23 |

추가

24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 |
번호이름이메일 최종학교재직여부
${s.no}${s.name}${s.email}${s.school}${s.working}
43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /java110-spring-webmvc/src/main/java/ex02/Test06.java: -------------------------------------------------------------------------------- 1 | // @RequestMapping 다루기 : HTTP accept 헤더로 메서드 구분하기 2 | package ex02; 3 | 4 | import org.springframework.stereotype.Controller; 5 | import org.springframework.web.bind.annotation.RequestMapping; 6 | import org.springframework.web.bind.annotation.ResponseBody; 7 | 8 | @Controller 9 | public class Test06 { 10 | 11 | // HTTP 클라이언트는 서버에 요청할 때 자신이 받기를 원하는 콘텐트 형식을 지정한다. 12 | // => HTTP 요청 헤더에서 "Accept" 헤더의 값으로 MIME 타입을 지정한다. 13 | // HTTP 서버는 클라이언트의 요청 정보를 분석하여 14 | // Accept에 지정된 콘텐트가 있으면 그 콘텐트를 전달한다. 15 | // 16 | // 테스트: 17 | // http://localhost:8888/ex02/Test06.html 18 | // 19 | @RequestMapping(value="/ex02/test06", 20 | produces="text/plain") 21 | @ResponseBody 22 | public String m1() { 23 | return "text/plain"; 24 | } 25 | 26 | @RequestMapping(value="/ex02/test06", 27 | produces="text/html") 28 | @ResponseBody 29 | public String m2() { 30 | return "text/html"; 31 | } 32 | 33 | 34 | @RequestMapping(value="/ex02/test06") 35 | @ResponseBody 36 | public String m4() { 37 | return "etc..."; 38 | } 39 | 40 | 41 | 42 | } 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /java110-project/src/main/webapp/WEB-INF/jsp/manager/list.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" 2 | contentType="text/html; charset=UTF-8" 3 | pageEncoding="UTF-8" 4 | trimDirectiveWhitespaces="true"%> 5 | <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> 6 | 7 | 8 | 9 | 10 | 매니저 관리 11 | 12 | 17 | 18 | 19 | 20 | 21 | 22 |

매니저 목록

23 |

추가

24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 |
번호 이름 이메일 직위
${m.no}${m.name}${m.email}${m.position}
43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | -------------------------------------------------------------------------------- /java110-servlet/src/main/java/bitcamp/java110/ex09/Servlet05.java: -------------------------------------------------------------------------------- 1 | /* 인클루드(forward) 2 | * => 다른 서블릿의 작업을 포함하는 기술 3 | * 일종의 함수를 호출하듯이 다른 서블릿을 실행한 후 4 | * 다시 이전 서블릿으로 돌아온다. 5 | */ 6 | package bitcamp.java110.ex09; 7 | 8 | import java.io.IOException; 9 | import java.io.PrintWriter; 10 | 11 | import javax.servlet.ServletException; 12 | import javax.servlet.annotation.WebServlet; 13 | import javax.servlet.http.HttpServlet; 14 | import javax.servlet.http.HttpServletRequest; 15 | import javax.servlet.http.HttpServletResponse; 16 | 17 | @WebServlet("/ex09/servlet05") 18 | public class Servlet05 extends HttpServlet { 19 | private static final long serialVersionUID = 1L; 20 | 21 | 22 | @Override 23 | public void doGet( 24 | HttpServletRequest req, 25 | HttpServletResponse res) 26 | throws ServletException, IOException { 27 | 28 | // 이전 서블릿에서 호출한 setContentType()이 그대로 적용되기 때문에 29 | // 인클루드 서블릿에서는 setContentType()을 할 필요가 없고, 30 | // 해봐야 소용없다. 31 | //res.setContentType("text/html;charset=UTF-8"); 32 | PrintWriter out = res.getWriter(); 33 | 34 | out.println("

Servlet05

"); 35 | 36 | } 37 | } 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /java110-servlet/src/main/java/bitcamp/java110/ex09/Servlet06.java: -------------------------------------------------------------------------------- 1 | /* 인클루드(forward) 2 | * => 다른 서블릿의 작업을 포함하는 기술 3 | * 일종의 함수를 호출하듯이 다른 서블릿을 실행한 후 4 | * 다시 이전 서블릿으로 돌아온다. 5 | */ 6 | package bitcamp.java110.ex09; 7 | 8 | import java.io.IOException; 9 | import java.io.PrintWriter; 10 | 11 | import javax.servlet.ServletException; 12 | import javax.servlet.annotation.WebServlet; 13 | import javax.servlet.http.HttpServlet; 14 | import javax.servlet.http.HttpServletRequest; 15 | import javax.servlet.http.HttpServletResponse; 16 | 17 | @WebServlet("/ex09/servlet06") 18 | public class Servlet06 extends HttpServlet { 19 | private static final long serialVersionUID = 1L; 20 | 21 | 22 | @Override 23 | public void doGet( 24 | HttpServletRequest req, 25 | HttpServletResponse res) 26 | throws ServletException, IOException { 27 | 28 | // 이전 서블릿에서 호출한 setContentType()이 그대로 적용되기 때문에 29 | // 인클루드 서블릿에서는 setContentType()을 할 필요가 없고, 30 | // 해봐야 소용없다. 31 | //res.setContentType("text/html;charset=UTF-8"); 32 | PrintWriter out = res.getWriter(); 33 | 34 | out.println("

Servlet06

"); 35 | 36 | } 37 | } 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /java110-spring-ioc/src/main/java/ex11/step5/ServiceImpl.java: -------------------------------------------------------------------------------- 1 | package ex11.step5; 2 | 3 | import org.springframework.beans.factory.annotation.Autowired; 4 | import org.springframework.stereotype.Component; 5 | 6 | @Component 7 | public class ServiceImpl implements Service { 8 | 9 | @Autowired Dao1 dao1; 10 | @Autowired Dao2 dao2; 11 | @Autowired Dao3 dao3; 12 | 13 | @Override 14 | public void add() { 15 | dao1.insert(); 16 | dao2.insert(); 17 | dao3.insert(); 18 | } 19 | 20 | @Override 21 | public void update() { 22 | System.out.println("update()"); 23 | 24 | } 25 | 26 | @Override 27 | public void delete() { 28 | System.out.println("delete()"); 29 | 30 | } 31 | 32 | @Override 33 | public void list() { 34 | System.out.println("list()"); 35 | 36 | } 37 | 38 | @Override 39 | public int addPhoto(String filename) { 40 | System.out.println("addPhoto(): " + filename); 41 | 42 | if (filename == null) { 43 | throw new RuntimeException("파일이 없습니다!"); 44 | } 45 | 46 | return 1; 47 | } 48 | 49 | 50 | } 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | -------------------------------------------------------------------------------- /java110-spring-ioc/src/main/java/ex11/step6/ServiceImpl.java: -------------------------------------------------------------------------------- 1 | package ex11.step6; 2 | 3 | import org.springframework.beans.factory.annotation.Autowired; 4 | import org.springframework.stereotype.Component; 5 | 6 | @Component 7 | public class ServiceImpl implements Service { 8 | 9 | @Autowired Dao1 dao1; 10 | @Autowired Dao2 dao2; 11 | @Autowired Dao3 dao3; 12 | 13 | @Override 14 | public void add() { 15 | dao1.insert(); 16 | dao2.insert(); 17 | dao3.insert(); 18 | } 19 | 20 | @Override 21 | public void update() { 22 | System.out.println("update()"); 23 | 24 | } 25 | 26 | @Override 27 | public void delete() { 28 | System.out.println("delete()"); 29 | 30 | } 31 | 32 | @Override 33 | public void list() { 34 | System.out.println("list()"); 35 | 36 | } 37 | 38 | @Override 39 | public int addPhoto(String filename) { 40 | System.out.println("addPhoto(): " + filename); 41 | 42 | if (filename == null) { 43 | throw new RuntimeException("파일이 없습니다!"); 44 | } 45 | 46 | return 1; 47 | } 48 | 49 | 50 | } 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | -------------------------------------------------------------------------------- /java110-spring-ioc/src/main/java/ex11/step7/ServiceImpl.java: -------------------------------------------------------------------------------- 1 | package ex11.step7; 2 | 3 | import org.springframework.beans.factory.annotation.Autowired; 4 | import org.springframework.stereotype.Component; 5 | 6 | @Component 7 | public class ServiceImpl implements Service { 8 | 9 | @Autowired Dao1 dao1; 10 | @Autowired Dao2 dao2; 11 | @Autowired Dao3 dao3; 12 | 13 | @Override 14 | public void add() { 15 | dao1.insert(); 16 | dao2.insert(); 17 | dao3.insert(); 18 | } 19 | 20 | @Override 21 | public void update() { 22 | System.out.println("update()"); 23 | 24 | } 25 | 26 | @Override 27 | public void delete() { 28 | System.out.println("delete()"); 29 | 30 | } 31 | 32 | @Override 33 | public void list() { 34 | System.out.println("list()"); 35 | 36 | } 37 | 38 | @Override 39 | public int addPhoto(String filename) { 40 | System.out.println("addPhoto(): " + filename); 41 | 42 | if (filename == null) { 43 | throw new RuntimeException("파일이 없습니다!"); 44 | } 45 | 46 | return 1; 47 | } 48 | 49 | 50 | } 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | -------------------------------------------------------------------------------- /java110-spring-ioc/src/main/java/ex11/step8/ServiceImpl.java: -------------------------------------------------------------------------------- 1 | package ex11.step8; 2 | 3 | import org.springframework.beans.factory.annotation.Autowired; 4 | import org.springframework.stereotype.Component; 5 | 6 | @Component 7 | public class ServiceImpl implements Service { 8 | 9 | @Autowired Dao1 dao1; 10 | @Autowired Dao2 dao2; 11 | @Autowired Dao3 dao3; 12 | 13 | @Override 14 | public void add() { 15 | dao1.insert(); 16 | dao2.insert(); 17 | dao3.insert(); 18 | } 19 | 20 | @Override 21 | public void update() { 22 | System.out.println("update()"); 23 | 24 | } 25 | 26 | @Override 27 | public void delete() { 28 | System.out.println("delete()"); 29 | 30 | } 31 | 32 | @Override 33 | public void list() { 34 | System.out.println("list()"); 35 | 36 | } 37 | 38 | @Override 39 | public int addPhoto(String filename) { 40 | System.out.println("addPhoto(): " + filename); 41 | 42 | if (filename == null) { 43 | throw new RuntimeException("파일이 없습니다!"); 44 | } 45 | 46 | return 1; 47 | } 48 | 49 | 50 | } 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | -------------------------------------------------------------------------------- /java110-spring-webmvc/src/main/java/ex02/Test05.java: -------------------------------------------------------------------------------- 1 | // @RequestMapping 다루기 : HTTP 요청 헤더로 메서드 구분하기 2 | package ex02; 3 | 4 | import org.springframework.stereotype.Controller; 5 | import org.springframework.web.bind.annotation.RequestMapping; 6 | import org.springframework.web.bind.annotation.ResponseBody; 7 | 8 | @Controller 9 | public class Test05 { 10 | 11 | // 특정 이름의 요청 헤더를 포함하고 있을 때만 호출되도록 한다. 12 | // 테스트: 13 | // http://localhost:8888/ex02/Test05.html 14 | // 15 | @RequestMapping(value="/ex02/test05", 16 | headers="name") 17 | @ResponseBody 18 | public String m1() { 19 | return "ex02.Test05.m1()"; 20 | } 21 | 22 | @RequestMapping(value="/ex02/test05", 23 | headers="age") 24 | @ResponseBody 25 | public String m2() { 26 | return "ex02.Test05.m2()"; 27 | } 28 | 29 | @RequestMapping(value="/ex02/test05", 30 | headers={"age","name"}) 31 | @ResponseBody 32 | public String m3() { 33 | return "ex02.Test05.m3()"; 34 | } 35 | 36 | @RequestMapping(value="/ex02/test05") 37 | @ResponseBody 38 | public String m4() { 39 | return "ex02.Test05.m4()"; 40 | } 41 | 42 | } 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /java110-spring-webmvc/src/main/java/ex03/Test29.java: -------------------------------------------------------------------------------- 1 | // 인터셉터 다루기 - 프론트 컨트롤러와 "페이지 컨트롤러/JSP" 사이의 필터링 방법 2 | package ex03; 3 | 4 | import org.springframework.stereotype.Controller; 5 | import org.springframework.web.bind.annotation.GetMapping; 6 | import org.springframework.web.bind.annotation.RequestMapping; 7 | 8 | @Controller 9 | @RequestMapping("/ex03/test29") 10 | public class Test29 { 11 | 12 | // 인터셉터를 스프링에 등록하기 13 | // => XML 설정 14 | // - /WEB-INF/app-servlet.xml 참고! 15 | // 16 | // => Java Config 설정 17 | // - 문서 참고! 18 | 19 | @GetMapping("m1") 20 | public void m1() throws Exception { 21 | System.out.println("Test29.m1()..."); 22 | } 23 | 24 | @GetMapping("m2") 25 | public void m2() throws Exception { 26 | System.out.println("Test29.m2()..."); 27 | } 28 | 29 | @GetMapping("ok/m3") 30 | public void m3() throws Exception { 31 | System.out.println("Test29.m3()..."); 32 | } 33 | 34 | @GetMapping("no/m4") 35 | public void m4() throws Exception { 36 | System.out.println("Test29.m4()..."); 37 | } 38 | 39 | } 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | -------------------------------------------------------------------------------- /java110-mybatis/src/main/java/ex03/MemberDao-01.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | 8 | 11 | 19 | 20 | 29 | 30 | 32 | insert into p1_memb(name,email,pwd,tel,cdt) 33 | values(#{name},#{email},password(#{password}),#{tel},now()) 34 | 35 | 36 | 37 | delete from p1_memb 38 | where mno=#{okok} 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /java110-servlet/src/main/java/bitcamp/java110/ex05/Servlet03.java: -------------------------------------------------------------------------------- 1 | /* GET/POST 구분하기 III 2 | * 3 | */ 4 | package bitcamp.java110.ex05; 5 | 6 | import java.io.IOException; 7 | import java.io.PrintWriter; 8 | 9 | import javax.servlet.ServletException; 10 | import javax.servlet.annotation.WebServlet; 11 | import javax.servlet.http.HttpServletRequest; 12 | import javax.servlet.http.HttpServletResponse; 13 | 14 | // MyHttpServlet을 상속 받는 것 보다 15 | // MyHttpServlet2 클래스를 상속 받으면 16 | // GET/POST 요청을 구분하여 처리할 수 있다. 17 | // 18 | @WebServlet("/ex05/servlet03") 19 | public class Servlet03 extends MyHttpServlet2 { 20 | private static final long serialVersionUID = 1L; 21 | 22 | @Override 23 | public void doGet( 24 | HttpServletRequest req, 25 | HttpServletResponse res) 26 | throws ServletException, IOException { 27 | 28 | // 테스트: 29 | // => http://localhost:8888/ex05/test3.html 30 | 31 | res.setContentType("text/plain;charset=UTF-8"); 32 | PrintWriter out = res.getWriter(); 33 | out.println("GET 요청입니다."); 34 | } 35 | } 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | --------------------------------------------------------------------------------