Isolation levels & Transaction levels?


The isolation level measures concurrent transaction’s capacity to view data that have been updated, but not yet committed, by another transaction if other transactions were allowed to read data that are as yet uncommitted, those transactions could end up with inconsistent data were the transaction to roll back, or end up waiting unnecessarily were the transaction to commit successfully.
A higher isolation level means less concurrence and a greater likelihood of performance bottleneck, but also a decreased chance of reading inconsistent data. A good rule of thumb is to use the highest isolation level that yields an acceptable performance level. The following are common isolation levels, arranged from lowest to highest.
1) ReadUncommitted: Data that have been updated but not yet committed by a transaction my be read by other transactions
2) Readcommitted: Only data that have been committed by a transaction can be read by other transactions.
3) Repeatable Read: Only data that have been commited by a trasaction can be read by other transactions, and multiple reads will yield the same result as log as the data have been committed.
4) Serializable: This highest possible iosolation level, ensures a transaction’s execlusive read-write access to data, it includes the conditions of ReadCommitted and Repeatable Read and stiplulates that all transactions run serially to achieve maximum data integrity. This yields the slowest performance and least concurrency. The term serializable in this context is absolutely unrelated to the database.

About “Map” data structures in Collections framework?


A map cannot contain duplicate keys; each key can map to at most one value. The Map interface provides three collection views, which allow a map’s contents to be viewed as a set of keys, collection of values, or set of key-value mappings. The order of a map is defined as the order in which the iterators on the map’s collection views return their elements.The TreeMap class, make specific guarantees as to their order; others, like the HashMap class, do not.

Difference between Hashtable & HashMap?


Hash table is a Collection .To successfully store and retrieve objects from a hashtable, the objects used as keys must implement the hashCode method and the equals method.  Hashtable  is Synchronized and permit not null values only.
Hashtable maps keys to values. Any non-null object can be used as a key or as a value.
The HashMap class is roughly equivalent to Hashtable, except that it is unsynchronized and permits nulls.

Difference between JSP & Servlets?


Both are web applications used to produce web content that mean dynamic web pages. Bot are used to take the requests and service the clients. The main difference between them is, In servlets both the presentation and business logic are place it together. Where as in jsp both are separated by defining by java beans .
In jsp’s the overall code is modulated so the developer who doesn’t know about java can write jsp pages by simply knowing the additional tages and class names.
One more important to be considered is servlet take less time to compile. Jsp is a tool to simplify the process and make the process automate.

<jsp:useBean> tag and it’s properties?


To separate the code from the presentation it would be good idea to encapsulate the code in java object instantiate it and use it in our jsp. This instance is variable is called ‘id’.
We can also specific life time of this object by using ‘scope’ attribute
<jsp:useBean id=’name’ scope=”scope” class=”beanclass”/>

Properties:

id: a case sensitive name is used.
Scope: The scope with in which the reference is available. page, request,session, application are possible values
page is default

class: the fully qualified classes name
bean name: The name of the java bean class
type: This type must be super class of the beans classes

JSP Action Tags, Directive Tags & Scripting Tags?


Action Tag: These tags effect the run time behavior of the jsp page and the response
set back to client tags are :

<jsp: usebean> instantiate a new jsp bean class
< jsp: setProperty>: setting the properties at run time
<jsp:param>:used to sending parameters
<jsp:include>include a resource at run time
<jsp:forward>forward the control to specific resource
<jsp:plugin>:to plugin a web resource url applet

Directives:
These tags effect the overall structure of the servlet that result from translation. 3 types of directives are defiend.
Page directive: used to define and manipulate the no of page dependent attributes that effect the whole jsp.
<%@page…….%>
include directive: This instructs the container to include the content of the resource in the current jsp
.<%include file=”—–”/>
this file is parsed once, when translation.
Taglib directive: To use tag extensions to define custom tags.

Scriptlets: There are used to include java code in jsp page these are of 3 types
scriptlet: used to write pure java code
<%———-%>
declarations: used to declare java variables and methods
<%!int num=3;
public void hello(String str)
{
return str;
}
%>
Expressions:
This send the value of a java expression back to client. These results is converted to string and displayed at client.

JSP implicit Objects


The objects which are internal to JSP page are called implicit objects. These are available with jsp page once the jsp invoked.

1)out: used to send the content to the browser
ex: out.println(“xx”)
2)Response: Represent HttpServlet Reques
3) Response: Represent HttpServletResponse
4) Page Context: used to access the objects like session, servlet context, Request, Response etc…
5) Session: Points to HttpSession objects
6) Application: Points to servlet context objects
7)Page: Points to current servlet objects
8) Exception: Points to Exception

What is key diffrence between using a <jsp:forward> and HttpServletResponse.sendRedirect()?


The <jsp:forward> action allows the request to be forwarded to another resource (servlet/jsp/HTMl> which are available in the same web-application (context).
Where as in the case of Response.sendRedirect() the request to be forwarded/redirected to another resource in the same web-application or some other web-application in the same server, or to a resource on some other web-server. The key difference is by using <jsp:forward> single request from a browser can process multiple resources. Where as by using SendRedirect() multiple requests take place in order to process multiple resources.