在映射网址上找不到MusicStore应用程序资源

时间:2016-04-27 13:01:15

标签: java spring hibernate maven

首先,我想按照我在https://aishwaryavaishno.wordpress.com/2013/07/12/spring-mvchibernate-annotation-based-mysql-maven-json-simple-example/

找到的教程进行操作

我已经一步一步地遵循了一切,但是当我启动我的控制器时,我得到了这个错误

 `The requested resource is not available.`

控制器代码:

@Controller
public class HomeController {

        @Autowired
        private IMusicStoreService musicStoreService;

    @RequestMapping(value="/")
    public ModelAndView test(HttpServletResponse response) throws IOException{

        return new ModelAndView("home","musicDetForm",new MusicDetails());
    }

        @RequestMapping(value="AddSong",method = RequestMethod.POST)
        @ResponseBody
        public String addSong(@ModelAttribute("musicDetForm") MusicDetails musicDetails){
           return musicStoreService.addSong(musicDetails);
        }

        @RequestMapping(value = "SongList/",method = RequestMethod.GET)
        @ResponseBody
        public List<MusicDetails> getSongList(){
            return musicStoreService.getSongList();
        }
}

这是控制器代码的github网址 https://github.com/AishwaryaThangavelu/Spring-Repository/blob/master/MusicStore/src/main/java/aish/vaishno/musicstore/controller/HomeController.java

这是我的web.xml代码

<context-param>
        <param-name>contextClass</param-name>
        <param-value>
            org.springframework.web.context.support.AnnotationConfigWebApplicationContext
        </param-value>
    </context-param>
    <listener>
        <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    </listener>

    <servlet>
        <servlet-name>SpringDispatcher</servlet-name>
        <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
        <init-param>
            <param-name>contextClass</param-name>
            <param-value>
                org.springframework.web.context.support.AnnotationConfigWebApplicationContext
            </param-value>
        </init-param>
        <init-param>
            <param-name>contextConfigLocation</param-name>
            <param-value>aish.vaishno.musicstore</param-value>
        </init-param>
        <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
        <servlet-name>SpringDispatcher</servlet-name>
        <url-pattern>/</url-pattern>
    </servlet-mapping>

假设一切都没问题,请问我出错了什么。

0 个答案:

没有答案