0
我正在使用spring mvc,當我點擊它所表示的按鈕時,我無法獲得按鈕來工作:Request method'Post'not supported。春季mcv不支持請求方法'POST'
這是我的html文件:
<html>
<head>
<title>Cart</title>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
</head>
<body th:object="${picture}">
<form method="post">
Authhor: <label th:text="*{ownerName}" /><br />
Title: <label th:text="*{title}" /><br />
Description: <label th:text="*{description}" /><br />
Price: €<label th:text="*{price}" /><br />
Product: <select th:field="${productss}" th:remove="all-but-first">
<option th:each="product : ${productss}"
th:value="${product.id}" th:text="${product.name + ' (+ €' + product.price + ')'}">Productname</option>
</select><br />
<img width="250" heigth="250" th:src="*{plainURL}"/><br />
<button align="right" class="btn" type="submit" name="add" ><span class="glyphicon glyphicon-check">Add to shopping cart</span></button><br />
</form>
</body>
</html>
這是我要執行的方法:
@RequestMapping(value = IMAGE, method = RequestMethod.POST, params = {"add"})
public String add(HttpSession session, Model model) {
System.out.println("its working!");
return "/image/5";
}
我知道這questen張貼了很多,但我不能找到一個爲我工作的解決方案。
以形式'