SW과정 Spring 12일차 - 0810

JongseokLee·2021년 8월 10일
0
post-thumbnail

SW과정 Spring 12일차 - 0810

게시판 만들기

package com.ksa.fullstack.bbs.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;

import com.ksa.fullstack.bbs.dto.BBSDto;
import com.ksa.fullstack.bbs.service.BBSService;

@Controller
public class BBSController {
   
   @Autowired
   private BBSService bbsService;
   
//   @RequestMapping("/list.bbs")
//   @RequestMapping(value="/list.bbs" ,method = RequestMethod.GET)
   @GetMapping("/list.bbs")
   public String list() {
      return "list";
   }
   
   @GetMapping("/write.bbs")
      public String writeFrom() {
         return "write";
      }
   
   @PostMapping("/write.bbs")
//      public String write(@RequestParam("title") String title, @RequestParam("content") String content) {
//      System.out.println(title);
//      System.out.println(content);
   public String write(BBSDto article) {
      System.out.println(article.getTitle());
      System.out.println(article.getContent());
         return "write";
      }

}

create user 유저명 identified by 비밀번호

hr 계정의 lock을 푸는 명령어
alter user hr account unlock
비밀번호 변경하는 명령어
alter user hr identified by ID

package com.ksa.fullstack.bbs.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;

import com.ksa.fullstack.bbs.dto.BBSDto;
import com.ksa.fullstack.bbs.service.BBSService;

@Controller
public class BBSController {
   
   @Autowired
   private BBSService bbsService;
   
//   @RequestMapping("/list.bbs")
//   @RequestMapping(value="/list.bbs" ,method = RequestMethod.GET)
   @GetMapping("/list.bbs")
   public String list() {
      return "list";
   }
   
   @GetMapping("/write.bbs")
      public String writeFrom() {
         return "write";
      }
   
   @PostMapping("/write.bbs")
//      public String write(@RequestParam("title") String title, @RequestParam("content") String content) {
//      System.out.println(title);
//      System.out.println(content);
   public String write(BBSDto article) {
//      System.out.println(article.getTitle());
//      System.out.println(article.getContent());
      bbsService.write(article);
         return "write";
      }

}
profile
DataEngineer Lee.

0개의 댓글