0

i have the following declaration in my dispatcher servlet , when i am trying to call http://localhost:9005/Appname/hello/hello.jsp it is saying

"WARNING: No mapping found for HTTP request with URI [/EtiwapproSp/WEB-INF/jsp/hello.jsp] in DispatcherServlet with name 'dispatcher' " and 404 is getting displayed. Please help

despite there is hello.jsp there in WEB-INF/jsp/hello.jsp

 <?xml version='1.0' encoding='UTF-8' ?>
<!-- was: <?xml version="1.0" encoding="UTF-8"?> -->
  <beans xmlns="http://www.springframework.org/schema/beans"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xmlns:p="http://www.springframework.org/schema/p"
   xmlns:aop="http://www.springframework.org/schema/aop"
   xmlns:tx="http://www.springframework.org/schema/tx"
    xmlns:context="http://www.springframework.org/schema/context"
   xsi:schemaLocation="http://www.springframework.org/schema/beans         http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
   http://www.springframework.org/schema/aop   http://www.springframework.org/schema/aop/spring-aop-4.0.xsd
   http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsd
">

   <context:component-scan base-package="com.intro" />

   <bean     class="org.springframework.web.servlet.view.InternalResourceViewResolver">
  <property name="prefix" value="/WEB-INF/jsp/" />
  <property name="suffix" value=".jsp" />

 </beans>

My controller

  @Controller
@RequestMapping("/hello")
public class RequestController {

@RequestMapping(value = "/hello", method = RequestMethod.GET)
  public String printHello(ModelMap model) {
  model.addAttribute("message", "Hello Spring MVC Framework!");
  return "hello";
  }
}

web.xml

<?xml version="1.0" encoding="UTF-8"?>
     <web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
   <context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>/WEB-INF/applicationContext.xml</param-value>
</context-param>
<listener>
    <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<servlet>
    <servlet-name>dispatcher</servlet-name>
    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
    <load-on-startup>2</load-on-startup>
</servlet>
<servlet-mapping>
    <servlet-name>dispatcher</servlet-name>
    <url-pattern>*.jsp</url-pattern>
</servlet-mapping>
<session-config>
    <session-timeout>
        30
    </session-timeout>
</session-config>
<welcome-file-list>
    <welcome-file>redirect.jsp</welcome-file>
</welcome-file-list>

Mohit H
  • 927
  • 3
  • 11
  • 26
  • it says : WARNING: No mapping found for HTTP request with URI [/Appname/hello/] in DispatcherServlet with name 'dispatcher' – Mohit H Oct 28 '15 at 04:20
  • added web.xml above also with /hello/hello , i am getting the same error "WARNING: No mapping found for HTTP request with URI [/EtiwapproSp/WEB-INF/jsp/hello.jsp] in DispatcherServlet with name 'dispatcher'" – Mohit H Oct 28 '15 at 04:28
  • In web.XML change the URL-pattern from *.jsp to / – Bob Oct 28 '15 at 04:32
  • Thanks bobf , i changed the same from .jsp to .htm and it worked...you gave me the hint, thanks again – Mohit H Oct 28 '15 at 04:34

0 Answers0