Create a controller
called HomeController and put the following settings:
For this you have to create two classes , respectively:
This setting is common to exist in XML files, but it is being done in Java class , okay, in> by a Java class . So far so good.
olâ.
And I did the same with class ProductsController :
Being that, I made the following modifications:
@Controller
public class ProductsController {
@RequestMapping("/produtos/")
public String save(){
System.out.println("carregando produto");
return "products/ok";
}
@RequestMapping("/produtos/form")
public String form(){
return "/products/form";
}
TomCat was to put the following URLs:
localhost: 8080 / Shop / products / ok
With this URL above, it was to appear the error message 404
, but it would appear in the console eclipse message "loading product" , but that was not what happened, the error message appeared on the page but the message did not appear in console eclipse . p>
Then I tested this URL ;
And it was for the JSP
page, but nothing appears, only the 404
error message.
Where did I go wrong?