Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/spring/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 找不到URI为[/postest/home/segundaVista2]的HTTP请求的映射_Java_Spring_Spring Mvc_Jsf 2 - Fatal编程技术网

Java 找不到URI为[/postest/home/segundaVista2]的HTTP请求的映射

Java 找不到URI为[/postest/home/segundaVista2]的HTTP请求的映射,java,spring,spring-mvc,jsf-2,Java,Spring,Spring Mvc,Jsf 2,我正在使用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/

我正在使用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;
    }

}
@Controller(“目录控制器”)
@请求映射(“/home”)
公共类CatalogControllerImpl实现CatalogController{
私有静态最终字符串GET\u PRODUCTS\u VIEW=“index”;
公共CatalogControllerImpl(){
}
@RequestMapping(method=RequestMethod.GET)
公共字符串getProducts(映射模型){
System.out.println(“控制器->获取产品…”);
模型。put(“消息”,“Mensaje de prueba”);
System.out.println(“控制器->完成获取产品…”);
返回获取产品视图;
}
@RequestMapping(value=“primeraVista”,method=RequestMethod.POST)
公共字符串primeraVista(){
返回获取产品视图;
}
@RequestMapping(value=“segundaVista”,method=RequestMethod.POST)
公共字符串segundaVista(){
返回获取产品视图+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>

后测试
Esta es la primera vista:

您有什么建议吗?

您传入的URI是
segundaVista2
,但您的
@RequestMapping
只是
segundaVista

好的,我在修复操作错误时犯了那个错误。我将提出另一个与此示例相关的问题。谢谢