XML : HTTP Status 404 - The requested resource is not available - Web.xml and spring-dispatcher-servlet.xml

I am using Apache Tomcat 8 for running the web application. I am getting an error stating "The requested resource is not available."

URL-> http://localhost:8080/ThreadedDesignPatternAssign/enterPassword.html

However, I was able to successfully test another web application for the same server. I have linked the server to both the projects via Properties -> Project Facets -> Run time.

web.xml

  <?xml version="1.0" encoding="UTF-8"?>  <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" id="WebApp_ID" version="3.1">    <display-name>ThreadedDesignPattern</display-name>    <servlet>       <servlet-name> spring-dispatcher </servlet-name>          <servlet-class>               org.springframework.web.servlet.DispatcherServlet          </servlet-class>  </servlet>      <servlet-mapping>        <servlet-name> spring-dispatcher </servlet-name>          <url-pattern>/</url-pattern>    </servlet-mapping>  </web-app>    

spring-dispatcher-servlet.xml

  <beans xmlns="http://www.springframework.org/schema/beans"  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  xmlns:mvc="http://www.springframework.org/schema/mvc"  xmlns:tx="http://www.springframework.org/schema/tx"  xmlns:context="http://www.springframework.org/schema/context"  xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.1.xsd                      http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.1.xsd                           http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd                      http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd">      <context:component-scan base-package="com.asu.edu"/>   <mvc:annotation-driven/>      <bean id="viewResolver"          class="org.springframework.web.servlet.view.InternalResourceViewResolver" >          <property name="prefix">              <value>/WEB-INF/</value>          </property>          <property name="suffix">              <value>.jsp</value>          </property>   </bean>      </beans>    

Controller Class

  import org.springframework.stereotype.Controller;  import org.springframework.validation.BindingResult;  import org.springframework.web.bind.annotation.ModelAttribute;  import org.springframework.web.bind.annotation.RequestMapping;  import org.springframework.web.bind.annotation.RequestMethod;  import org.springframework.web.servlet.ModelAndView;    @Controller  public class PwdController {              FilterManager filterManager;            String error;              public void setFilterManager( FilterManager filterManager )            {              this.filterManager = filterManager;            }      @RequestMapping(value="/enterPassword.html", method = RequestMethod.GET)          public ModelAndView getPasswordForm()          {              ModelAndView model = new ModelAndView("EnterPassword");              return model;          }      @RequestMapping(value="/returnPassword.html", method = RequestMethod.POST)          public ModelAndView returnPasswordForm(@Valid                   @ModelAttribute("password1")PwdSetGet password1, BindingResult result)    

No comments:

Post a Comment