Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[20210201] 리눅스, jQuery, Spring(@ModelAttribute, VO + MultipartFile 포스트맨 테스트) #28

Open
JuHyun419 opened this issue Feb 1, 2021 · 0 comments

Comments

@JuHyun419
Copy link
Owner

JuHyun419 commented Feb 1, 2021

리눅스 last

  • 접속 기록 확인
  • 특정 계정 접속 확인: last <계정명>
  • ex) last root

리눅스 계정 목록 보기

  • cat /etc/passwd

jQuery is()

  • 특정 요소가 선택 요소와 관련된 값이나 현재의 상태 등을 확인할 때 사용하는 메서드
  • boolean형으로 true or false 리턴
$("선택요소").is("비교할 요소 or 표현식);

// 체크박스 선택여부 
$("input:checkbox[name='checkBoxType']").is(":checked");


<tr>
	<th width="100">체크 박스</th>
	<td><input type="checkbox" size="50" name="checkBoxType" value="Y"/></td>
</tr>

Spring @ModelAttribute, @requestbody, @consumes, @produces

  • @requestbody는 Request의 Body에 JSON이나 xml 값으로 요청을 하고, HttpMessageConverter를 통해 DTO 객체에 맞는 타입으로 바인딩을 시켜준다.
  • @ModelAttribute는 Entity에 Setter메소드가 있어야 바인딩을 시켜준다.
  • @consumes : 수신 하고자하는 데이터 포맷을 정의한다.
  • @produces : 출력하고자 하는 데이터 포맷을 정의한다.
  • 참고: https://2ham-s.tistory.com/292

Spring 파일처리(MultipartFile) + VO 포스트맨 테스트하기

 @PostMapping(path = "user/join", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
 @ApiOperation(value = "회원가입")
  public User join(
          @ModelAttribute JoinRequest joinRequest,
          @RequestPart(required = false) MultipartFile file) {
      // ...

// JoinRequest 클래스(ModelAttribute =>Setter 메소드 필수 !!)
public class JoinRequest {

  @ApiModelProperty(value = "이름", required = true)
  private String name;

  @ApiModelProperty(value = "로그인 이메일", required = true)
  private String principal;

  @ApiModelProperty(value = "로그인 비밀번호", required = true)
  private String credentials;

  public JoinRequest() {}

  // Getter, Setter, toString 생략
  ...

}

캡처2

캡처1

캡처3


Header에서 Content-Length, Host 필수 체크 !!

@JuHyun419 JuHyun419 changed the title [20210201] 리눅스 last, 계정 목록보기, jQuery is() [20210201] 리눅스, jQuery, Spring(@ModelAttribute, VO + MultipartFile 포스트맨 테스트) Feb 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant