Introduction to filter:
The basic function of filter is to intercept the servlet container call servlet process, so as to implement some special functions before and after servlet Response Processing. In
Servlet APIs define three interface classes
Refer to the examples example of the Tomcat server directory WebAppsSimple configuration steps:1. Add filter tags and ; in Project Web. xml file2. Implement the filter code;3. Configure uriencoding for server.xml files in the Tomcat server conf
In ASP.NETMVC you can use the filter function when you have the following and similar requirements
Determine whether or not a login or user right
Decision output Caching
Anti-Theft chain
Anti-Spider
Localization and internationalization
This article illustrates the use of filter filters in the Yii controller. Share to everyone for your reference, specific as follows:
Specify the filtering action (the following Projectcontext () method is used in new, list, manage page calls)
One, unified whole station character code
Use the configuration parameter charset to indicate what character encoding is used to handle the Chinese issue of HTML form request parameters
Package me.gacl.web.filter;
Import
Original Determines whether the mailbox, URL, and IP address formats are compliant with regular expressions. I later learned that in PHP you can also use the built-in function library filter to complete these functions, the following to share with
Recently discovered jquery's. Filter () method, which is a very powerful method, the most powerful is that he can accept a function as a parameter, and then based on the return value of the function to determine if the return value is true, this
Using the filter function, a conditional judgment function can be implemented.
For example, to filter out a sensitive word in a string array, the model code is as follows:
#filter out some unwanted tags
def passed (item):
Try: Return
item!=
1, first need to configure the filter in the Web.xml CheckLoginFilter net.cnki.tpi.cms.util.checkloginfilter redirectURL /login.jsp notcheckurllist /error.jsp;/login.jsp checkloginfilter /* 2, and then create a new Checkloginfilter.java
Implementation of the function: To determine whether the user is logged in, the user does not log in to prevent access to any page or action, automatically jump to the login page.
The good thing is that no one can access the JSP page directly, to
if we want to filter some nodes from left to right, we can use the nodes on hand now, but from right to left, we need to filter these nodes based on their fathers, children, and siblings. After filtering, these nodes used for comparison cannot be
When querying the data using the HBase API, we often need to set some filter conditions to query the data, we need to use the HBase API of various filter to achieve this function.
Use filters in the HBase API to create a filter instance and then use
Requirements: implementing a layer of rotation 270deg,ie series browser full compatibilitySource code:
The code is as follows
Copy Code
do a demo test under
IE9 the rotation angle is
Implementation of the function: To determine whether the user is logged in, not logged on users are forbidden to access any page or action, automatically jump to the login page.
It is good practice that no one can directly access the JSP page, to
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.