为什么使用隐藏域? [英] Why are hidden fields used?

查看:266
本文介绍了为什么使用隐藏域?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直看到了很多在Web应用程序中使用隐藏字段。我曾与被写入到使用大量的隐藏字段,并从来回发送给他们的可见字段的数据值code的工作。虽然我不明白,为什么隐藏字段使用。我几乎总是可以想办法来解决同样的问题,而无需使用隐藏字段。如何隐藏域的设计帮助?

I have always seen a lot of hidden fields used in web applications. I have worked with code which is written to use a lot of hidden fields and the data values from the visible fields sent back and forth to them. Though I fail to understand why the hidden fields are used. I can almost always think of ways to resolve the same problem without the use of hidden fields. How do hidden fields help in design?

谁能告诉我,到底是什么的优点是隐藏字段提供?为什么隐藏字段使用吗?

Can anyone tell me what exactly is the advantage that hidden fields provide? Why are hidden fields used?

推荐答案

隐藏字段只是最简单的方法,这就是为什么他们使用了不少。

Hidden fields is just the easiest way, that is why they are used quite a bit.

替代:


  • 在会话服务器端存储数据(使用的SessionID的cookie)

  • 存储在交易服务器端数据(与事务ID作为单一的隐藏字段)

  • 使用URL路径,而不是隐藏字段的查询参数适用

主要关注点:


  • 的隐藏字段的值不能被信任不是来自网页被篡改的页面(而不是服务器端存储)

  • 需要大数据被张贴每一次,可能是一个问题,而且是不可能的某些数据(例如上传的图片)

主要优点:


  • 的页面和多个浏览器窗口之间没有洒粘性会话

  • 没有必要的服务器端清理(过期数据)

  • 访问客户端脚本

这篇关于为什么使用隐藏域?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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