因此,我将请求路径设置为 mywebsite.com/project/id/12378912?section=data,它映射到相应的 Controller /操作并返回“project/index.jsp”。
在index.jsp中,我想检查它是什么部分参数并插入正确的PartialView部分(但是......我想转到 Controller /操作来处理一些逻辑)。这可能吗?
我知道我可以执行类似使用 (jsp:include) 并插入另一个 .jsp 页面的操作,但我想转到(该 .jsp 页面的) Controller /操作来运行一些逻辑来动态生成该 .jsp 页面。
在 ASP MVC 中,我们有类似的东西......
@{ Html.RenderAction("_" + (string)ViewData["projectSection"], "Project", new { id = Model.Id }); }
它被嵌入到主/更大的 View 容器中。
最佳答案
请求只是返回jsp生成的html,这样你就得到了html结果,然后做你想做的事。
关于java - Spring 框架: Inserting another JSP file with a JSP file,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41007082/