카테고리 없음

[spring-mvc] Spring 4에서 jsp에서 컨트롤러로 요청을 보내는 방법은 무엇입니까?

필살기쓰세요 2021. 2. 3. 00:26

먼저 전체 요청을 받아 확인하십시오.

String req = request.getQueryString();

이 요청에서 매개 변수는 일부 네임 스페이스와 함께 저장 될 수 있습니다. 그렇다면 그 이유를 알아야합니다.

사용

<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<form:from ... modelAttribute=forgotPsw>
<form:input path="email"/>
...

양식을 Object로 변환하고 정보를 얻는 것이 더 쉬울 수 있습니다.

@RequestMapping(value="/forgotPsw.do" , method = RequestMethod.GET)
public void send(@ModelAttribute("forgotPsw")ForgotPsw forgotPsw){

class ForgotPsw {

    private String email;
        //getter and setter
        }
        


출처
https://stackoverflow.com/questions/39920133