what are filters in java servlets

what are filters in java servlets

what are filters in java

View Answers

May 7, 2012 at 4:25 PM

Filters are powerful tools in servlet environment. Filters add certain functionality to the servlets apart from processing request and response paradigm of servlet processing. Filters manipulate the request and response in a web application, and they can be applied to any resources like HTML, graphics, a JSP page which are served by the servlet engine. Authentication of data, format conversion of data and redirecting the page to another page are certain useful functions of filters.

A filter is configured in a web.xml file. The class using the filters should extend javax.servlet.Filter. Every request in a web application, the servlet container decides the filters to apply and adds them to the filter chain, in the order they appear in web.xml file. A filter also has life cycle mechanisms init(),doFilter() and destroy().


July 24, 2012 at 9:44 AM

off course wew have several mechanisms for that like redirecting page to another page (request dispatcher). all these functionalities can be implemented in controller itself then why we are going for filters

Ads









Related Tutorials/Questions & Answers:
servlets
what are filters in java servlets  what are filters in java   Filters are powerful tools in servlet environment. Filters add certain functionality to the servlets apart from processing request and response paradigm
What is Java Servlets?
What is Java Servlets?      ... enabled web server. Servlets run entirely inside the Java Virtual Machine. Since.... Servlets can access the entire family of Java APIs, including the JDBC API
Advertisements
java servlets
java servlets  please help... how to connect java servlets with mysql i am using apache tomcat 5.5
Java Servlets
Java Servlets  If the binary data is posted by both doGet and doPost then which one is efficient?Please give me some example by using both doGet and doPost. Thanks in Advance   The doPost method is more efficient
servlets
servlets  what is the duties of response object in servlets
Filters
Filters  Where we use Filters in the project? give one example code, how to use Filters to provide security for the application
servlets
what are advantages of servlets  what are advantages of servlets   Please visit the following link: Advantages Of Servlets
servlets
what is the architecture of a servlets package  what is the architecture of a servlets package   The javax.servlet package provides interfaces and classes for writing servlets. The Servlet Interface The central
servlets
servlets  why we require wrappers in servlets? what are its uses? Please explain   These wrappers classes help you to modify request...://www.roseindia.net/servlets/response-filte.shtml
Servlets
Servlets  Java Servlet technology  You have set.... Anyways, please visit the following links: http://www.roseindia.net/servlets/introductiontoconfigrationservlet.shtml http://www.roseindia.net/servlets
servlets
servlets why do we need web-inf directory in web application  why do we need web-inf directory in web application? means what's the benefits of doing so
servlets
servlets   Hi what is pre initialized servlets, how can we achives?   When servlet container is loaded, all the servlets defined in the web.xml file does not initialized by default. But the container receives
servlets
what are sessions in servlets  what are sessions in servlets   A Session refers to all the request that a single client makes to a server...: http://roseindia.net/jsp/jspsession/ http://www.roseindia.net/servlets
java servlets with database interaction
java servlets with database interaction  hai friends i am doing a web application in that i have a registration page, after successfully registered... "not enough values" can you please assist how to get rid of this problem what problem
Servlets
Servlets  How to edit and delete a row from the existing table in servlets
the servlets
what is diff between generic servlets and httpservlets  what is diff between generic servlets and httpservlets   Difference between GenericServlet and HTTPServlet: 1)GenericServlet belongs to javax.servlet package
servlets
what are cookies in servlets  what are cookies   Cookies... regarding the user usage and habits. Servlets sends cookies to the browser client...://www.roseindia.net/jsp/jspcookies.shtml http://www.roseindia.net/servlets/use
Servlets
Servlets  How to check,whether the user is logged in or not in servlets to disply the home page
servlets
servlets  How to open and read the contents of a text file in servlets?   Please visit the following link: Read text file using Servlet
servlets
servlets  what are different authentication options available in servlets   There are four ways of authentication:- HTTP basic authentication HTTP digest authentication HTTPS client authentication Form-based
Servlets and
Servlets and   Sir...! I want to insert or delete records form oracle based on the value of confirm box can you please give me the idea.... thanks
servlets
which are the differ ways you can communicat between servlets  which are the differ ways you can communicat between servlets   Different ways of communicating between servlets:- 1)Using RequestDispatcher object. 2
making use java image filters
making use java image filters  while making use any functions built in jerry's filter in java application i get a NullPointerException.. I dont know the reason for this.. please give me a solution
java servlets - JSP-Servlet
java servlets  how to get the parameter value of input type file using java servlets  Hi, You can use request.getParameter(). In Jsp, --- --- IN servlet, String fileName=request.getParameter('fl'); If you
servlets
package supports the development of servlets that use the HTTP protocol. The classes... javax.servlet.GenericServlet and serves as the base class for HTTP servlets. HttpServlet-Request
servlets
servlets  hi i am using servlets i have a problem in doing an application. in my application i have html form, in which i have to insert on date value, this date value is retrieved as a request parameter in my servlet
servlets
what is functionality of requestdispatcher object servlets  what..., visit the following links: http://www.roseindia.net/help/java/d/requestdispatcher.shtml http://www.roseindia.net/tutorial/java/servlet/httprequest
servlets
what is url rewriting  what is url rewriting   It is used to maintain the session. Whenever the browser sends a request then it is always... the following links: http://www.roseindia.net/tutorial/java/jsp/URLrewriting.html
servlets
servlets  what is ResultSet?   ResultSet is a java object that is used for database connectivity to hold the data returned by a select query. When we run a select query it returns us the data in a table format with each
Servlets
Servlets  What is the filter code to authenticate the user
servlets
what are the two important api in for servlet  what are the two important api in for servlet   Two important packages are required to build servlet "javax.servlet" and javax.servlet.http

Ads