본문 바로가기
내가 쓰는 글/일상

웹 프로젝트 4일차 - 주말은 없다

by Diligejy 2019. 3. 30.

토요일이다. 

하지만 저번에 선생님이 건강검진을 받으셔야 했던 이유로 공강을 했던 적이 있기 때문에 

오늘도 보강을 하며 프로젝트를 진행중이다.

 

게시물 상세보기는 참 구현하기 힘들다.

 

requestScope를 찾아보고 있다.

https://programmingsummaries.tistory.com/833

 

JSP 정리 - 익스프레션 언어

request.setAttribute("id", "ahn"); 이면 이것을 ${id} 로 값을 가져올 수 있다. 그런데 만약 request 외에도 session.setAttribute("id", "korea"); 라고 되어 있으면, 두개의 네임값이 같으므로 문제가 생길 수..

programmingsummaries.tistory.com

여기서 알게된 사실은

get이나 post방식으로 넘어온 값들을 ${param.이름}형식으로 가져와야 하고, 

request.setAttribute("이름", "값");으로 저장한 값들은 ${request.이름}형식으로 가져온다는 사실을 기억하자.

 

였다.

 

index.jsp를  수정하고

 

 

 

 

org.springframework.web.bind.annotation

Annotation Type RequestParam

  •  



    @Target(value=PARAMETER) @Retention(value=RUNTIME) @Documented public @interface RequestParam

    Annotation which indicates that a method parameter should be bound to a web request parameter.

    Supported for annotated handler methods in Spring MVC and Spring WebFlux as follows:

    • In Spring MVC, "request parameters" map to query parameters, form data, and parts in multipart requests. This is because the Servlet API combines query parameters and form data into a single map called "parameters", and that includes automatic parsing of the request body.
    • In Spring WebFlux, "request parameters" map to query parameters only. To work with all 3, query, form data, and multipart data, you can use data binding to a command object annotated with ModelAttribute.

    If the method parameter type is Map and a request parameter name is specified, then the request parameter value is converted to a Map assuming an appropriate conversion strategy is available.

    If the method parameter is Map<String, String> or MultiValueMap<String, String> and a parameter name is not specified, then the map parameter is populated with all request parameter names and values.

    Since:2.5Author:Arjen Poutsma, Juergen Hoeller, Sam BrannenSee Also:RequestMapping, RequestHeader, CookieValue
    • Optional Element SummaryOptional ElementsModifier and TypeOptional Element and Description
      java.lang.String defaultValue

      The default value to use as a fallback when the request parameter is not provided or has an empty value.

      java.lang.String name

      The name of the request parameter to bind to.

      boolean required

      Whether the parameter is required.

      java.lang.String value

      Alias for name().

댓글