RequestMapping:路径未定义

时间:2015-12-01 02:18:27

标签: spring annotations request-mapping

我引用this Spring doc并尝试将数据绑定到我的视图。 我想请求我的控制器映射,说/act1和方法doohickey.do,以便完整路径为/act1/doohickey.do

然而,Eclipse说

  

注释类型RequestMapping

的属性路径未定义

它给了我org.springframework.web.context.support.XmlWebApplicationContext

的CNF

我正在使用Maven。

<dependency>
   <groupId>org.springframework</groupId>
   <artifactId>spring-orm</artifactId>
   <version>4.2.0.RELEASE</version>
</dependency>

@Controller
@RequestMapping("/act1")
public class AnnotetedControllerTest1 {

    @RequestMapping(path = "/formTest.do", method=RequestMethod.POST)
    public ModelAndView formTest(HttpServletRequest request,
            HttpServletResponse response
            ,@ModelAttribute Form1 form){

        ModelAndView mav = new ModelAndView();
        mav.setViewName("formTest1.jsp");
        return mav;


    }
}

抱歉,这些片段卡在了一起。

为什么Eclipse表示路径未定义,而文档似乎表明我可以使用此属性?

更新

我通过将path更改为value来实现它,但为什么呢? 该文件说path。我不相信该文件是错误的。也许,我正在查看错误的文件?

1 个答案:

答案 0 :(得分:0)

我也面临同样的问题。我通过改变“spring-web”依赖的版本来解决它。以前是4.1.4.RELEASE。

    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-web</artifactId>
        <version>4.2.7.RELEASE</version>
    </dependency>
相关问题