인프런 영문 브랜드 로고
인프런 영문 브랜드 로고

인프런 커뮤니티 질문&답변

송재호님의 프로필 이미지
송재호

작성한 질문수

스프링 MVC 1편 - 백엔드 웹 개발 핵심 기술

HTTP 요청 데이터 - POST HTML Form

postman 송신오류

작성

·

586

0

postman으로 post 요청을만들어 송신할 경우, 파라미터는 전달되는것 같으나 서버에서 클래스가 호출되지 않는것같습니다. 어떻게 해결할수있을까요 ? url로 넘길 경우는 제대로 됩니다.

답변 1

0

안녕하세요. 송재호님, 공식 서포터즈 OMG입니다.

http://localhost:8080/requset-param 

http://localhost:8080/request-param 

 

 

RequestParamServlet클래스

/**
 * 1. 파라미터 전송 기능
 * http://localhost:8080/request-param?username=hello&age=20
 *
 */
@WebServlet(name = "requestParamServlet", urlPatterns = "/request-param")

 

 

hello-form.html

<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<form action="/request-param" method="post">
    username: <input type="text" name="username" />
    age:      <input type="text" name="age" />
    <button type="submit">전송</button>
</form>
</body>
</html>

 

각 코드에서 request로 되어있는지,

브라우저에서 requset으로 보냈는지, request로 요청을 보냈는지 알아야 확인이 가능합니다 

 

감사합니다.

송재호님의 프로필 이미지
송재호

작성한 질문수

질문하기