【发布时间】:2022-01-02 02:36:27
【问题描述】:
我在 Spring Boot 应用程序中集成了 Angular 应用程序。即,Angular 构建文件放置在 Spring Boot 应用程序的静态文件夹中,如下图所示。
I have defined two angular routing urls like
1. http://localhost:8080/pageone
2. http://localhost:8080/pagetwo
当我从浏览器访问urls 以上时,are handled by server(弹簧启动应用程序)直接和not by the angular。所以I end up in page not found。
We can redirect to index page 来自这样的弹簧靴
@GetMapping("/")
public RedirectView welcome(RedirectAttributes attributes) {
//attributes.addFlashAttribute("flashAttribute", "redirectWithRedirectView");
//attributes.addAttribute("pageToRequest", "paymentoverview");
return new RedirectView("index.html");
}
but 我们可以only redirect to index.html 页面not to routing urls "/pageone" or "/pagetwo"。
我不想在索引页面结束。
Somehow I wan't to end up in respective page that I accessed from browser automatically,
even after redirect to index page also fine.
我尝试将属性与 index.html 一起发送,但它不起作用。 我们该如何解决这个问题。
【问题讨论】:
标签: angular spring-boot redirect angular-routing