`
dr2tr
  • 浏览: 138476 次
  • 性别: Icon_minigender_1
  • 来自: 上海
社区版块
存档分类
最新评论
文章列表
之前在GL的督促下用Struts做了一个简单的HR系统。其间有过许多问题,现在归纳一下,希望对看到的人有所帮助。 笔者以前也用Struts开发过一个系统,那时候Struts的版本是1.1,现在1.2了,发现有一点区别。这次开发最开始的问题就是在这一点上。 首先有关于消息提示部分的内容。在Action中,saveErrors(String, ActionError)已经被废弃了,但是saveErrors(String, ActionMessage)还是可用的。而很多时候,为了区分错误消息和提示消息, 还可以用saveMessages(String, ActionMessage)处理相关内容。 同 ...
最简单的当然是利用Colections的sort函数。 因此,需要先实现 Comparator接口。主要是实现其中的compare方法。 然后就可以了。。。。好像很简单,有API文档,应该其他的不用多记录了。
The intent of Abstract Factory is to provide for the creation of a family of related, or dependent, objects. see pic: Additional note is below:( reference from http://www.dofactory.com) :  AbstractFactory  (ContinentFactory) declares an interface for operations that create abstract ...
The Factor Method pattern lets a class developer define the interface for creating an object while retaining control of which class to instantiate, see pic: To summarize, the signs that Factory Method is at work are that an operation: Creates a new object Returns a type that is an abstract ...
The Builder pattern moves the construction logic for an object outside the class to instantiate. It separates the construction of a complex object from its representation.  This is especially useful when you want to ensure the validity of an object befre instantiatin it and don't want  the associated ...
The intent of Flyweight is to use sharing to support large numbers of fine-grained objects efficiently. see pic:   A preliminary step in applying the Flyweight pattern is to extract the immutable part of an object so that this part can be shared. The class's immutablity relies on the immutability of ...
刚才写的东西都被系统清空了,现在凭回忆补一点吧 1。在使用Lombz产生动态网站项目时,其自动生成的web.xml常常会有问题。(主要是文 件头部分常常有问题)。一般可以找一个正确的替换之。 2。在web.xml中需要对ActionServlet进行声明,不然在运行时会报异常(基本是提示找 不到Action之类的东西) 3。程序版本的问题。(通常JDK版本,Tomcat版本以及Struts版本要匹配) 4。Jar的问题。也许跟程序版本有关,即将Struts相关的jar文件放到Tomcat目录 \common\lib的话,Tomcat启动就会报错。我的解决方法是将它们放到项目WEB-INF\lib ...
 1. The intent of the Chain of Responsibility is to avoid coupling the sender of a request to its receiver by giving more than one object a chance to handle the request. To apply this pattern, chain the receiving objects and pass the request along the chain until an object handles it, see pic: If yo ...
1。代理的分类: 远程(Remote)代理:为一个位于不同的地址空间的对象提供一个局域代表对象。这个不同的地址空间可以是在本机器中,也可是在另一台机器中。远程代理又叫做大使(Ambassador)。 虚拟(Virtual)代理:根据需要创建一个资源消耗较大的对象,使得此对象只在需要时才会被真正创建。 Copy-on-Write代理:虚拟代理的一种。把复制(克隆)拖延到只有在客户端需要时,才真正采取行动。 保护(Protect or Access)代理:控制对一个对象的访问,如果需要,可以给不同的用户提供不同级别的使用权限。 Cache代理:为某一 ...
1. The Medaitor pattern centralizes responsibility for a particular set of objects. (Singleton pattern is for the clients.) The Mediator pattern defines an object that encapsulates how a set of object interact. Mediator promotes loose coupling by keeping objects from referring to each other explicitl ...
Subject: import java.util.Observable; public class SimpleSubject extends Observable{ private SimpleObserver observer = null;  private String state = null;  SimpleSubject(){  observer = new SimpleObserver();  this.addObserver(observer);      System.out.println("Subject initialed ok"); }  pu ...
1. The intent of the Observer pattern is to define a one-to-many dependency such that when one object changes state, all its dependents are notified and updated automatically. see pic: The Subject here is also called Observable. in SmallTalk, we also call Observer and Subject as View and Model. The ...
1. The intent of the Singleton is to ensure that a class has only one instance and to provide a global point of access to it. 2. A singleton is usually lazy-initialized. [lazy-initialized is like:if( filed == null) { // initial }  return field; ] 3. Symchronize is important in lazy-initialize when in ...
自定义标签必须实现下面三个接口中的一个:Tag、IterationTag、BodyTag 1.Tag  如果要实现这个接口,可以通过扩展TagSupport这个类,来写自己需要的方法,而不需要把Tag接口中的所有方法实现。  Tag接口的方法: doStartTag()、doEndTag()、getParent()、setParent()、release()、setPageContext()  在Tag类代码中不能像jsp一样,直接使用out隐含对象,他有一个对象可以使用pageContext,通过它的getOut()方法可以得到out对象。在标签内部,访问任何的隐含对象,都是通过调用pageC ...
1. The intent of the BRIDGE pattern is to decouple an abstraction (a  class that relies on a set of abstarct operations, GoF Design Patterns)  from the implementation of its abstract operation, so that the abstraction and its implementation can vary independently. 2. A Bridge structure moves the abst ...
Global site tag (gtag.js) - Google Analytics