我应该自己提交表格还是提交到外部文件? [英] Should I self-submit forms or submit to an external file?

查看:165
本文介绍了我应该自己提交表格还是提交到外部文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是编程的新手 - 特别是Coldfusion,我很好奇,如果它提交一个表单到它的页面,并处理结果,或者如果它应该提交到一个外部文件然后从那里重定向?

I'm fairly new to programming - specifically Coldfusion, and I'm curious if it makes a difference whether I submit a form to the page it's on and process the results there, or if it should be submitted to an external file for processing, and then redirected from there?

推荐答案

它可以有所作为。当我第一次开始编程时,我经常会做的事情:

It can make a difference. When I first started programming I would often do things like:

myform.cfm(get / post) myformresults.cfm(get / post)

起初,似乎这是一个合理的方法。形式和形式结果通常看起来完全不同。它们与DB的交互方式截然不同。从长远来看,这并不是一个好的方法。现在我通常:

At first it seemed like this was a reasonable approach. The form and the form results often look quite different. They interact with DBs quite differently. In the long term this has not turned out to a good approach. Now I typically:

myform.cfm(get) - > myform.cfm(post)

原因1:
如果表单发布,有问题我已经在正确的地方重新填充它。

Reason 1: If the form when it was posted, had issues I am already in the right place to re populate it.

原因2:
HTTP get旨在获取数据而无需操作。 HTTP帖子旨在操作数据。这与已建立的模式保持一致

Reason 2: HTTP gets are intended to get data without manipulation. HTTP posts are intended to manipulate data. This keeps with the already established pattern

原因3:
有更少的调试。因为页面和方法的组合较少

Reason 3: There is less to debug. because there are fewer combinations of pages and methods

原因4:
通常在编程中有用,而不是什么不同。你很可能发现你的 myformresults.cfm 页面真的很类似于 myform.cfm

Reason 4: It is often useful in programming to see what is common, and not what is different. You may very well find that the your myformresults.cfm page really is quite similar to myform.cfm

原因5:
.Net开发人员已经在这样做。如果你在一个使用.NET的商店里工作,他们已经期待这种区别。

Reason 5: .Net developers are already doing this. If you work in a shop that uses .Net, they are already expecting this distinction to be present

这篇关于我应该自己提交表格还是提交到外部文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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