전체 글
-
User-Agent 지정 ( header )Python 2023. 3. 20. 10:58
header 지정 : 크롤링을 할 때 해당 페이지에서 로봇인지 사람인지 검사하기위해 header (유저) 정보를 요구할 때가 있다. 다음의 경우 User-Agent를 지정해서 이를 해결할 수 있다. User-Agent 지정 페이지를 가져오기 위해 get 함수를 다음과 같이 사용한다. get( URL , headers = {'User-Agent' : 유저정보} ) 따라서 보통 headers = {' ' : } URL get( USL , headers = headers ) 의 형태로 사용할 수 있다 유저정보 얻는 곳 https://www.useragentstring.com/ UserAgentString.com - unknown version www.useragentstring.com - 각 브라우저에 맞춤형..
-
JSP 의 구성요소JSP 2023. 3. 20. 10:51
1 _ JSP 구성요소 - JSP 파일은 1,2 번줄의 JSP 설정 문법과 그 외 나머지의 HTML코드 및 JSP 스크립트로 이루어진다. - JSP 페이지의 구성요소는 총 7가지가 있다. 1) 디렉티브 : JSP 페이지에 대한 설정 정보를 지정할 때 사용된다. 디렉티브 JSP가 제공하는 디렉티브 page : 페이지에 대한 정보 지정 ( 문서의 타입, 출력 버퍼의 크기, 에러 페이지등 ) taglib : 태그 라이브러리 지정 include : 특정 영역에 다른 문서를 포함시킴 디렉티브 주요 속성 - contentType : 문서의 MIME 타입과 캐릭터 인코딩 지정 - import : JSP페이지에서 사용할 자바 클래스 지정 - session : JSP 페이지가 세션을 사용할지의 여부를 지정 - buffe..
-
JSP 생성 프로젝트, 실행JSP 2023. 3. 20. 10:21
1 _ eclips에서 프로젝트 생성 : New project 생성 -> Dynamic Web Project 실행 - 좌측에 다음과 같이 JSP 프로젝트가 생성됬다. WebContent 폴더 내부에 .jsp 파일을 생성해서 사용한다. 해당 오류가 뜬다면, window -> show view -> servers 창을 열고 아래쪽에 뜬 servers 창에 나온 에러 코드를 더블클릭한 후, ports 칸에서 HTTP/1.1 의 Port Number를 변경한다. Tomcat admin port = 8005 HTTP/1.1 = 8090 으로 설정하고 다시 실행하자. 여러개의 포트를 사용하는 경우 중복되지 않도록 주의해야한다.
-
톰캣 설치 / eclipse 와 연결하기JSP 2023. 3. 20. 09:24
1 _ 톰캣 설치 - 보통 8 or 9 버전을 많이 사용한다. - 이번 수업에서는 tomcat 8 버전을 다운받았다. - 자동으로 윈도우에 설치해주는 파일을 다운받자. - tomcat 의 bin 폴더에 startup 파일을 실행시키고 - 해당 사진처럼 아래에 start Server startup in - ms 가 뜨면 정상적으로 실행중이다. - 톰캣 실행 도중 문제가 발생하면 실행 창이 닫힌다. - 정상적으로 실행 중이라면, http://localhost:8080/ 주소로 이동하면 다음과 같은 화면이 나타난다 - 톰캣을 종료하려면 명령프롬프트에서 ctrl + c 키를 누른다 2 _ eclipse와 연결하기 : 서버 실행 환경 설정하기 - window - preference 로 이동, server - ru..
-
useEffectReact 2023. 3. 19. 22:50
- useEffect : api 처럼 렌딩할 때 불러들였던 정보를 다시는 부르고 싶지 않을 때 ( 한번만 불러도 될 때 ) 사용한다. 어떤 로그들은 렌딩할 때 다 같이 렌딩 된다. 하지만 같은 데이터가 주어질 때 거부하는 방법이 있다. useEffect( 실행하고싶은함수 , [keyword] ); -> keyword의 값이 변할 때만 함수를 실행시킨다. 이를 이용해서 api를 처음 한 번만 불러오는 등 함수의 실행을 제어할 수 있다. useEffect( 실행하고싶은함수 , [] ); -> 키워드에 값이 없으면 한번만 실행하고 다시 실행할 수 없다. *** Create React App 의 index.js 에는 의 형식으로 App을 불러들인다. 따라서 새로고침 할 경우 app의 랜더링이 항상 2번씩 된다...
-
prop-types카테고리 없음 2023. 3. 19. 22:50
npm i prop-types prop-types 를 설치해준다. - .js 파일에서 다양한 모듈을 불러와서 import하고 export 하는 것으로 컴포넌트를 생성, 적용 할 수 있다. 만일 같은 폴더 내부에 있는 파일이라면, import Something from "./파일명" - 처럼 파일명 앞에 ./을 붙여준다 컴포넌트를 불러올 때 사용했던 props 의 타입을 지정할 때도 propTypes을 설치했기 때문에 매우 편리하다. 또한 특정 컴포넌트만을 위한 css 요소 파일도 만들 수 있다. ( CSS 모듈을 여러개 작성함 ) 컴포넌트의 가장 큰 특징으로는, 각각의 컴포넌트를 생성하고 컴포넌트 만의 css를 생성해서 하나로 묶어서 생산하던 html, css, javascript를 분리해서 관리할 수 ..
-
React Router (ver. 6 이상)React 2023. 3. 19. 21:35
React Router (ver. 6 이상) create-react-app 명령이 실행된 경로에서 npm install react-router-dom 버전을 지정해서 받고싶다면 npm install react-router-dom@버전 - package.json 돌더 내부에 react-fouter-dom 요소가 추가되어있다 ( ^6.9.0 ) 버전 - 리액트 라우터는 flask에서 URL/keyword 를 설정해서 홈 페이지의 스크린(구획)을 이동하는 것 처럼 홈페이지를 주제에 맞게 나눌 수 있는 기능이다. - 리액트에서는 각각의 페이지를 라우터라고 한다. 리액트의 경우 components와 routes 폴더를 생성해서 필요한 요소들을 저장해두고 사용할 수 있다. index.js - index.js 는 A..