0

From this article Understanding Lift's RequestVar, I know that the data inside RequestVar actually stored in global map, and the value is visited by name.

So when the form doesn't pass validation, we can still get the value inside the RequestVar because the new RequestVar object we initialized has the same name as previous one.

It seems that the value is stay in the global map, and won't be cleared? We will not use it but we don't clear it? If it will be cleared, when it will be done?

If not, is it possible to visit the value of previous request?

4

1 回答 1

0

所以当表单没有通过验证时

你在说什么形式?我假设您只考虑存储在 RequestVar 中的任何数据。

如果清零,什么时候清零?

requestVar 在请求结束后被清除。查看详细的 wiki 页面:https ://www.assembla.com/spaces/liftweb/wiki/Managing_State 我不想从那里复制粘贴以避免将来出现过时的数据。

如果没有,是否可以访问先前请求的值?

使用 RequestVar 是不可能的,您应该使用 SessionVar。关于它的信息可以在我发布的同一个链接上找到。

于 2013-07-12T12:09:21.170 回答