用于 Portlet 的 Spring MVC、请求生命周期

发布于 2024-08-30 04:33:00 字数 210 浏览 2 评论 0原文

有谁知道在哪里可以获得有关Portlet App(Spring基于注释的控制器)的Spring请求生命周期的文档?

我需要知道Spring调用方法的顺序以及请求处理的每个阶段可用的参数(请求,模型,...)。

主要问题是:何时调用 @ModelAttribute 方法(我想看到完整的图片,而不仅仅是“在那之后,在那之前”,我已经通过调试得到了)

非常感谢!

does anybody know where to get documentation about Spring request lifecycle for portlet App (Spring's annotation based controller?

I need to know the order of calling methods by Spring and parameters (request, model, ...) available on each stage of request handling.

Main question is: when @ModelAttribute methods are called (I want to see full picture, not just "after that, before that", which I've already got via debugging)

Thanks a lot!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

享受孤独 2024-09-06 04:33:00

如果您查看有关 Portlet MVC 的 Spring 文档,您将找不到其工作流程的任何清晰图片(行和框的真实图片),而是在 Web MVC 框架章节 您对生命周期的不同阶段有一些粗略的了解。 Portlet MVC 向 Web MVC 引入了一些额外功能,但它的工作方式基本上与 Web MVC 相同。

Spring Portlet 对此引入的更多内容是操作阶段之后的呈现阶段,该阶段会更改数据库并生成业务级别的内容,而呈现阶段则处理实际显示的内容。

If you see the Spring documentation about Portlet MVC you'll not find any clear picture (a real picture of rows and boxes) of its workflow but on the beginning of the Web MVC framework chapter you have some rough picture of the different phases of the lifecycle. Portlet MVC is introducing some extra to the Web MVC but it basically works otherwise the same way as Web MVC.

What Spring Portlet introduces more to this is the rendering phase after the action phase that alters the database and makes the business level stuff while the render phase then handles what comes actually on the display.

骄傲 2024-09-06 04:33:00

@ModelAttribute 方法在操作阶段之前调用,该阶段在渲染阶段之前。例如,在 @ActionMapping 方法上,其中模型是表单支持对象,将调用 @ModelAttribute 注释方法来初始化模型,然后使用请求上的模型来使用用户更改的任何内容来更新模型。这很方便,因为它省去了您在保存模型之前手动查找模型的麻烦。

@ModelAttribute methods are called before the action phase, which precedes the render phase. So for example on an @ActionMapping method, where the model is a form backing object, the @ModelAttribute annotated method will be called to initialise the model, then the model on the request will be used to update it with anything that the user has changed. This is handy as it saves you the trouble of finding the model manually before saving it.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文