3

here is the url-pattern in web.xml

<servlet-mapping>  
<servlet-name>dispatcher</servlet-name>  
<url-pattern>/</url-pattern>  
</servlet-mapping>  

Here is my controller

@Controller  
public class HelloController   
{  
        @RequestMapping("/*.km")  
    public String handleKm()  
    {  
        System.out.println("km ext called");  
        return "aaa";  
    }  

    @RequestMapping("/*.jsp")  
    public String handleJsp()  
    {  
        System.out.println("jsp pages called");  
        return "bbb";  
    }  
}  

while accessing the url with /requestMapping/a.km , it is works, calls the handleKm() method.but with /requestMapping/a.jsp , it should call handleJsp().but it does not work. result : HTTP Status 404 - /requestMapping/a.jsp. why ??

If I chane the url-pattern from "/" to "/*" , although both method are called , but dont get to the appropriate pages. May be the "org.springframework.web.servlet.view.InternalResourceViewResolver" is not working .

Bibhudutta
  • 31
  • 3

1 Answers1

0

Check out this related SO post (possibly a duplicate). I think the .jsp extension is confusing the dispatcher servlet. Try using an extension that isn't .jsp and see if that works.

Community
  • 1
  • 1
Chris Thompson
  • 35,167
  • 12
  • 80
  • 109