`
阅读更多

      Use serialization to create an undo mechanism.这是教材中唯一一句讲解!

正如Memento(纪念物)的含义提示一样,该设计模式有记忆效果,能恢复原状态!准确来说就是: 在不破坏封装性的前提下,捕获一个对象的内部状态,并在该对象之外保存这个状态。这样以后就可将该对象恢复到原先保存的状态。

       该设计模式实际应用举例是:jsp+javabean
       在一系统中新增帐户时,在表单中需要填写用户名、密码、联系电话、地址等信息,如果有些字段没有填写或填写错误,当用户点击“提交”按钮时,需要在新增页 面上保存用户输入的选项,并提示出错的选项。这就是利用JavaBean的scope="request"或scope="session"特性实现的, 即是用备忘录模式实现的。

        样例学习见:参考1 , 参考2


分享到:
评论

相关推荐

    常见设计模式解析和实现 (内含工程和资料文档C++)

    常见设计模式的解析和实现 设计模式C++.pdf 01-Factory模式 02-Abstract Factory模式 03-Builder模式 04-Prototype模式 05-Singleton模式 06-Adapt模式 07-Bridge模式 08-Composite模式 ...21-完结篇

    C#面向对象设计模式纵横谈(21):(行为型模式) Memento 备忘录模式

    C#面向对象设计模式纵横谈(21):(行为型模式) Memento 备忘录模式

    (行为型模式) Memento 备忘录模式

    C#面向对象设计模式纵横谈(21):(行为型模式) Memento 备忘录模式

    Apress.Pro.Design.Patterns.in.Swift

    Chapter 21. The Mediator Pattern Chapter 22. The Observer Pattern Chapter 23. The Memento Pattern Chapter 24. The Strategy Pattern Chapter 25. The Visitor Pattern Chapter 26. The Template Method ...

    23种设计模式 - 各种模式的学习

    23种设计模式 目录 创建型 1. Factory Method(工厂方法) 2. Abstract Factory(抽象工厂) ...19. Memento(备忘录) 20. Observer(观察者) 21. State(状态) 22. Strategy(策略) 23. Visitor(访问者)

    Cocoa Fundamentals Guide

    Mediator 148 Memento 151 Observer 153 Proxy 154 Receptionist 155 Singleton 158 Template Method 158 The Model-View-Controller Design Pattern 160 Roles and Relationships of MVC Objects 160 Types of ...

    Objective C 设计模式(英文版)

    本书章节内容: Chapter 1: Hello, Design Patterns! Chapter 2: A Case Study: Designing an App Chapter 3: Prototype Chapter 4: Factory Method Chapter 5: Abstract Factory ...Chapter 23: Memento

    Java面试 java设计模式整理 单例、工厂、策略等 面试使用,学习使用

    java的设计模式大体上分为三大类: 2 设计模式遵循的原则有6个: 2 1. 工厂模式(Factory Method) 2 2. 抽象工厂模式(Abstract Factory)...19、备忘录模式(Memento) 21 20、状态模式(State) 23 21、访问者模式等

    timetravelr:Time Travel API 的 R 客户端

    在网络档案和 Memento Time Travel API 的帮助下,应该可以评估 OAI-PMH 存储库的演变。 获取时间图索引 uri <- " http://www.openarchives.org/Register/BrowseSites " my_oai <- get_timemap( uri ) head...

    java设计模式

    创建型 1. Factory Method(工厂方法) 2. Abstract Factory(抽象工厂) 3. Builder(建造者) ...19. Memento(备忘录) 20. Observer(观察者) 21. State(状态) 22. Strategy(策略) 23. Visitor(访问者)

    java之23种设计模式

    设计模式之Java实现源码,其中包含三大类,23种,分别为创建型 1. Factory Method(工厂方法) ...19. Memento(备忘录) 20. Observer(观察者) 21. State(状态) 22. Strategy(策略) 23. Visitor(访问者)

    研磨设计模式-part2

    第21章 解释器模式(Interpreter) 第22章 装饰模式(Decorator) 第23章 职责链模式(Chain of Responsibility) 第24章 桥接模式(Bridge) 第25章 访问者模式(Visitor) 附录A常见面向对象设计原则 附录...

    研磨设计模式-part4

    第21章 解释器模式(Interpreter) 第22章 装饰模式(Decorator) 第23章 职责链模式(Chain of Responsibility) 第24章 桥接模式(Bridge) 第25章 访问者模式(Visitor) 附录A常见面向对象设计原则 附录...

    研磨设计模式-part3

    第21章 解释器模式(Interpreter) 第22章 装饰模式(Decorator) 第23章 职责链模式(Chain of Responsibility) 第24章 桥接模式(Bridge) 第25章 访问者模式(Visitor) 附录A常见面向对象设计原则 附录...

    C#设计模式_设计模式_C#_

    创建型: 1. 单件模式(Singleton Pattern) 2. 抽象工厂(Abstract Factory) 3.... 备忘录模式(Memento Pattern) 21. 策略模式(Strategy Pattern) 22. 访问者模式(Visitor Pattern) 23. 状态模式(State Pattern)

    23种设计模式 (创建型,结构型,行为型)

    创建型: 1. 单件模式(Singleton Pattern) 2. 抽象工厂(Abstract Factory) 3.... 4.... 5.... 21. 策略模式(Strategy Pattern) 22. 访问者模式(Visitor Pattern) 23. 状态模式(State Pattern)

    设计模式代码——c#

    C#设计模式(23种设计模式) 1. 单件模式(Singleton Pattern) ...20. 备忘录模式(Memento Pattern) 21. 策略模式(Strategy Pattern) 22. 访问者模式(Visitor Pattern) 23. 状态模式(State Pattern)

    C#设计模式(23种设计模式)

    创建型: 1. 单件模式(Singleton Pattern) 2. 抽象工厂(Abstract Factory) ... 21. 策略模式(Strategy Pattern) 22. 访问者模式(Visitor Pattern) 23. 状态模式(State Pattern) @Author kwming

    设计模式(23种)与设计原则(6种)

    详细描述全部(23种)设计模式与设计原则(6种)。...18)备忘录模式(Memento) 19)观察者模式(Observer) 20)状态模式(State) 21)策略模式(Strategy) 22)模版模式(Template) 23)访问者模式(Visitor)

    《Java Design Patterns》高清完整英文PDF版

    Chapter 13: Memento Patterns Chapter 14: State Patterns Chapter 15: Builder Patterns Chapter 16: Flyweight Patterns Chapter 17: Abstract Factory Patterns Chapter 18: Mediator Patterns Chapter 19: ...

Global site tag (gtag.js) - Google Analytics