Wicket setResponsePage() 方法如何工作? [英] How does Wicket setResponsePage() method work?

查看:22
本文介绍了Wicket setResponsePage() 方法如何工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在学习 JSP 和 servlet 时,我听说了重定向和分派.Wicket 的 setResponsePage() 执行了哪些?

When learning about JSP and servlets, I heard about redirect and dispatch. Which of them does Wicket's setResponsePage() perform?

推荐答案

setResponsePage 的作用取决于几个因素:您调用 setResponsePage 的次数、您调用的 setResponsePage 的哪个变体以及你使用什么渲染策略.

What setResponsePage does is dependent on a couple of factors: how many times you call setResponsePage, which variant of the setResponsePage you call and what render strategy you use.

您可以在请求期间多次调用 setResponsePage.Wicket 使用最后一个来处理.

You can call setResponsePage many times during a request. Wicket uses the last one to work with.

setResponsePage 有两种变体:带有 Page 实例和带有 Page 类和 PageParameters.后者将重定向到可收藏的 URL 发送到浏览器.根据渲染策略,前者将:

There are two variants of setResponsePage: with a Page instance and with a Page class and PageParameters. The latter sends a redirect to a bookmarkable URL to the browser. The former will, depending on the render strategy, either:

  • ONE_PASS_RENDER
    • 将页面直接渲染到浏览器
    • 将页面渲染到缓冲区,向浏览器发送重定向(然后检索缓冲的、渲染的标记),或
    • 向浏览器发送重定向,然后浏览器发送请求以呈现页面

    所以第一个选项是分派,第二个选项是分派后跟重定向,第三个选项是 servlet 术语中的重定向.

    So the first option is dispatch, the second option is dispatch followed by a redirect, and the third option would be redirect in servlet terms.

    这篇关于Wicket setResponsePage() 方法如何工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