This week's giveaway is in the Java/Jakarta EE forum. We're giving away four copies of Java EE 8 High Performance and have Romain Manni-Bucau on-line! See I am taking a classroom training on JAVA. In Servlet topic, I am not getting clearance in the topics mentioned below :
Can anyone provide me the Beginner's tutorial/ ClassNotes for this topic along with simplified example. Also please guide me the scenario where one should use the concept of filter in a Project.
Waiting to see your kind and early response..!!!
A new BEE in the world of JAVA.
Thanks in advance to the seniors for their kind Help..!!!
I am not getting time to scan Books, as I am a working professional. So i am searching for the resource which provide me the quick way to grasp this topics..???
Atleast you can have *some* time to search in Google (as an alternative), which can throw umpteen results
I second Joe Harry. HFSJ is an excellent book and I bet no one can go without understanding after reading the book.
As you are in hurry, I give few info on the topics you asked for.
1. Filters -- are components that are used before and after processing the request. That is they are acting as a layer intruding the processing of any request. So if you want to do any actions before and/or after processing your request you can use a filter. Sometimes you may need to do some additional checking or setting (like users currency preference or regional settings etc.,) that can be set in the filter before the request is actually handed over to the Servlet. Likewise, once the servlet had processed the request, filters can do some additional activities on the response like zipping the output content by viewing the content type (if he preferred a compressed version if any).
2. Listeners -- are components who can be activated based upon an event. Like whenever an event happens, the listeners would be invoked by the container. For which you have to register the listener with the container against a particular servlet (or set of servlets). The event may be when an object is added/removed to the context, a servlet is created/destroyed, session creation/destruction etc., A good example is like a Form submit button. Only when you click on the submit button the data in the form is sent to the server, until then all are keeping quiet Likewise, listeners act until they are invoked by the container for a specific event!