Today , I am starting the introduction of web programming in Java language.As a developer , it is very great to write on these types of topics.So , without wasting a single second I am going to start the introduction of web programming in Java.
Languages Used for Web Programming
Firstly , I am starting from that what are the languages used for web programming .
Well , there are several languages and frameworks are available which used for web programming or for web development.Java is one of these languages , it is one of the older and more established languages in which web applications have been developed.Well , this post covers the Java-based web programming using Servlets and JSP, it also includes the introduction of news feed protocol RSS version 2.0, and REST-based web services.
Java is a strict object-oriented language in which all function calls are made to either static methods of classes or to non-static methods that are invoked through class instances. These classes are organized into namespaces called packages, so that unqualified class names do not need to be globally unique.
An application programming interface (API) is a specification that defines how user code can access system functionality. The Java API refers to the specification that defines how Java code may access functionality, such as opening a file in the file system, creating a socket connection with another process, creating a linked-list of objects, etc. For example, the following line creates an instance of the Socket class, which can be used to make TCP connections to other processes.
java.net.Socket socket = new java.net.Socket("localhost", 8080);
The above line of code can be simplified by importing the class java.net.Socket into the local namespace by adding the following line just after the package declaration of a java source code file.
The above import statement allows for the following simplified version of the socket creation code give above, in which the package prefix qualifiers are dropped from the Socket class.
Socket socket = new Socket("localhost", 8080);
The Servlet API
The Socket class is an example of a class that is part of the core Java API, which is available in all standard Java virtual machine (JVM) environments. However, web applications typically additional functionality that is not part of the core Java API. In particular, conventional web applications need to be able to access functionality provided through the Servlet API.
Implementations of the Servlet API are provided by third parties, such as Apache, IBM, Oracle, etc. In fact, the Servlet API is provided by something called a web container (or Servlet container), which is defined within an extensive specification called Java 2 Enterprise Edition (J2EE). A web container is actually a web server that loads and executes Java Servlets to process incoming requests from browsers (or other HTTP clients).
Java 2 Enterprise Edition (J2EE)
The Java 2 Enterprise Edition is a specification developed by Sun Microsystems with input from other major companies in the industry through a mechanism called the Java Community Process (JCP). J2EE describes a set of services that application developers utilize to solve enterprise computing problems. There are many third party implementations of J2EE, including both expensive proprietary implementations, and free open source implementations. The Apache Software Foundation provides a free open source implementation of J2EE web containers, called Tomcat, which is widely used in the industry for web applications. Tomcat is not a complete implementation of the J2EE standard. In particular, it does not provide an Enterprise Java Beans (EJB) container. JBoss is a popular, free, open source implementation of the complete J2EE standard. The JBoss project itself does not provide an implementation of the Web container; instead, it requires that a third party web container be plugged in. However, Tomcat is the default Web container that comes packaged and pre-configured with JBoss. A popular alternative to Tomcat is Resin and a popular non-free alternative to JBoss is IBM’s WebSphere.
Java Server Pages (JSP)
Java Server Pages (JSP) is a notation that is added to HTML files, so that per-request functionality can be added to otherwise statically-defined HTML.It is possible to place all program functionality into JSP files. However, this practice is widely frowned against, because it leads to code that is difficult to maintain after a project grows in size. There are several reasons for this. First, JSP files are compiled at runtime by the web container, so that syntax errors are detected at runtime. By placing this code into Servlets, syntax errors are detected at compile time, which allows syntax errors to be caught and fixed at an earlier point in time. Second, JSP files can not make use of inheritance, so that projects solely written in JSP look more like functional programs rather than object-oriented programs, and thus do not make use of the benefits provided by object-oriented design.
One can move away from pure JSP designs in two degrees: the java beans approach, and the servlet approach. The Java beans approach moves database access and other logic into Java beans, which are then invoked from the JSP. The Servlet approach also moves database access and other logic into Java beans, but also moves controller logic into Java Servlets, and invokes most of the Java bean functionality from the servlets.
Rich Site Summary (RSS)
Rich Site Summary (RSS) is an XML-based format for syndicating content. Rather than develop all the needed code from scratch, we utilize functionality provided by two different open source projects: JDOM and Informa. JDOM is a library that simplifies the processing of XML documents, and Informa is a library that simplifies the parsing of RSS documents. These libraries come in the form of jar files, which are zip files containing the byte code that comprise Java class and interface definitions. To access the functionality provided by these libraries, the jar files must be placed in what is called the classpath. The classpath is basically a list of folders and jar files that the Java classloader searches to find definitions of Java classes. When the jar file of a library is present in the classpath, then its API becomes visible to application code.
There is a tool, called javadoc, that is used to generated API documentation from code and the comments embedded within it. This generated documentation is in the form of HTML pages, and is thus viewed within a browser. It is important to become familiar with javadoc-generated API documentation, because it is the standard means to document Java APIs.
Representational State Transfer (REST)
Representational State Transfer (REST) is formally an architectural style for building distributed software applications, that is, software systems that run on separate computers and that communicate with each other over a network. However, the term is informally used to represent an approach to building Web services in which message data is placed in XML documents and transported using HTTP. In this second meaning, REST is an alternative to the more complex form of Web services based on SOAP and WSDL.
Well , this post is ending here but the introduction have some points whcih are remaining.I will write the remaining things in next post .It is the first part of the introduction of web programming in Java language.