PRG模式是否有一个名称,该名称在验证失败时不会重定向? [英] Is there a name for the PRG pattern that doesn't redirect on failed validation?

查看:153
本文介绍了PRG模式是否有一个名称,该名称在验证失败时不会重定向?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的网站遵循重定向后获取"模式.
似乎有两种方法可以处理失败的验证.要么

My website follows the Post-Redirect-Get pattern.
There seems to be 2 ways to deal with failed validation. Either:

  • 使用验证消息呈现页面
  • 临时存储验证消息,然后重定向到显示该消息的GET

这两种实现都遵循PRG模式吗?
有没有更具体的方式来描述这两种模式?

Do both of these implementations follow the PRG pattern?
Is there a more specific way to describe either of these patterns?

我主要是出于教育目的.

I am asking primarily for educational sake.

推荐答案

由于没有人回答,我将提出我自己的答案.

Since no one has answered, I'm going to suggest my own answer.

严格PRG 意味着POST重定向即使存在验证错误.它会临时存储验证消息,重定向到相同的URL,并显示验证消息.

PRG Strict means that the POST redirects even if there is a validation error. It temporarily stores the validation messages, redirects to the same URL, and displays the validation messages.

PRG松散意味着在验证错误时POST不会重定向.表单以及错误消息将重新显示.

PRG Loose means that the POST does not redirect when there are validation errors. The form will be redisplayed, along with the error messages.

听起来如何?

这篇关于PRG模式是否有一个名称,该名称在验证失败时不会重定向?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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