ビューを解決するために InternalResourceViewResolver を使用していますが、ビューからコントローラーへのアクションを実行しようとすると、RequestMethod.POST を使用するメソッドに問題があります。次のエラーが表示されます。
11:29:34,375 WARN [org.springframework.web.servlet.PageNotFound] (http-localhost-127.0.0.1-8080-1) No mapping found for HTTP request with URI [/PostTest/home/segundaVista2] in DispatcherServlet with name 'dispatcherServlet'
私のコントローラーはこれです:
@Controller("CatalogController")
@RequestMapping("/home")
public class CatalogControllerImpl implements CatalogController {
private static final String GET_PRODUCTS_VIEW = "index";
public CatalogControllerImpl() {
}
@RequestMapping(method=RequestMethod.GET)
public String getProducts(Map<String, Object> model) {
System.out.println("Controller -> Getting products...");
model.put("message", "Mensaje de prueba");
System.out.println("Controller -> Finishing getting products...");
return GET_PRODUCTS_VIEW;
}
@RequestMapping(value="primeraVista", method=RequestMethod.POST)
public String primeraVista() {
return GET_PRODUCTS_VIEW;
}
@RequestMapping(value="segundaVista", method=RequestMethod.POST)
public String segundaVista() {
return GET_PRODUCTS_VIEW + 2;
}
}
そして、私の見解は次のとおりです。
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core"
xmlns:p="http://primefaces.org/ui">
<h:head>
<title>Post test</title>
</h:head>
<h:body>
<form method="post" action="home/segundaVista2">
<!--p:commandButton id="showMessage" value="showMessage" action="#{CatalogController.showMessage}" ajax="false" /-->
Esta es la primera vista: <input type="submit" />
</form>
</h:body>
</html>
何か提案はありますか?