1
Create a controller
called Homecontroller and put the following settings:
So far so good. After that you have to configure the project to see the page that is in this package:
For that you have to create two classes, respectively:
This setting is common to exist in files XML, but it’s being done in java class, all right, it’s a trend to replace XML by a java class. So far so good.
When I put to compile I succeed in receiving this message to the class Homecontroller:
olâ.
And I did the same with class Productscontroller:
And I’ve 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";
}
At the beginning of the Tomcat was to place the following URL s:
localhost:8080/Shop/products/ok
With that URL above, was to pop up the error message 404
, but would appear in the console of eclipse the message "carrying product", but that’s not what happened, the error message appeared on the page but did not appear the message on console of eclipse.
Then I tested that URL;
And the page was supposed to appear JSP
, but nothing appears, only the error message 404
.
I wonder where I went wrong ?
That question is the same as this?
– Bruno César
no, there’s only one difference, I had started all over again and did not put connection configuration.
– wladyband