... | @@ -47,3 +47,20 @@ https://docs.spring.io/spring/docs/current/spring-framework-reference/web.html |
... | @@ -47,3 +47,20 @@ https://docs.spring.io/spring/docs/current/spring-framework-reference/web.html |
|
</dependencies>
|
|
</dependencies>
|
|
```
|
|
```
|
|
|
|
|
|
|
|
8. Создать простейший контроллер Spring MVC. Добавим класс sample.MainController в папку java
|
|
|
|
```java
|
|
|
|
package sample;
|
|
|
|
|
|
|
|
|
|
|
|
import org.springframework.stereotype.Controller;
|
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
|
|
|
|
|
@Controller
|
|
|
|
public class MainController {
|
|
|
|
@RequestMapping("/test")
|
|
|
|
public String test() {
|
|
|
|
return "redirect:http://ya.ru";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|