Je rencontre un problème étrange en essayant d'intégrer Spring MVC et Maven dans une application web Google AppEngine.Aucune correspondance trouvée avec Spring3 MVC + Maven2 sur GAE
Ceci est mon web.xml
<servlet>
<servlet-name>dispatcher</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>
/WEB-INF/spring/webmvc-config.xml
</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>dispatcher</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>
c'est mon fichier de configuration SpringMVC
<context:annotation-config />
<context:component-scan base-package="com.mypackage" />
<mvc:annotation-driven/>
<bean id="viewResolver"
class="org.springframework.web.servlet.view.InternalResourceViewResolver"
p:prefix="/WEB-INF/jsp/view/"
p:suffix=".jsp"
p:viewClass="org.springframework.web.servlet.view.JstlView" />
ceci est mon contrôleur:
@Controller
@RequestMapping(value = "/hello")
public class HelloController {
@RequestMapping(method = RequestMethod.GET)
public String helloGet(ModelMap map) {
map.put("name", "seb!");
return "hello";
}
}
ce qui est mon point de vue situé à webapp /WEB-INF/jsp/view/hello.jsp
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<!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=UTF-8">
<title>Hello Controller</title>
</head>
<body>
<h1>Hello ${name}!</h1>
</body>
</html>
ce qui est mon pom contient des dépendances à SpringMVC 3.0.3, servlet-api 2.5, 1.2 jstl
Je garde obtenir
WARNING: No mapping found for HTTP request with URI [/WEB-INF/jsp/view/hello.jsp] in DispatcherServlet with name 'dispatcher'
quand je frappe localhost: 8080/bonjour et Je ne peux pas comprendre pourquoi. Est-ce dû à GAE ou est-ce que je manque quelque chose dans une config?
Mise à jour: Si j'envoie l'URL provenant/app/* au printemps Dispatcher, changer mon web.xml comme ceci:
<servlet-mapping>
<servlet-name>dispatcher</servlet-name>
<url-pattern>/app/*</url-pattern>
</servlet-mapping>`
ça va marcher, mais je veux juste utiliser pages d'atterrissage et utiliser la racine de l'application
UrlRewrite peut être assez bon, je vais essayer. merci – sebarmeli
cela fonctionne avec urlrewrite :) – sebarmeli