shaan_046 0 Newbie Poster

Error :: org.springframework.web.servlet.DispatcherServlet noHandlerFound

I am attaching all the relevant files. Please help..??

web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" version="2.5">
  <servlet>
    <servlet-name>loginSer</servlet-name>
    <servlet-class>  
            MyPackage.LoginServlet  
        </servlet-class>
  </servlet>
  <servlet-mapping>
    <servlet-name>loginSer</servlet-name>
    <url-pattern>/LoginServlet.do</url-pattern>
  </servlet-mapping>
  
  
  <servlet>
    <servlet-name>Timeserv</servlet-name>
    <servlet-class>  
            MyPackage.TimeServlet  
        </servlet-class>
  </servlet>
  <servlet-mapping>
    <servlet-name>Timeserv</servlet-name>
    <url-pattern>/timeservlet</url-pattern>
  </servlet-mapping>
  
  
  <servlet>
    <servlet-name>filter</servlet-name>
    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
  </servlet>
 <servlet-mapping>
    <servlet-name>filter</servlet-name>
    <url-pattern>*.jsp</url-pattern>
  </servlet-mapping>
  
  
  
  <welcome-file-list>
    <welcome-file>
      loginfinal.jsp
    </welcome-file>
  </welcome-file-list>
</web-app>

filter-servlet.xml

<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:jee="http://www.springframework.org/schema/jee"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-2.5.xsd
http://www.springframework.org/schema/jee
http://www.springframework.org/schema/jee/spring-jee-2.5.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-2.5.xsd">
        
        
 <context:annotation-config/>

<context:component-scan base-package="controller.web" use-default-filters="false">
<context:exclude-filter expression="org.springframework.stereotype.Controller" type="annotation"/>
</context:component-scan>
  <bean name="/Filter.jsp" class="controller.web.FilterController"/>
 
  <bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
      <property name="viewClass" value="org.springframework.web.servlet.view.JstlView"/>
      <property name="prefix" value="/jsp/"/>
      <property name="suffix" value=".jsp"/>
  </bean>
 
</beans>

FilterController.java

package controller.web;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;


public class FilterController implements org.springframework.web.servlet.mvc.Controller {
	

	
	@Override
	public ModelAndView handleRequest(HttpServletRequest arg0,
			HttpServletResponse arg1) throws Exception {
		String name = arg0.getParameter("name");
		ModelAndView obj = new ModelAndView("render");
		obj.addObject("message", name);
		return obj;
	}
	
}

Filter.jsp(please ignore dojo and html tags , i am attaching sending form tag elements)

<form id="filterformid" name="filterform" action="/Filter" method="get">
Enter the Name of the person :: <input id="nameid" type="text" name="name" dojoType="dijit.form.TextBox"/><br><br><br>

Enter the Product :: <input id="productid" type="text" name="product" dojoType="dijit.form.TextBox"/><br><br><br>

Enter the Status :: <input id="statusid" type="text" name="status" dojoType="dijit.form.TextBox"/><br><br><br>

Start date :: <input id="sdateid" name="sdate" dojoType="dijit.form.DateTextBox"/><br><br><br>

End Date :: <input id="edateid" name="edate" dojoType="dijit.form.DateTextBox"/><br><br><br>

<button type="submit" name="submit"></button> 


</form>

render.jsp

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
    <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>

<p>The message is :: ${message}</p>

</body>
</html>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.