完整网站的参数管理! [英] Parameters Management for complete website!

查看:145
本文介绍了完整网站的参数管理!的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的网站的开始页面上,我有一个搜索掩码,用户可以在其中选择其他搜索条件.如果没有,则将为搜索参数设置默认值.

On my website's Start page I have a Search Mask where user set select different Search Criteria. When user doee't then the default values will be set for the search parameters.

通过单击搜索"按钮,用户将出现在预览页面上,该用户可以重新设置其搜索参数.并且可以通过许多不同类型的预览页面.例如,如果用户搜索 汽车类别,则预览页面为其他",而搜索掩码将与摩托车类别"中搜索的其他相同.

By clicking on Search buttom user comes on preview page, where the user has possibility to refine his search parameters agaian. And there can by many different types of preview pages. For examples if users searches in Cars category then the preview page be other and the search mask will other as the have searched in Motorcycle category.

但同样,所有产品的详细信息页面都是单一的.

But again the detail page is single for all Kind of products.

现在,我想编写一个可以容纳起始页的搜索选项以及所有不同种类的概述页的组件.

Now I want to write a component that can hold the start page'S search options and for all different kinds of overview pages.

我还想跟踪我从哪个预览页面登陆到详细信息页面,以及当用户从详细信息页面回到预览页面时所要获得的信息,即使用用户已经优化的值加载所需的蒙版.

And I would also like to track that information that from which preview page I landed on detail page and when the user comes from detail page back to Preview page I was to load the desired mask with the values that the user already refined.

解决此问题的最佳实践是什么?是否存在针对此类问题的设计模式?

What will be the best practice to solve this problem and is there any design pattern available for such kind of problem?

非常感谢.

推荐答案

通常来说,没有针对您描述的特定问题的设计模式.根据您要建模的方式,可以实现诸如策略状态和/或命令.其中的每一个都提供了一些用于封装状态的工具(例如,什么类型的预览和条件)以及一些相关的行为.

Generally, speaking there's no design pattern for the specific problem you've described. Depending on how you want to model it, you could implement patterns such as Strategy, State and/or Command. Where each of these provides some facility for encapsulating state (e.g. what type of preview and criteria) and some related behavior.

使用不同ColdFusion变量范围跟踪搜索条件的三个选项:

Three options for keeping track of search criteria using different ColdFusion variable scopes:

  1. 会话
  2. cookie
  3. 客户

会话范围

这是服务器内存,通过开发人员可以在其中放置信息的cookie链接到给定用户.它的设计目的是在一段时间不活动后到期,ColdFusion通过Application.cfc提供有关其初始化和到期的事件处理.如果您决定将有状态对象附加到每个用户,则很有用.缺点是,如果在其中放置了很多信息和/或使用了长期存在的会话,则可能会耗尽内存.

This is server memory linked to a give user via a cookie that a developer can place information into. It's designed to expire after a period of inactivity and ColdFusion provides event handling around its initialization and expiration via Application.cfc. Useful if you decide to have stateful objects attached to each user. Disadvantage is you can run out of memory if a lot of information is put there and/or long lived sessions are used.

设置客户端cookie.可以轻松捕获简单数据.无法捕获对象-您需要序列化和反序列化它们的状态.可伸缩性很好,因为服务器仅跟踪cookie.容易被黑客入侵.

Sets client cookies. Can easily capture simple data. Cannot capture objects - you would need to serialize and deserialize their state. Scales well because only a cookie is tracked by the server. Easily hacked.

Client

从持久性读取和写入与用户会话关联的数据. 默认情况下,这是Windows上的注册表-不要​​使用此注册表,因为如果注册表损坏,它可能会使服务器崩溃,并带来可怕的后果.而是访问管理员并将其设置为使用数据库.当您要跟踪有关用户在网站上移动的用户的大量信息时有用,但仅在扩展数据库和支持数据库时有用.需要像cookie作用域一样对数据进行序列化.

Reads and writes data associated with a user session from persistence. By default this is the registry on Windows - don't use this as it will likely crash your server with dire consequences if the registry becomes corrupted. Instead access the administrator and set it to use a database. Useful when you want to track lots of information about your users as they move about the site, but only scales as well as the backing database. Need to serialize data as with cookie scope.

这篇关于完整网站的参数管理!的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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