Java is a programming language originally developed by James Gosling at Sun Microsystems (which is now a subsidiary of Oracle Corporation) and released in 1995 as a core component of Sun Microsystems' Java platform. The language derives much of its syntax from C and C++ but has a simpler object model and fewer low-level facilities. Java applications are typically compiled to bytecode (class file) that can run on any Java Virtual Machine (JVM) regardless of computer architecture. Java is a general-purpose, concurrent, class-based, object-oriented language that is specifically designed to have as few implementation dependencies as possible. It is intended to let application developers "write once, run anywhere". Java is currently one of the most popular programming languages in use, particularly for server-client web applications.
Characteristics of Java
Platform neutral language – Java programs are platform neutral, this means program written in Java can be used on any computer running any operating system, this is possible by the help of java virtual machine.
Object-orientated programming language – In java programming language all the elements are object except the primitive data types.
Strongly-typed programming language - Java is strongly-typed programming language, means we must defined the type of the variable before using it and conversion to other objects is relatively strict, it must be done in most cases explicitly by the programmer.
Compiled and Interpreted language – Usually a computer programming language can be either compiled or interpreted, but in case of Java both of the approach is combined, thus it makes java a two stage system. In first stage source code is transferred into the bytecode format which is platform neutral. These bytecode instructions will be interpreted by the Java Interpreter in second stage.
Automatic memory management - Java programming language has the in built memory management capabilities, thus allocation and de-allocation for creating new objects is handled by java. Java program does not have direct access to the memory. There is a garbage collector deletes objects automatically which is not active in the program.
JavaServer Pages (JSP) is a server-side programming technology that enables the creation of dynamic, platform-independent method for building Web-based applications. JSP have access to the entire family of Java APIs, including the JDBC API to access enterprise databases.
How Do JSP Pages Work?
Servlets provide a component-based, platform-independent method for building Web-based applications, without the performance limitations of CGI programs. Servlets have access to the entire family of Java APIs, including the JDBC API to access enterprise databases.
Servlets Architecture:
Following diagram shows the position of Servelts in a Web Application.
MVC Pattern stands for Model-View-Controller Pattern. This pattern is used to separate application's concerns.
Model - Model represents an object or JAVA POJO carrying data. It can also have logic to update controller if its data changes.
View - View represents the visualization of the data that model contains.
Controller - Controller acts on both Model and view. It controls the data flow into model object and updates the view whenever data changes. It keeps View and Model separate.