전체 글
-
학원 day49. 게시판 리뷰 기능, 쿠키/세션, JSP 주요객체기록 2022. 11. 14. 12:54
글번호가 서버에 전달되어야 하는 이유 1. 리뷰 테이블에 글번호가 저장되어야 하기 때문에 2. Board 테이블에 특정 글의 리뷰 갯수를 증가시켜 줘야 하기 떄문이다. 확인해야 할 것 1. form의 method와 action 확인 method="post" action="addReview.jsp" 2. 입력필드에 name이 뭐라고 되어 있는지 확인 name="" 3. submit 버튼이 무엇인지 확인 항상 사용자가 보는 화면에서 서버로 요청을 보낸다. 링크를 클릭하면 get방식의 요청 입력폼에서 등록버튼을 클릭하면 post방식의 요청으로 요청메시지가 간다. 모달창을 띄우는 경우에는 거의 대부분 게시글의 글 번호를 갖고 있어야 한다. 어떤 게시글에 다는 리뷰인지가 필요하기 때문이다. 모달창의 hidden으..
-
학원 day48. 게시판 만들기 실습, 페이지 네비게이션기록 2022. 11. 12. 21:23
페이지 내비게이션 출력하기 1. 한 화면에 표시할 페이지번호 개수 결정하기 int pages = 5; 2. 총 페이지블록 개수를 계산하기 int totalPageBlocks = (int) Math.ceil ((double) totalPages/pages); // (int) Math.ceil((double) 8/5) = 2 3. 현재 페이지블록을 계산하기 int currentPageBlock = (int) Math.ceil((double) currentPage/pages); // (int) Math.ceil((double) 7/5) = 2 4. 현재 페이지블록에 맞는 시작페이지번호와 끝페이지번호를 계산하기 int beginPage = (currentPageBlock -1)*pages + 1; int end..
-
학원 day47. 웹 실습, 페이징처리기록 2022. 11. 11. 01:19
StringUtils클래스에 private static final DecimalFormat decimalFormat = new DecimalFormat("#,###.##"); /** 정수를 3자리마다 ,가 포함된 문자열로 변환해서 반환한다. public static String numberToText(long number) { return decimalFormat.format(number); } /** 실수를 소숫점 3번째 자리에서 반올림하고, 정수부는 3자리마다 ,가 포함된 문자열로 변환해서 반환한다. public static String numberToText(double number) { return decimalFormat.format(number); } list.jsp에 판매중 재고없음 => D..
-
학원 day46. JSP실습기록 2022. 11. 9. 23:50
- 정보를 조회하는 요청을 할 경우 HTML컨텐츠를 응답으로 받는다. - 정보를 추가/변경/삭제하는 요청을 할 경우 응답으로 전달할 정보가 없다. 대신 정보를 조회할 수 있는 요청 URL을 응답으로 보낸다. 그러면 톰캣은 다시 요청메시지를 분석해서 브라우저에 조회화면을 내려보낸다. - 브라우저가 재요청할 URL을 응답으로 보내는 코드 : response.sendRedirect("list.jsp"); - 재요청할 URL을 응답으로 보낼 때 응답코드가 302임을 검사창(F12)에서 확인할 수 있다. (응답코드에 대해서는 다음에 배울 예정) - 로그인하면 다시 홈페이지화면이 나오는..
-
학원 day45. JSP(2) 구성요소, 내장객체, 요청파라미터값 전달방식기록 2022. 11. 8. 13:52
JSP 구성요소 디렉티브(지시어) JSP페이지에 대한 설정 정보를 정의한다. page 디렉티브 page 디렉티브의 주요 속성 contentType 응답컨텐츠의 타입 및 인코딩방식을 설정 설정예) pageEncoding jsp 파일을 저장할 때 사용할 인코딩방식을 설정(UTF-8 : 한글의 경우, 2바이트의 유니코드를 3바이트로 변환하여 저장하는 방식) 설정예) import jsp 파일에서 사용되는 클래스에 대한 import문 역할 수행 설정예) errorPage jsp파일 실행 중 에러 발생시 표시할 페이지를 설정 설정예) isErrorPage 에러페이지로 사용되는 jsp 페이지인지 여부를 설정 isErrorPage 속성은 에러페이지로 사용되는 jsp에 설정하는 속성이다. isErrorPage="true..
-
학원 day44(2). Tomcat, JSP기록 2022. 11. 7. 19:05
Dynamic Web Project 구성 src/main/java - 패키지, 자바클래스를 정의하는 소스폴더 webapp - 웹 애플리케이션 프로그램(jsp)을 정의하는 폴더 - 웹 정적 리소스(html, css, js, image, video, audio)를 정의하는 폴더 * 각각의 리소스별로 하위 폴더를 생성하고 해당 리소스를 저장한다. webapp/resources/images : 이미지 저장 폴더 webapp/resources/css : css파일 저장 폴더 webapp/resources/js : javascript 파일 저장 폴더 WEB-INF - 웹 애플리케이션 설정정보를 정의하는 폴더 - 보통 web.xml파일이 위치한다. 서블릿 버전 3.x 이상부터는 web.xml파일이 없어도 상관없다. ..
-
학원 day44. 네트워크기록 2022. 11. 7. 11:19
네트워크 여러 대의 컴퓨터가 통신회선으로 연결되어 있는 것 네트워크의 구성 : - Server : 서비스를 제공하는 프로그램 - Client : 서비스를 제공받는 프로그램 CS 구성 (Client server) (예외 : p2p구성, 클라이언트가 서버도 되는 구성) 클라이언트와 서버가 통신하기 위해서는 전용의 프로그램이 실행되고 있어야 한다. 클라이언트에는 웹브라우저가, 서버에는 웹서버 프로그램이 실행되어야 한다. 프로토콜 네트워크에 연결된 host간의 데이터교환을 위해서 미리 약속된 통신규약이다. 물리적 혹은 논리적 통신을 처리하기 위한 규칙 세트다. 통신규약 예시 (tcp, ip, http, https, ftp, telnet, smtp, ...) - HTTP(HyperText Transfer Prot..
-
학원 day43. 선택자, 색표현, 박스모델, 포지션, 레이아웃기록 2022. 11. 4. 09:53
CSS 선택자 HTML문서에서 스타일을 적용할 대상을 선택할 때 사용한다. 기본 선택자 자손, 자식, 형제 선택자 => 1~2번 자손선택자, 3~7번 자식선택자, 8~9번 형제선택자 (자손선택자와 자식선택자의 차이점 : 자손선택자는 모든 하위요소(자식+자손)를 선택하고, 자식선택자는 직접적인 자식 요소만을 선택한다.) => 선택자 사이에 공백이 있으면 자손선택자이다. 속성 선택자 필터 선택자 가상 선택자 색 표현 색 표현 색 색이름으로 색표현 black red green blue RGB 색 표현 black red green blue yellow fuchsia aqua bts 무채색 무채색 무채색 무채색 무채색 무채색 16진수 표기법으로 색표현 black red green blue black red gre..