spring - No mapping found for HTTP request with URI [/HelloWeb/WEB-INF/jsp/hello.jsp] -
i tried to load simple example of spring mvc simple jsp failed following error: no mapping found http request uri [/helloweb/web-inf/jsp/hello.jsp] i'm using spring 3.2.2. appreciate here. tried several thing still seems can not map jsp page in controller.
web.xml looks that:
<web-app id="webapp_id" 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"> <display-name>spring mvc application</display-name> <servlet> <servlet-name>helloweb</servlet-name> <servlet-class>org.springframework.web.servlet.dispatcherservlet</servlet-class> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>helloweb</servlet-name> <url-pattern>*.jsp</url-pattern> </servlet-mapping> </web-app>
helloweb-servlet.xml looks that:
<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-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd"> <context:component-scan base-package="com.tutorial.spring" /> <bean class="org.springframework.web.servlet.view.internalresourceviewresolver"> <property name="prefix" value="/web-inf/jsp/" /> <property name="suffix" value=".jsp" /> </bean> </beans>
hellocontroll.class looks that:
package com.tutorial.spring; import org.springframework.stereotype.controller; import org.springframework.ui.modelmap; import org.springframework.web.bind.annotation.requestmapping; import org.springframework.web.bind.annotation.requestmethod; @controller @requestmapping("/hello") public class hellocontroller { @requestmapping(method= requestmethod.get) public string printhello(modelmap modelmap) { modelmap.addattribute("message", "hello spring mvc framework!"); return "hello"; } }
correct url hit printhello
handler method
/helloweb/hello.jsp
Comments
Post a Comment