angularjs filter

I think it’s best to understand what we even want to learn. To do that, we need to understand what filters really are and how we use them. For me, there are four types of filters. Yes, four, but there of course can be other variants. Let’s rattle through them: Filter 1: Static (single) use…

angularjs filter on array

Use property in input’s ng model Filter is used for selecting a subset of a give array. The requirements for a filter are an array to be filtered and the predicate based on which the array need to be filtered. The predicate could be as simple as a string and let’s try filtering using a…

Add Ordering to Annotated Servlet 3 Filter Classes

If you’re like me you really like the new Servlet 3.0 spec that allows for annotated servlet classes. This approach along with the new ServletContainerInitializer interface potentially allows for code-based application configuration and deployment without an application deployment descriptor (web.xml) file. One thing lacking in the new spec’s annotations, is the ordering of the filter chain….

JFileChooser notes

We get file by using getSelectedFile() method, which return the File object. The open/close button can be disabled by using setControlButtonsAreShown(false) method. File filter can be add using: setFileFilter(new Xlsfilter()); Xlsfilter: PropertyChangeListener we can hide the accept/cancel buttons by calling chooser.setControlButtonsAreShown(false) when detect any selecting change on files/directories: f  

filter 和 aop

现在AOP的设计开发理念在软件开发中用的越来越广泛,在我们开发的软件中也广泛进行了使用。而最常用的就是filter和interceptor。 Filter 该过滤器的方法是创建一个类XXXFilter实现此接口,并在该类中的doFilter方法中声明过滤规则,然后在配置文件web.xml中声明他所过滤的路径 <filter> <filter-name>XXXFilter</filter-name> <filter-class> com.web.util.XXXFilter </filter-class> </filter> <filter-mapping> <filter-name>XXXFilter</filter-name> <url-pattern>*.action</url-pattern> </filter-mapping> Interceptor 该过滤器的方法也是创建一个类XXXInterceptor实现此接口,在该类中intercept方法写过滤规则,不过它过滤路径的方法和Filter不同,它与strut.xml结合使用(其他开发框架各自有自己的切入点), 创建一个strus.xml的子配置文件struts-l99-default.xml,它继承与struts2的struts-default,此配置文件是其他子配置文件的父类,只要是继承与该文件的配置文件所声明的路径都会被它过滤 如下 <package name=”XXX-default” namespace=”/” extends=”struts-default”> <interceptors> <interceptor name=”authentication” /> <interceptor-stack name=”user”> <interceptor-ref name=”defaultStack” /> <interceptor-ref name=”authentication” /> </interceptor-stack> <interceptor-stack name=”user-submit”> <interceptor-ref name=”user” /> <interceptor-ref name=”token” /> </interceptor-stack>   <interceptor-stack name=”guest”> <interceptor-ref name=”defaultStack” /> </interceptor-stack>   <interceptor-stack name=”guest-submit”> <interceptor-ref name=”defaultStack”…

JSP Servlet Filter

Basic Servlet Filters are the latest components that are added in Servlet 2.3 specifications. These filters are used basically for intercepting and modifying requests and response from server.  Consider a scenario where you want to check session from the every users request and if it is valid then only you want to let the user…