19.05.15 jsp 쇼핑몰-Center, RentcarMain (동영상 58강)

Back-End/JSP 2019. 5. 15. 10:24


Center.jsp, RentcarMain.jsp 페이지 만들기




Center.jsp (중간부분에 출력될 페이지)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
    <center>
        <table width="1000">
            <tr height="600"<!-- 센터에 출력될 이미지를 추가 -->
                <td align="center"><img alt="" src="img/Main.png" height="470"
                    width="1000"></td>
            </tr>
        </table>
    </center>
</body>
</html>
cs



RentcarMain.jsp (Top, Center, Bottom을 취합할 메인 페이지)

1
2
3
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
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<body>
 
    <%
        String center = request.getParameter("Center");
        //처음 실행시에는 center 값이 넘어오지 않기에 반드시  null처리를 해야한다.
        //처리를 하지않으면 에러가 발생될수 있다.
        if (center == null) {
            center = "Center.jsp"//디폴트 center값을 부여(첫 화면에는 center이 뜨도록 한다는 말)    
        }
    %>
    <center>
        <table width="1000">
 
            <!-- Top 부분 -->
            <tr height="140" align="center">
                <!-- include page를 사용하여서 main페이지에서 각 페이지가 호출될수 있도록 한다. -->
                <td align="center" width="1000"><jsp:include page="Top.jsp" /></td>
            </tr>
 
            <!-- Center 부분 -->
            <tr align="center">
                <!-- Top랑,Bottom은 화면이 넘어가더라도 바뀌지 않지만 center은 계속 바뀌기 때문에 center값을 준다 -->
                <td align="center" width="1000"><jsp:include
                        page="<%=center%>" /></td>
            </tr>
 
            <!-- Bottom 부분 -->
            <tr height="140" align="center">
                <td align="center" width="1000"><jsp:include page="Bottom.jsp" /></td>
            </tr>
 
        </table>
    </center>
</body>
</html>
cs



:

알고리즘 Two Sum 푸는중

Algorithm/풀고있는문제 2019. 5. 14. 23:59

 
 
cs

 

1
2
3
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
45
46
package algorithm;
 
public class Soulution {
 
    static int[] nums = { 271115 };
 
    static int target = 9;
 
 
    public static int[] twoSum(int[] nums, int target) {
        int i = 0;
        int j = 0;
 
        for (i = 0; i < nums.length; i++) {
            
            for (j = 0; j < nums.length; j++) {
            
            if (nums[i] + nums[j] == target) {
                
                int min = nums[j];
                int max = nums[i];
 
                int min_index = j;
                int max_index = i;
                
                
                System.out.println("더해서 target가 나오는 첫번째 값 = " + min);
                System.out.println("더해서 target가 나오는 두번째 값 = " + max);
 
                System.out.println("더해서 target가 나오는 첫번째 값의 인덱스값 = " + min_index);
                System.out.println("더해서 target가 나오는 두번째 값의 인덱스 값 = " + max_index);
                
            }else break;
            
        }
    }
        
        return nums;
}
    public static void main(String[] args) {
 
        twoSum(nums, target);
 
    }
}
 
cs
:

19.05.14 jsp 쇼핑몰-Top, Bottom (동영상 57강)

Back-End/JSP 2019. 5. 14. 18:17

상단에 출력할 파일과 하단에 출력할 파일을 작성



Top.jsp (상단)


1
2
3
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
45
46
47
48
49
50
51
52
53
54
55
56
57
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<body>
 
    <!-- 세션을 이용한 로그인 처리 -->
    <!-- 세션으로 받아온 값은 오브젝트 타입이기 때문에 String 타입으로 컨버팅 한다. -->
 
    <% 
    String id = (String) session.getAttribute("id");
 
    //로그인이 되어있지 않다면 id에 "GUEST"값을 준다
    if(id==null)
    {
        id="GUEST";
    }
