mercredi 23 mars 2016

rg.springframework.web.servlet.PageNotFound noHandlerFound.

I've seen this question a lot but however I am still unable to fix my problem. Hope you will be able to guide me.'

I get the following exception when i try to run my super simple spring web app Mar 24, 2016 9:17:31 AM org.springframework.web.servlet.PageNotFound noHandlerFound WARNING: No mapping found for HTTP request with URI [/51SpringWebMaven/] in DispatcherServlet with name 'offers'

Please find my codebase below

OffersController Class

package com.sharat.web.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
public class OffersController {
    @RequestMapping("/")
    public String showHome(){
        return "home";
    }
}

offers-servlet.xml

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://ift.tt/GArMu6"
    xmlns:xsi="http://ift.tt/ra1lAU"
    xmlns:context="http://ift.tt/GArMu7"
    xmlns:mvc="http://ift.tt/1bHqwjR"
    xsi:schemaLocation="http://ift.tt/1bHqwjR http://ift.tt/1JwFhLV
        http://ift.tt/GArMu6 http://ift.tt/1jdM0fG
        http://ift.tt/GArMu7 http://ift.tt/1K4FMgM">


    <context:component-scan base-package="com.sharat.web.controller"></context:component-scan>
    <mvc:annotation-driven></mvc:annotation-driven>
    <bean id="jspViewResolver"
        class="org.springframework.web.servlet.view.InternalResourceViewResolver">
    <property name="prefix" value="/WEB-INF/jsps/"></property>
    <property name="suffix" value=".jsp"></property>
    </bean>
</beans>

Web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://ift.tt/ra1lAU" xmlns="http://ift.tt/nSRXKP" xsi:schemaLocation="http://ift.tt/nSRXKP http://ift.tt/LU8AHS" id="WebApp_ID" version="2.5">
  <display-name>50SpringBasicWeb</display-name>
  <welcome-file-list>
    <welcome-file>index.html</welcome-file>
    <welcome-file>index.htm</welcome-file>
    <welcome-file>index.jsp</welcome-file>
    <welcome-file>default.html</welcome-file>
    <welcome-file>default.htm</welcome-file>
    <welcome-file>default.jsp</welcome-file>
  </welcome-file-list>
  <servlet>
    <description></description>
    <display-name>offers</display-name>
    <servlet-name>offers</servlet-name>
    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
  </servlet>
  <servlet-mapping>
    <servlet-name>offers</servlet-name>
    <url-pattern>/</url-pattern>
  </servlet-mapping>
</web-app>

home.jsp

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://ift.tt/kTyqzh">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>JSP Page</title>
</head>
<body>
First JSP Home Page
</body>
</html>

Please guide me to get past this issue. I can't seem to find out what is wrong.

Thanks, Sharat

Aucun commentaire:

Enregistrer un commentaire