I work with Spring MVC.
When I click in the jsp link other jsp is loaded.
I have some controllers.
Also I use
<bean class="org.springframework.web.servlet.mvc.support.ControllerClassNameHandlerMapping" />
When I click the jsp link I get a 404
Project structure is
My jsp is
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
<html>
<head>
<title>Spring MVC Tutorial Series by Crunchify.com</title>
<style type="text/css">
body {
background-image: url('http://crunchify.com/bg.png');
}
</style>
</head>
<body>
<br>
<div style="text-align:center">
<h2>
Hey You..!! This is your 1st Spring MCV Tutorial..<br> <br>
</h2>
<h3>
<a href="<c:url value="/EusurveyAdminB/welcome"/>">enlace</td>
</h3>
</div>
</body>
</html>
WelcomeController.java is
package eusurvey.controller;
import java.util.List;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import org.apache.log4j.Logger;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;
import eusurvey.modelA.daos.Preferencia;
import eusurvey.services.PreferencesService;
@Controller
@RequestMapping("/welcome")
public class WelcomeController {
private static final Logger logger = Logger.getLogger(WelcomeController.class);
@Resource(name = "preferencesService")
private PreferencesService preferencesService;
private int a = 0;
private static List<Preferencia> results = null;
/*@RequestMapping
public ModelAndView consultaPreferencia(ModelMap model){
logger.info("PreferencesControles.- Principio de consultaPreferencia");
results = preferencesService.consultaPreferencia();
logger.info("PreferencesControles.- consultaPreferencia results size "+results.size());
return new ModelAndView("welcome", "preferencias",results);
}*/
@RequestMapping(method = RequestMethod.GET)
public ModelAndView welcome(HttpServletRequest request, Model model) {
logger.info("PreferencesControles.- Principio de consultaPreferencia");
results = preferencesService.consultaPreferencia();
logger.info("PreferencesControles.- consultaPreferencia results size "+results.size());
return new ModelAndView("welcome", "preferencias",results);
}
}
Dispatcher is
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:mvc="http://www.springframework.org/schema/mvc" 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.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd
http://www.jasypt.org/schema/encryption
http://www.jasypt.org/schema/encryption/jasypt-spring31-encryption-1.xsd">
<context:annotation-config />
<import resource="hibernate-context.xml" />
<bean id="propertyPlaceholderConfigurer"
class="org.jasypt.spring31.properties.EncryptablePropertyPlaceholderConfigurer">
<constructor-arg ref="configurationEncryptor" />
<property name="location" value="/WEB-INF/spring.properties" />
</bean>
<bean id="configurationEncryptor" class="org.jasypt.encryption.pbe.StandardPBEStringEncryptor">
<property name="config" ref="environmentVariablesConfiguration" />
</bean>
<bean id="environmentVariablesConfiguration"
class="org.jasypt.encryption.pbe.config.EnvironmentStringPBEConfig">
<property name="algorithm" value="PBEWITHSHA256AND256BITAES-CBC-BC" />
<property name="passwordEnvName" value="CAS_PBE_PASSWORD" />
<property name="providerClassName"
value="org.bouncycastle.jce.provider.BouncyCastleProvider" />
<property name="providerName" value="BC" />
</bean>
<bean class="org.springframework.web.servlet.mvc.support.ControllerClassNameHandlerMapping" />
<bean id="messageSource"
class="org.springframework.context.support.ReloadableResourceBundleMessageSource">
<property name="basename" value="WEB-INF/classes/messages" />
</bean>
<context:component-scan base-package="eusurvey" />
<bean
class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/WEB-INF/jsp/" />
<property name="suffix" value=".jsp" />
</bean>
</beans>
Controller are in the packages eusuvey.controller
In the dispatcher I scan the package eusuvey
The error is
How do I have to define jsp, controller and dispatcher to fix this 404?