0
I cannot see the form.jsp page
I am putting the following URL http://localhost:8080/Store/
With this URL it only views the hello-world.jsp page
I even put the following address http://localhost:8080/Shop/products/form but it creates error, wonder where I’m going wrong.
here is my complete project;
https://github.com/wladimirbandeira/Loja/tree/master/Loja
part1;
public class ServletSpringMVC extends AbstractAnnotationConfigDispatcherServletInitializer{
@Override
protected Class<?>[] getRootConfigClasses() {
// TODO Auto-generated method stub
return null;
}
// esse pedaço do código informa qual pagina ira ser mapeada
@Override
protected Class<?>[] getServletConfigClasses() {
return new Class[]{AppWebConfiguration.class};
}
// esse código mapea o projeto
@Override
protected String[] getServletMappings() {
// TODO Auto-generated method stub
return new String[] {"/"};
}
part2;
@EnableWebMvc
@ComponentScan(basePackageClasses={HomeController.class})
public class AppWebConfiguration {
//esse pedaço do código informa aonde está a pagina dentro pacote especifico
@Bean
public InternalResourceViewResolver
internalResourceViewResolver() {
InternalResourceViewResolver resolver = new InternalResourceViewResolver();
resolver.setPrefix("/WEB-INF/views/");
resolver.setSuffix(".jsp");
return resolver;
}
part3;
@Controller
public class HomeController {
@RequestMapping("/")
public String index(){
System.out.println("carregando produto");
return "hello-world";// essa é a pagina que está sendo visualizada
}
I just updated my post and put notes in the code for you to understand, take a look please to help me better
– wladyband