spring - WARNING: No mapping for springapp1 welcome.htm in DispatcherServlet with name springapp1 -


i have created simple jsp page being retrieved controller. when retreive url localhost:8080/springapp1/welcome.htm, getting following error in tomcat:

i getting error:

warning: no mapping [/springapp1/welcome.htm] in dispatcherservlet name 'springapp1' 

web.xml file:

<?xml version="1.0" encoding="utf-8"?> <web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" > <servlet> <servlet-name>springapp1</servlet-name>     <servlet-class>org.springframework.web.servlet.dispatcherservlet</servlet-class>     <load-on-startup>1</load-on-startup> </servlet>  <servlet-mapping> <servlet-name>springapp1</servlet-name>     <url-pattern>*.htm</url-pattern> </servlet-mapping>  <context-param> <param-name>contextconfiglocation</param-name> <param-value>/web-inf/springapp1-servlet.xml</param-value> </context-param>  <listener>    <listener-class>       org.springframework.web.context.contextloaderlistener    </listener-class> </listener> </web-app> 

springapp1.xml-

<?xml version="1.0" encoding="utf-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd"> <!-- application context definition springapp1 dispatcherservlet -->  <context:component-scan base-package="springapp1.web" /> <bean id="viewresolver" class="org.springframework.web.servlet.view.internalresourceviewresolver">     <property name="viewclass" value="org.springframework.web.servlet.view.jstlview"/>     <property name="prefix" value="/web-inf/jsp/"/>     <property name="suffix" value=".jsp"/> </bean> 

helloworldcontroller.java:

package springapp1.web;  import org.apache.commons.logging.log; import org.apache.commons.logging.logfactory; import org.springframework.stereotype.controller; import org.springframework.web.bind.annotation.requestmapping; import org.springframework.web.bind.annotation.requestmethod; import org.springframework.web.servlet.modelandview;  @controller @requestmapping("/welcome") public class helloworldcontroller{  protected final log logger = logfactory.getlog(getclass()); @requestmapping(method = requestmethod.get) public modelandview helloworld(){      logger.info("returning hello view ");     modelandview model = new modelandview("userform");     model.addobject("msg", "hello world");      return model; } } 

userform.jsp:

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> <html> <body>     <h1>spring mvc hello world annotation example</h1>      <h2>${msg}</h2>  </body> </html> 

is possible deploying application root context (i.e. /)? in case url should http://localhost:8080/welcome.htm.


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

javascript - jQuery .height() return 0 when visible but non-0 when hidden -