분류 전체보기

    👾[spring] Error creating bean with name 빈생성오류

    👾[spring] Error creating bean with name 빈생성오류

    Error Detail org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'emailServiceImpl' 에러해결 src/main/webapp/WEB-INF/web.xml 에 하단 코드 입력하니 해결완료

    [Spring] Model

    Model 스프링 MVC는 모델이라는 데이터를 JSP에 전달해야한다. Model은 addAttribute( ) 메소드를 사용하여 뷰에 전달할 이름과 값을 지정가능하다. 👉 listController @GetMapping("/list") public void list(Model model){ log.ingo("list....") model.addAttibute("message", "hello world"); } 👉 list.jsp ${message} 🔔 Model에 담긴 데이터는 HttpServletRequest의 setAttribute()와 동일한 동작을 수행하기에 jsp에서 바로 사용가능하다. ➕ @ModelAttribute 1. 파라미터로 DTO를 받는 경우 jsp에서는 별도의 처리없이 ${listD..

    [JAVA] Arrays.sort( ) 오름차순, 내림차순

    [JAVA] Arrays.sort( ) 오름차순, 내림차순

    자바에서 배열이나 리스트를 정렬하고자 한다면 java.util.Arrays 클래스의 sort( ) 메서드를 사용하면 간편하게 정렬가능하다. 👉 배열 오름차순 정렬 import java.util.Arrays; public class arraysort { public static void main(String[] args) { int arr[] = {3,27,32,11,16,29}; Arrays.sort(arr); for (int i : arr) { System.out.print("["+i+"]"); } } } 👉 배열 내림차순 정렬 배열을 내림차순으로 정렬하기 위해 Collections 클래스의 reverseOrder( ) 함수를 사용하자. import java.util.Arrays; import java..

    [Spring] RedirectAttributes

    [Spring] RedirectAttributes

    PRG 패턴이란? - POST방식으로 어떤 처리를 하고 Redirect하여 GET방식으로 특정한 페이지로 이동하는 패턴 스프링MVC에서는 PRG패턴을 위해 RedirectAttributes 타입을 제공한다. addAttribute( 키, 값) - 리다이렉트할때 쿼리 스트링이 되는 값을 지정 - URL에 쿼리 스트링으로 추가된다. addFlashAttribute( 키, 값 ) - 일회용으로 데이터를 전달하고 삭제되는 값을 지정 - URL에 보이지는 않지만 JSP에서 일회용으로 사용가능 ✔ RedirectAttributes 예시 👉testcontroller @GetMapping("/test01") public String test01(RedirectAttributes redirectAttributes) { ..

    [Spring] 스프링에서 사용하는 어노테이션

    👉 컨트롤러 선언부에 사용되는 어노테이션 @Controller : 스프링 빈 처리를 명시 @RestController : REST방식의 처리를 위한 컨트롤러임을 명시 @RequstMapping :특정한 URL 패턴에 맞는 컨트롤리인지를 명시 👉 메소드 선언부에 사용되는 어노테이션 @GetMapping @PostMapping @PutMapping @DeleteMapping @RequstMapping : GET/POST 두 방식을 모두 지원하는 경우 사용 @ResponseBody : 주로 비동기처리시 사용 👉 메소드 파라미터에 사용되는 어노테이션 @RequstParam : Request에 있는 특정한 이름의 데이터를 파라미터로 받아 처리하는 경우 사용 @PathVariable : URL 경로의 일부를 변수로..