Spring/Hibernate에서 매우 간단한 형식을 시도합니다. 데이터베이스에 항목을 추가해야합니다. 이것은 나를 위해 일한 예제를 기반으로하므로이 오류가 발생한다는 것은 이상한 일입니다. 그러나 그것이 바로 그 것이다."HTTP 상태 405 - 양식 제출시 요청 방법 'POST'가 지원되지 않습니다.
다음은 양식 페이지의 :
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
<html>
<head><title>Add Owned Game</title></head>
<body>
<h1>Add Owned Game</h1>
<br />
<br />
<c:url var="saveGameeUrl" value="/games/save.html" />
<form:form modelAttribute="game" method="POST" action="${saveGameUrl}">
<form:label path="title">Game Title:</form:label>
<form:input path="title" />
<br />
<input type="submit" value="Add Game" />
</form:form>
</body>
</html>
그리고 여기에 관련 제어 방법 : 당신은 무엇을보고해야하는 경우
@RequestMapping(value = "/save", method = RequestMethod.POST)
public ModelAndView saveGame(@ModelAttribute("game") Game game,
BindingResult result) {
gameService.addOwnedGame(game);
return new ModelAndView("redirect:/games/owned.html");
}
알려주세요.
서버 로그를 보았습니까? – PhD
서버 로그에 아무것도 없습니다. – lashiel