質問

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?

役に立ちましたか?

解決

So when the form doesn't pass validation

what form are you talking about? I'll presume that you think just of any data stored in RequestVar.

If it will be cleared, when it will be done?

The requestVar is cleaned after the request ends. Checkout the detailed wiki page: https://www.assembla.com/spaces/liftweb/wiki/Managing_State I don't want to copy-paste from there to avoid outdated data in the future.

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

It's not possible using a RequestVar, you should use a SessionVar instead. The info about it can be found on the same link I posted.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top