Preserving model state with Post/Redirect/Get pattern

前端 未结 3 1670
名媛妹妹
名媛妹妹 2021-02-15 16:08

At the moment I am trying to implement the Post/Redirect/Get pattern with Spring MVC 3.1. What is the correct way to preserve and recover the model data + validation errors? I k

3条回答
  •  没有蜡笔的小新
    2021-02-15 16:32

    what is the correct way of recovering them in the GET method from the flash scope

    I'm not sure I understand what you mean by recovering them. What you add as flash attributes before the redirect will be in the model after the redirect. There is nothing special that needs to be done for that. I gather you're trying to ask something else but I'm not sure what that is.

    As phahn pointed out why do you redirect on error? The common way to handle this is to redirect on success.

提交回复
热议问题