오늘보다 더 나은 내일의 나에게_

비전공자의 IoT 국비 교육 수강일지 Day_62 본문

비전공자의 코딩일지

비전공자의 IoT 국비 교육 수강일지 Day_62

chan_96 2022. 3. 17. 18:43
728x90

게시판 만들기

12. request 대신 model 사용

13. 글쓰기 버튼 추가

14. 글쓰는 페이지 boardForm.jsp 작성
더보기
<%@page import="kr.smhrd.domain.Board"%>
<%@page import="java.util.ArrayList"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html lang="en">
<head>
  <title>Bootstrap Example</title>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css">
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js"></script>
</head>
<body>
<div class="container">
  <h2>Spring WEB MVC 게시판</h2>
  <div class="panel panel-default">
    <div class="panel-heading">BOARD</div>
    <div class="panel-body">
    
		<form class="form-horizontal" action="/myapp/boardInsert.do" method="post">
		  <div class="form-group">
		    <label class="control-label col-sm-2" for="title">제목:</label>
		    <div class="col-sm-10">
		      <input type="text" class="form-control" id="title" name="title" placeholder="Enter title">
		    </div>
		  </div>
		  
		  <div class="form-group">
		    <label class="control-label col-sm-2" for="content">내용:</label>
		    <div class="col-sm-10">
		      <textarea rows="10" class="form-control" name="content"></textarea>
		    </div>
		  </div>
		  
		  <div class="form-group">
		    <label class="control-label col-sm-2" for="writer">작성자:</label>
		    <div class="col-sm-10">
		      <input type="text" class="form-control" id="writer" name="writer" placeholder="Enter writer">
		    </div>
		  </div>
		  
		  <div class="form-group">
		    <div class="col-sm-offset-2 col-sm-10">
		      <button type="submit" class="btn btn-success btn-sm">등록</button>
		      <button type="reset" class="btn btn-warning btn-sm">취소</button>
		    </div>
		  </div>
		</form>
		
	</div>
    <div class="panel-footer">지능형 IoT융합 SW전문가과정</div>
  </div>
</div>

</body>
</html>
boardController에 boardForm 추가

boardInsert 추가

15. mapper에 boardinsert 추가
=> 쿼리문에서 ? 대신 #{ } 사용

boardInsert() 수정 boardList.do로 재요청


한글 깨짐 현상


web.xml에 인코딩 추가

16. 게시물 제목 클릭 시 해당 게시물 보여주기
=> 쿼리스트링으로 게시물 번호를 보내줌


boardContent() 수정 및 boardContent.jsp 작성


17. 게시물 수정, 삭제, 리스트 보기 버튼 추가

게시물 삭제 기능 추가

 


조건문

: 상황에 따라 실행 흐름을 다르게 하는 문법

if, elif, else

 

리스트

- 파이썬의 자료구조 형태 중 하나
- 순서가 있는 수정 가능한 객체의 집합
- 대괄호([,])로 작성이 되어지고 리스트 내부의 값은 콤마(,)로 구분이 된다.
- 추가, 수정, 삭제 가능하다

메서드 정리

append( ) => 맨 뒤에 값을 추가

insert(인덱스위치, 값) => 인덱스 위치에 값을 추가

del 리스트명[인덱스값] => 리스트 값 삭제

 

remove(값) => 리스트 값 삭제


sort( ) => 리스트 오름차순 정렬


reverse( ) => 리스트 순서를 거꾸로 뒤집기

index(값) => 리스트 값 위치 반환

pop( ) => 리스트 값을 반환한 다음 리스트에서 제거
count(값) => 리스트에서 찾고자하는 데이터가 몇번 들어있는지 확인

len(리스트 명) => 리스트의 값 개수 반환
list12 = ['a','b','b','v','c','d']

튜플

- 파이썬의 자료구조
- 형태중 하나순서가 있는 집합
- 소괄호((,))로 작성이 되어지며, 튜플의 내부 값은 콤마(,)로 구분
- 추가, 수정, 삭제 불가능

 

728x90
Comments