gpt4 book ai didi

java - 停止向 Angular http 发送响应并从 Controller 加载新的 jsp 页面

转载 作者:太空宇宙 更新时间:2023-11-04 11:56:07 25 4
gpt4 key购买 nike

我想在jsp页面中对spring mvc Controller 进行 Angular http调用(通过提交json数据),并且我不想获得对 Angular http调用的响应,而不是我想使用执行的 Controller 方法从spting mvc Controller 加载新的jsp页面。

任何一个都可以共享 Controller 方法如何编写(用于加载新页面而不将响应发送回 Angular http调用)和 Angular http调用(如果有任何不同的进程)。 angular http call

spring mvc controller method

最佳答案

如果你想重定向到新的jsp页面,则返回一个新的ModelAndView,如下所示

ModelAndView modelAndView = new ModelAndView("redirect:/abc.htm");
modelAndView.addObject("modelAttribute", new ModelAttribute());
返回 modelAndView;

在模型属性中添加数据并使用 ${} 语法在 jsp 页面中访问模型属性。

关于java - 停止向 Angular http 发送响应并从 Controller 加载新的 jsp 页面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41381956/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com