Tag Archives: Web

History of Web Application

The Figure below clearly depicts the exact evolution of web application all the way from its humble beginning in early 90’s to the current state.

History of Web
Evolution of Web (Copyright Raytheon Company)

It’s very hard to clearly separate Web 1.0 from web 2.0 as there wasn’t anything different which got introduced in Web 2.0. That’s the reason the figure above clearly doesn’t put in a timeline as these are not very clearly defined. Having said that, it evident from the figure that, over the last few decades there has been substantial change in how we see web sites/ applications. When the web initially started, these were not called as applications; rather these were called as sites, with static content and hyperlinks which allows users to navigate from one content page to another. After that came the existence of CGI and Servlets which allowed these static sites to become dynamic and more personalized. These sites slowly started calling themselves as applications as they start to do some basic stuff which a client server application could do for a user. The scene of web applications quickly changed with the introduction of MVC frameworks (In the world of Java Struts was one of the initial MVC frameworks) and the templating engines. These changed the way we looked at web applications and there was a huge rise in people adopting it to make web applications for businesses. With the introduction of Web 2.0 standards, another important addition to the web came into existence in the form of AJAX, which helped web applications to render parts of its page rather than generating the whole page at once. This made web more rich, faster and importantly brought about good user experience. With web 2.0 came into existence new standards (HTML5, CSS3 etc.) and these completely changed this space and a new paradigm shift began to be thought through in the form on client side MVC frameworks.

Page Visitors: 177

Basic Java FAQ – Part 3

101) What is RMI architecture?

Ans: – RMI architecture consists of four layers and each layer performs specific functions:

a) Application layer —- contains the actual object definition

b) Proxy layer —- consists of stub and skeleton

c) Remote Reference layer —- gets the stream of bytes from the transport layer and sends it to the proxy layer

d) Transportation layer —- responsible for handling the actual machine-to-machine communication

102) What is UnicastRemoteObject?

Ans: All remote objects must extend UnicastRemoteObject, which provides functionality that is needed to make objects available from remote machines.

103) Explain the methods, rebind( ) and lookup() in Naming class?

Ans: rebind( ) of the Naming class(found in java.rmi) is used to update the RMI registry on the server machine.

Naming. rebind(“AddSever”, AddServerImpl);

lookup( ) of the Naming class accepts one argument, the rmi URL and returns a reference to an object of type AddServerImpl.

104) What is a Java Bean?

Ans: A Java Bean is a software component that has been designed to be reusable in a variety of different environments.

105) What is a Jar file?

Ans: Jar file allows to efficiently deploying a set of classes and their associated resources. The elements in a jar file are compressed, which makes downloading a Jar file much faster than separately downloading several uncompressed files.

The package java.util.zip contains classes that read and write jar files.

106) What is BDK?

Ans: BDK, Bean Development Kit is a tool that enables to create, configure and connect a set of set of Beans and it can be used to test Beans without writing a code.

107) What is JSP?

Ans: JSP is a dynamic scripting capability for web pages that allows Java as well as a few special tags to be embedded into a web file (HTML/XML, etc). The suffix traditionally ends with .jsp to indicate to the web server that the file is a JSP files. JSP is a server side technology – you can’t do any client side validation with it.

The advantages are:

a) The JSP assists in making the HTML more functional. Servlets on the other hand allow outputting of

HTML but it is a tedious process.

b) It is easy to make a change and then let the JSP capability of the web server you are using deal with compiling it into a servlet and running it.

108) What are JSP scripting elements?

Ans: JSP scripting elements lets to insert Java code into the servlet that will be generated from the current JSP page. There are three forms:

a) Expressions of the form <%= expression %> that are evaluated and inserted into the output,

b) Scriptlets of the form <% code %> that are inserted into the servlet’s service method, and

c) Declarations of the form <%! Code %> that are inserted into the body of the servlet class, outside of any existing methods.

109) What are JSP Directives?

Ans: A JSP directive affects the overall structure of the servlet class. It usually has the following form:

<%@ directive attribute=”value” %>

However, you can also combine multiple attribute settings for a single directive, as follows:

<%@ directive attribute1=”value1″

attribute 2=”value2″

attributeN =”valueN” %>

There are two main types of directive: page, which lets to do things like import classes, customize the servlet superclass, and the like; and include, which lets to insert a file into the servlet class at the time the JSP file is translated into a servlet

110) What are Predefined variables or implicit objects?

Ans: To simplify code in JSP expressions and scriptlets, we can use eight automatically defined variables, sometimes called implicit objects. They are request, response, out, session, application, config, pageContext, and page.

111) What are JSP ACTIONS?

Ans: JSP actions use constructs in XML syntax to control the behavior of the servlet engine. You can dynamically insert a file, reuse JavaBeans components, forward the user to another page, or generate HTML for the Java plugin. Available actions include:

112) How do you pass data (including JavaBeans) to a JSP from a servlet?

Ans: (1) Request Lifetime: Using this technique to pass beans, a request dispatcher (using either “include” or forward”) can be called. This bean will disappear after processing this request has been completed.

Servlet:

request.setAttribute(“theBean”, myBean);

RequestDispatcher rd = getServletContext().getRequestDispatcher(“thepage.jsp”);

rd.forward(request, response);

JSP PAGE:

(2) Session Lifetime: Using this technique to pass beans that are relevant to a particular session

(such as in individual user login) over a number of requests. This bean will disappear when the

session is invalidated or it times out, or when you remove it.

Servlet:

HttpSession session = request.getSession(true);

session.putValue(“theBean”, myBean);

/* You can do a request dispatcher here,

or just let the bean be visible on the

next request */

JSP Page:

3) Application Lifetime: Using this technique to pass beans that are relevant to all servlets and JSP pages in a particular app, for all users. For example, I use this to make a JDBC connection pool object available to the various servlets and JSP pages in my apps. This bean will disappear when the servlet engine is shut down, or when you remove it.

Servlet:

GetServletContext(). setAttribute(“theBean”, myBean);

JSP PAGE:

113) How can I set a cookie in JSP?

Ans: response.setHeader(“Set-Cookie”, “cookie string”);

To give the response-object to a bean, write a method setResponse

(HttpServletResponse response)

– to the bean, and in jsp-file:

<%

bean.setResponse (response);

%>

114) How can I delete a cookie with JSP?

Ans: Say that I have a cookie called “foo,” that I set a while ago & I want it to go away. I simply:

<%

Cookie killCookie = new Cookie(“foo”, null);

KillCookie.setPath(“/”);

killCookie.setMaxAge(0);

response.addCookie(killCookie);

%>

115) How are Servlets and JSP Pages related?

Ans: JSP pages are focused around HTML (or XML) with Java codes and JSP tags inside them. When a web server that has JSP support is asked for a JSP page, it checks to see if it has already compiled the page into a servlet. Thus, JSP pages become servlets and are transformed into pure Java and then compiled, loaded into the server and executed.

Page Visitors: 249