Skip to main content

Posts

Creating and Configuring Servlets

Configuring Servlets You define servlets as a part of a Web application in several entries in the J2EE standard Web Application deployment descriptor, web.xml. The web.xml file is located in the WEB-INF directory of your Web application. The first entry, under the root servlet element in web.xml, defines a name for the servlet and specifies the compiled class that executes the servlet. (Or, instead of specifying a servlet class, you can specify a JSP.) The servlet element also contains definitions for initialization attributes and security roles for the servlet. The second entry in web.xml, under the servlet-mapping element, defines the URL pattern that calls this servlet. Servlet Mapping Servlet mapping controls the way you want to access your servlets example of servlet mapping look like the image i attatched above Servlet Initialization Attributes You define initialization attributes for servlets in the Web application deployment descriptor, web.xml, in the ini...

Design Patterns

Factory pattern comes into creational design pattern category, the main objective of the creational pattern is to instantiate an object and in Factory Pattern an interface is responsible for creating the object but the sub classes decides which class to instantiate. It is like the interface instantiate the appropriate sub-class depending upon the data passed. Here in this article we will understand how we can create an Factory Pattern in Java. Suppose here i am giving a good and easy example.. ICommunicator is the core interface public interface ICommunicator { public ICommunicator getCommunicator(); public void sayCommunicatorName(); } public interface IRelianceCommunicator extends ICommunicator{ } public interface INokiaCommunicator extends ICommunicator{ } The concrete class NokiaCommunicator and RelianceCommunicator is below import org.apache.log4j.Logger; public class NokiaCommunicator implements INokiaCommunicator { public static final Logger log ...

Welcome Note!

Welcome to my blog ! Here I collect my random thoughts and paint them on pages as and when they occur. I believe internet is the best thing that is invented and developed by mankind. An excellent platform to share knowledge and gather constructive feedback. What makes it even more special is users such as you, who visit and help making it even more meaningful and better. I would like to thank you for your visit. Purpose of this blog is well served and my time on writing is best spent, if posts of these blog helps you to broden your perspective and mind in any ways.  If you have any questions on any of the topics or have feedback, feel free to write to me and o will personally respond to your query/comment.  You can also join my professional network  LinkedIn Also follow me in Quora, you can find me with my name "Gajendra Choudhary"