%>
 
    <table width="1000" bordercolor="white">
        <tr height="70">
            <td colspan="4">
                <!-- 이미지를 불러오기위한 태그 작성 --> <img alt="" src="img/RENT.jpg" width="65">
            </td>
            <td align="center" width="200"><%=id %> 님 반갑습니다.</td>
        </tr>
 
        <tr height="50">
            <td align="center" width="200" bgcolor="pink">
                <!-- 글자를 누르면 화면이 넘어갈수 있도록 a태그를 걸어줌 --> <font color="white" size="5"><a
                    href="#" style="text-decoration: none"> 예 약 하 기 </a></font>
            </td>
 
            <td align="center" width="200" bgcolor="pink">
                <!-- 글자를 누르면 화면이 넘어갈수 있도록 a태그를 걸어줌 --> <font color="white" size="5"><a
                    href="#" style="text-decoration: none"> 예 약 확 인</a></font>
            </td>
 
            <td align="center" width="200" bgcolor="pink">
                <!-- 글자를 누르면 화면이 넘어갈수 있도록 a태그를 걸어줌 --> <font color="white" size="5"><a
                    href="#" style="text-decoration: none"> 자 유 게 시 판 </a></font>
            </td>
 
            <td align="center" width="200" bgcolor="pink">
                <!-- 글자를 누르면 화면이 넘어갈수 있도록 a태그를 걸어줌 --> <font color="white" size="5"><a
                    href="#" style="text-decoration: none"> 이 벤 트 </a></font>
            </td>
 
            <td align="center" width="200" bgcolor="pink">
                <!-- 글자를 누르면 화면이 넘어갈수 있도록 a태그를 걸어줌 --> <font color="white" size="5"><a
                    href="#" style="text-decoration: none"> 고 객 센 터 </a></font>
            </td>
        </tr>
 
    </table>
</body>
</html>
cs




Bottom.jsp (하단)


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<body>
 
    <table width="1000">
        <tr height="100">
            <td align="center">
                <hr color="red" size="5"> 이용약관 이메일 무단수집거부 개인정보 취급(처리)방침 윤리경영
                보안신고 Contact Us 사업장 소개 사이트맵 웹접근성 도움말<br> 배드민턴단 COPYRIGHT@2015
                SAMSUNG ELECTRO-MECHANICS, All rights reserved.
 
            </td>
        </tr>
    </table>
</body>
</html>
cs


:

백엔드, 프론트엔드 로드맵

개인 공부 2019. 5. 14. 16:31




:

19.05.14 jsp 쇼핑몰-DB테이블,빈클래스 (동영상 56강)

Back-End/JSP 2019. 5. 14. 14:54



테이블 구조


필드명

데이터 타입

설명 

NO

Int

자동차 식별자

Name

String

자동차 이름

Catefory

Int

자동차 구분

Price

Int

자동차 가격

Usepeople

Int

자동차 사용가능 인원

Company

String

자동차 회사

Img

String

자동차 이미지

Info

String

자동차 설명





DB테이블 생성





CarListBean (빈클래스)


1
2
3
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
package db;
 
public class CarListBean { //빈 클래스 생성함
    
