2

I'm referencing this Spring doc and trying to bind data to my view. I wanted to request map my controller to, say /act1 and a method to doohickey.do so the complete path will be /act1/doohickey.do.

However, Eclipse says

The attribute path is undefined for the annotation type RequestMapping

And it gives me a CNF for org.springframework.web.context.support.XmlWebApplicationContext

I'm using 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;


    }
}

Sorry, the snippets got stuck together.

Why does Eclipse say path is undefined while the document seems like it's suggesting that I can use this attribute ?

Update

I got it working by changing path to value but why ?
The document says path. I don't believe the document to be erroneous. Perhaps, I'm looking at a wrong document ?

Ascendant
  • 827
  • 2
  • 16
  • 34
  • See http://docs.spring.io/spring/docs/current/javadoc-api/org/springframework/web/bind/annotation/RequestMapping.html. `path` should work fine, provided you actually use version 4.2.0 or later (it didn't exist yet, as the documentation shows). If you're not using version 4.2.0 of spring-mvc, but are using version 4.2.0 of spring-orm (which has nothing to do with RequestMapping), then you have a problem: both versions should be identical. – JB Nizet Dec 26 '15 at 23:41
  • do you have spring-cloud dependency management in your pom.xml? if yes try to change the version to Brixton.RELEASE – Ruelos Joel Jun 14 '16 at 08:32

1 Answers1

0

I have also faced the same problem. I solved it by changing the version of "spring-web" dependency. Previously it was 4.1.4.RELEASE.

    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-web</artifactId>
        <version>4.2.7.RELEASE</version>
    </dependency>