Boa tarde a todos que estiverem lendo este texto... Eu não consegui de maneira nenhuma subir a pagina home.jsp...
Estou pesquisando a respeito , se alguém puder me ajudar ficarei muito grato!
Logo a baixo esta a copia do meu código tal qual o professor instruiu no curso... Desde já eu agradeço o auxílio!
package br.com.casadocodigo.loja.controllers;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
@Controller
public class HomeController {
@RequestMapping("/")
public String index() {
System.out.println("Entrando no Home CDC");
return "home";
}
}
package br.com.casadocodigo.loja.conf;
import org.springframework.web.servlet.support.AbstractAnnotationConfigDispatcherServletInitializer;
public class ServletSpringMVC extends AbstractAnnotationConfigDispatcherServletInitializer{
@Override
protected Class<?>[] getRootConfigClasses() {
return null;
}
@Override
protected Class<?>[] getServletConfigClasses() {
return new Class[] {AppWebConfiguration.class};
}
@Override
protected String[] getServletMappings() {
return new String[] {"/"};
}
}
package br.com.casadocodigo.loja.conf;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.view.InternalResourceViewResolver;
import br.com.casadocodigo.loja.controllers.HomeController;
@EnableWebMvc
@ComponentScan(basePackageClasses = {HomeController.class})
public class AppWebConfiguration {
@Bean
public InternalResourceViewResolver internalResourceViewResolver() {
InternalResourceViewResolver resolver = new InternalResourceViewResolver();
resolver.setPrefix("webapp/WEB-INF/views/");
resolver.setSuffix(".jsp");
return resolver;
}
}