    private int no;
    private String name;
    private int category;
    private int price;
    private int usepeople;
    private String img;
    private String info;
    
    
    public int getNo() {
        return no;
    }
    public void setNo(int no) {
        this.no = no;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public int getCategory() {
        return category;
    }
    public void setCategory(int category) {
        this.category = category;
    }
    public int getPrice() {
        return price;
    }
    public void setPrice(int price) {
        this.price = price;
    }
    public int getUsepeople() {
        return usepeople;
    }
    public void setUsepeople(int usepeople) {
        this.usepeople = usepeople;
    }
    public String getImg() {
        return img;
    }
    public void setImg(String img) {
        this.img = img;
    }
    public String getInfo() {
        return info;
    }
    public void setInfo(String info) {
        this.info = info;
    }
    
}
 
cs




RentCar - > WebContent - > img (이미지 파일들을 넣을 폴더) 생성


이미지는 https://cafe.naver.com/contentskorealab 에서 다운받음 (자동차 사진들)





DB테이블에 자료 추가함


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
insert into rentcar values (1, '아반테',1,2000,4,'현대',avante.jpg','아반테 자동차 입니다.');
insert into rentcar values (2, 'BMW' , 3, 6000, 5, 'BMW', 'bmw.jpg', 'bmw 자동차 입니다.');
insert into rentcar values (3, '카니발' , 3, 4000, 7, '현대', 'canival.jpg', '카니발 자동차 입니다.');
insert into rentcar values (4, '카렌스' , 2, 2500, 7, '현대', 'carens.jpg', '카렌스 자동차 입니다.');
insert into rentcar values (5, '코란도' , 2, 3000, 4, '쌍용', 'korando.jpg', '코란도 자동차 입니다.');
insert into rentcar values (6, '에쿠스' , 3, 7000, 4, '현대', 'equus.jpg', '에쿠스 자동차 입니다.');
insert into rentcar values (7, '제네시스' , 3, 6000, 4, '현대', 'genesis.jpg', '제네시스 자동차 입니다.');
insert into rentcar values (8, '그랜져' , 3, 5000, 4, '현대', 'grandeur.jpg', '그랜져 자동차 입니다.');
insert into rentcar values (9, 'K3' , 1, 2000, 5, '기아', 'K3.jpg', 'K3 자동차 입니다.');
insert into rentcar values (10, 'K5' , 2, 2500, 4, '기아', 'K5.jpg', 'K5 자동차 입니다.');
insert into rentcar values (11, 'K7' , 3, 3000, 4, '기아', 'K7.jpg', 'K7 자동차 입니다.');
insert into rentcar values (12, 'K9' , 3, 4000, 4, '기아', 'K9.jpg', 'K9 자동차 입니다.');
insert into rentcar values (13, '라세티' , 1, 2000, 4, '현대', 'lacetti.jpg', '라세티 자동차 입니다.');
insert into rentcar values (14, 'lf소나타' , 2, 3000, 4, '현대', 'lfsonata.jpg', 'LF소나타 자동차 입니다.');
insert into rentcar values (15, '말리부' , 2, 3000, 4, 'GM', 'malibu.jpg', '말리부 자동차 입니다.');
insert into rentcar values (16, '모닝' , 1, 2000, 4, 'GM', 'mornig.jpg', '모닝 자동차 입니다.');
insert into rentcar values (17, '올란도' , 2, 3000, 5, 'GM', 'orlando.jpg', '올란도 자동차 입니다.');
insert into rentcar values (18, '레이' , 1, 2500, 4, '기아', 'ray.jpg', '레이 자동차 입니다.');
insert into rentcar values (19, 'SM5' , 2, 3000, 4, '삼성', 'sm5.jpg', 'SM5 자동차 입니다.');
insert into rentcar values (20, 'SM7' , 3, 4000, 4, '삼성', 'sm7.jpg', 'SM7 자동차 입니다.');
insert into rentcar values (21, '소렌토' , 2, 3000, 4, '현대', 'sorento.jpg', '소렌토 자동차 입니다.');
insert into rentcar values (22, '소울' , 1, 2500, 4, '기아', 'soul.jpg', '소울 자동차 입니다.');
insert into rentcar values (23, '스파크' , 1, 2000, 4, '현대', 'spark.jpg', '스파크 자동차 입니다.');
insert into rentcar values (24, '스포티지' , 2, 3000, 4, '현대', 'sportage.jpg', '스포티지 자동차 입니다.');
insert into rentcar values (25, '스타렉스' , 3, 4000, 11, '현대', 'starrex.jpg', '스타렉스 자동차 입니다.');
insert into rentcar values (26, '투리스모' , 3, 4000, 9, '기아', 'turismo.jpg', '투리스모 자동차 입니다.');
cs




:

19.05.13 jsp 쇼핑몰 - DAO클래스 (동영상 55강)

Back-End/JSP 2019. 5. 13. 16:45


홈페이지 (버튼별 기능)


(Top, Center, Botton) 부분적으로 제작해서 Main에 출력이 되게끔 한다.



  로그인 : 로그인이 안된 상태에서는 guest라고 뜨고, 로그인 된 상태일때는 이름이 뜬다.


  예약하기 : 대형~소형 카테고리를 구분지어서 출력되게 하고 예약할 수 있게 한다.


  예약확인 : 아이디, 비밀번호를 넣어서 예약이 잘 되었는지 확인할 수 있음


  자유게시판  


  이벤트 : 주중 10퍼 할인 쿠폰 등 행사 안내


  고객센터 : 고객센터 주소 등...





커넥션풀을 사용하기 위해 server.xml에 코드 추가


1
2
3
4
5
6
7
<Context docBase="RentCar" path="/RentCar" reloadable="true" source="org.eclipse.jst.jee.server:RentCar" >
       <Resource auth = "Container" driverClassName = "oracle.jdbc.driver.OracleDriver" loginTimeout = "10" maxWait = "5000" name = "jdbc/pool" password = "123456" type = "javax.sql.DataSource" url = "jdbc:oracle:thin:@localhost:1521:xe" username = "system"/> 
      </Context>
      </Host>
    </Engine>
  </Service>
</Server>
cs




DAO클래스 및 (Top, Bottom, Center, RentcarMain) jsp 파일 생성






RentcarDAO.java (DB연결)


1
2
3
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
package db;
 
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
 
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.sql.DataSource;
 
public class RentcarDAO {
 
    Connection con;
    PreparedStatement pstmt;
    ResultSet rs;
 
    // 커넥션풀을 이용한 데이터베이스 연결
 
    public void getcon() {
 
        // DB에 접속할때는 예외처리를 실시해야됨
        try {
 
            Context initctx = new InitialContext(); // 외부서버로 부터 데이터를 읽어들이는것이기 때문에 드라이버가 없을수 있어
            Context envctx = (Context) initctx.lookup("java:comp/env"); // 자바를 읽어들일수 있는 환경에서 사용 //예외처리를 해준다.
            DataSource ds = (DataSource) envctx.lookup("jdbc/pool");
            con = ds.getConnection();
            // 데이터소스에 username, url, password를 집어넣는다. 그렇게 하면 데이터소스가 커넥션을 얻어 온다.
            // jdbc/pool에 있는 데이터소스를 사용할수 있다.
        } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
 
        }
    }
}
 
cs



:

웹 프로그래머 포트폴리오 작성 팁

개인 공부 2019. 5. 13. 15:43

출처


https://velog.io/@chris/%EC%9B%B9-%EA%B0%9C%EB%B0%9C%EC%9E%90-%ED%8F%AC%ED%8A%B8%ED%8F%B4%EB%A6%AC%EC%98%A4%EB%A5%BC-%EC%9C%84%ED%95%9C-10%EA%B0%80%EC%A7%80-%ED%8C%81


출처

https://loveiskey.tistory.com/239

'개인 공부' 카테고리의 다른 글

개인 프로젝트 ppt 수정본  (0) 2019.05.16
백엔드, 프론트엔드 로드맵  (0) 2019.05.14
공부해야될것들  (0) 2019.05.13
홈페이지 디자인 다운받을만한 곳  (0) 2019.05.07
리눅스 공부  (0) 2019.05.02
:

공부해야될것들

개인 공부 2019. 5. 13. 11:38

Spring (Lagacy)
30강짜리 강의 오렌지색

https://www.youtube.com/watch?v=KkMlhnEI9ds&list=PLY9pe3iUjRrRiJeg0jw22yW1G5yzAdiqC




Spring Boot
Spring boot 백기선 40강짜리
https://www.youtube.com/results?search_query=Spring+boot+%EB%B0%B1%EA%B8%B0%EC%84%A0



자바 스크립트 (102강짜리)

https://www.youtube.com/watch?v=PZIPsKgWJiw&list=PLuHgQVnccGMA4uSig3hCjl7wTDeyIeZVU



이론 (토비)




취업하면 인프런(백기선 강의) 보기




알고리즘
https://leetcode.com/problemset/all/




자바 자료구조
https://www.tutorialspoint.com/java/java_data_structures.htm




트레일로 회원가입

https://trello.com/?&aceid=&adposition=1t1&adgroup=54875417985&campaign=1018285860&creative=270057463393&device=c&keyword=trello&matchtype=e&network=g&placement=&ds_kids=p33209080176&ds_e=GOOGLE&ds_eid=700000001557344&ds_e1=GOOGLE&gclid=EAIaIQobChMI0Z_Y-sWX4gIVk3ZgCh2s7AzIEAAYASAAEgJ-jfD_BwE&gclsrc=aw.ds




기술면접 예상질문

https://www.youtube.com/watch?v=CbYdP2sOvig

: