<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Java Interview Questions</title>
	<atom:link href="http://www.bestjavainterviewquestions.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.bestjavainterviewquestions.com</link>
	<description>Java Interview Questions &#124; Core Java Interview Questions &#124; Advanced Java Interview Questions &#124; EJB Interview Questions &#124; J2EE Interview Questions &#124; Hibernate Interview Questions</description>
	<lastBuildDate>Fri, 03 Feb 2012 10:23:55 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Why ActionServlet is Singleton in struts framework?</title>
		<link>http://www.bestjavainterviewquestions.com/why-actionservlet-is-singleton-in-struts-framework/</link>
		<comments>http://www.bestjavainterviewquestions.com/why-actionservlet-is-singleton-in-struts-framework/#comments</comments>
		<pubDate>Thu, 07 Apr 2011 13:07:41 +0000</pubDate>
		<dc:creator>Ramakrishna</dc:creator>
				<category><![CDATA[Struts Interview Questions]]></category>
		<category><![CDATA[actionservlet]]></category>
		<category><![CDATA[actionservlet class]]></category>
		<category><![CDATA[actionservlet controller]]></category>
		<category><![CDATA[struts framework]]></category>

		<guid isPermaLink="false">http://www.bestjavainterviewquestions.com/?p=635</guid>
		<description><![CDATA[actionservlet class ,struts framework,web.xml]]></description>
			<content:encoded><![CDATA[<div id="_mcePaste">org.apache.struts.action.ActionServlet in the web.xml configuration file must defined as</div>
<div id="_mcePaste">ActionServlet provided by the struts Framework is a built-in servlet. ActionServlet nothing but a controller.</div>
<div id="_mcePaste">It has the following inbuilt design patterns.</div>
<div id="_mcePaste">1 singleton designpatteren.</div>
<div id="_mcePaste">2.FrontController</div>
<div id="_mcePaste">3.ApplicationController</div>
<div id="_mcePaste">4.MVC</div>
<div id="_mcePaste">5.Data Transfer object/value object</div>
<div id="_mcePaste">6.Inversion of control/Dependency injection</div>
<div id="_mcePaste">ActionServlet take the multiple request but it creates single instance for that requests by using singleton design pattern.</div>
<div id="_mcePaste">Few servers likes weblogic violates single instance multiple threads principle of servlet programming.That means these servers that will create more than once object for a class in special situation. see here</div>
<div id="_mcePaste">To avoid this type of situations &amp; to follow servlet specifications, struts framework software developers have made built-in servlet called ActionServlet.</div>
<div id="_mcePaste">Note:</div>
<div id="_mcePaste">1. According to MVC principles, there should be only one servlet acting as controller and this servlet should have only one object.</div>
<div id="_mcePaste">2. Both the approaches have advantages &amp; disadvantages <img src='http://www.bestjavainterviewquestions.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </div>
<p>org.apache.struts.action.ActionServlet in the web.xml configuration file must defined as<br />
ActionServlet provided by the struts Framework is a built-in servlet. ActionServlet nothing but a controller.It has the following inbuilt design patterns.<br />
1 singleton designpatteren.</p>
<p>2.FrontController</p>
<p>3.ApplicationController</p>
<p>4.MVC</p>
<p>5.Data Transfer object/value object</p>
<p>6.Inversion of control/Dependency injection<br />
ActionServlet take the multiple request but it creates single instance for that requests by using singleton design pattern.<br />
Few servers likes weblogic violates single instance multiple threads principle of servlet programming.That means these servers that will create more than once object for a class in special situation. see hereTo avoid this type of situations &amp; to follow servlet specifications, struts framework software developers have made built-in servlet called ActionServlet.<br />
Note:</p>
<p>1. According to MVC principles, there should be only one servlet acting as controller and this servlet should have only one object.</p>
<p>2. Both the approaches have advantages &amp; disadvantages</p>
<h2  class="related_post_title">Random Posts</h2><ul class="related_post"><li>September 7, 2008 -- <a href="http://www.bestjavainterviewquestions.com/define-cookies/" title="Define Cookies">Define Cookies</a> (0)</li><li>October 5, 2008 -- <a href="http://www.bestjavainterviewquestions.com/difference-between-get-and-head-request-methods/" title="Difference between GET and HEAD request methods">Difference between GET and HEAD request methods</a> (0)</li><li>August 15, 2008 -- <a href="http://www.bestjavainterviewquestions.com/thread-example-for-runnable-interface/" title="Thread example for Runnable Interface">Thread example for Runnable Interface</a> (1)</li><li>April 7, 2009 -- <a href="http://www.bestjavainterviewquestions.com/overview-of-servlets/" title="OVERVIEW OF SERVLETS">OVERVIEW OF SERVLETS</a> (0)</li><li>October 5, 2008 -- <a href="http://www.bestjavainterviewquestions.com/thread-safety-of-the-servlet/" title="Thread safety of the servlet">Thread safety of the servlet</a> (0)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.bestjavainterviewquestions.com/why-actionservlet-is-singleton-in-struts-framework/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Define Hashtable,HashMap and HashSet</title>
		<link>http://www.bestjavainterviewquestions.com/define-hashtablehashmap-and-hashset/</link>
		<comments>http://www.bestjavainterviewquestions.com/define-hashtablehashmap-and-hashset/#comments</comments>
		<pubDate>Tue, 17 Aug 2010 11:25:49 +0000</pubDate>
		<dc:creator>Ramakrishna</dc:creator>
				<category><![CDATA[Java Interview Questions]]></category>
		<category><![CDATA[Collections]]></category>
		<category><![CDATA[HashMap]]></category>
		<category><![CDATA[HashSet]]></category>
		<category><![CDATA[HashTable]]></category>
		<category><![CDATA[map]]></category>
		<category><![CDATA[set]]></category>

		<guid isPermaLink="false">http://www.bestjavainterviewquestions.com/?p=627</guid>
		<description><![CDATA[Hashtable Hashtable is basically a datastructure to retain values of key-value pair. It didn&#8217;t allow null for both key and value. You will get NullPointerException if you add null value. It is synchronized. So it come with its cost. Only one thread can access in one time Hashtable&#60;Interger,String&#62;; cityTable=new Hashtable&#60;Interger,String&#62;(); cityTable.put(1,&#8221;Lahore&#8221;); cityTable.put(2,&#8221;Karachi&#8221;); cityTable.put(3,null); // NullPointerException [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Hashtable</strong></p>
<p>Hashtable is basically a datastructure to retain values of key-value pair.</p>
<ul>
<li>It didn&#8217;t allow null for both key and value. You will get NullPointerException if you add null value.</li>
<li>It is synchronized. So it come with its cost. Only one thread can access in one time</li>
</ul>
<ol>
<li><em>Hashtable&lt;Interger,String&gt;; cityTable=new Hashtable&lt;Interger,String&gt;();</em></li>
<li><em>cityTable.put(1,&#8221;Lahore&#8221;);</em></li>
<li><em>cityTable.put(2,&#8221;Karachi&#8221;);</em></li>
<li><em>cityTable.put(3,null); // NullPointerException at runtime</em></li>
<li><em>System.out.println(cityTable.get(1));</em></li>
<li><em>System.out.println(cityTable.get(2));</em></li>
<li><em>System.out.println(cityTable.get(3));</em></li>
</ol>
<p><strong>HashMap</strong></p>
<p>Like Hashtable it also accepts key value pair.</p>
<ul>
<li>It allows null for both key and value</li>
<li>It is un-synchronized. So come up with better performance</li>
</ul>
<ol>
<li><em>HashMap&lt;Interger,String&gt;; prodcutTable=new HashMap&lt;Interger,String&gt;();</em></li>
<li><em>prodcutTable</em><em>.put(1,&#8221;Keys&#8221;);</em></li>
<li><em>prodcutTable</em><em>.put(2,null);</em></li>
</ol>
<p><strong>HashSet</strong></p>
<p>HashSet does not allow duplicate values. It provides add method rather put method. You also use its contain method to check whether the object is already available in HashSet. HashSet can be used  where you want to maintain a unique list.</p>
<ol>
<li><em>HashSet&lt;String&gt;; stateSet=new HashSet&lt;String&gt;();</em></li>
<li><em>stateSet</em><em>.add(&#8220;CA&#8221;);</em></li>
<li><em>stateSet</em><em>.</em><em>add</em><em>(&#8220;WI&#8221;);</em></li>
<li><em>stateSet</em><em>.</em><em>add</em><em>(&#8220;NY&#8221;);</em></li>
<li></li>
<li>if(stateSet.contains(&#8220;PB&#8221;)) /* if CA,it will not add but shows following message */</li>
<li><em>System.out.println(Already found);</em></li>
<li><em>else<br />
</em></li>
<li><em>stateSet.add(&#8220;PB&#8221;);</em></li>
</ol>
<p>Use hashSet if you just want to have a set of object, HashMap if you want some mappings(key-value pair), Use Hashtable in multi threaded enviroment as its synchronized (alternatively you can use a synchronizedMap as well)</p>
<p>For More Information on Collections Visit <a href="http://www.bestjavainterviewquestions.com/java-util-package-2/">UTIL PACKAGE</a></p>
<h2  class="related_post_title">Related Post</h2><ul class="related_post"><li>June 23, 2008 -- <a href="http://www.bestjavainterviewquestions.com/java-util-package-2/" title="JAVA UTIL PACKAGE">JAVA UTIL PACKAGE</a> (0)</li><li>June 23, 2008 -- <a href="http://www.bestjavainterviewquestions.com/19/" title="Java Basic Questions">Java Basic Questions</a> (1)</li><li>May 22, 2008 -- <a href="http://www.bestjavainterviewquestions.com/core-java-interview-questions/" title="Core Java Interview Questions">Core Java Interview Questions</a> (1)</li><li>May 22, 2008 -- <a href="http://www.bestjavainterviewquestions.com/basic-java-interview-question/" title="Basic Java Interview Question">Basic Java Interview Question</a> (1)</li><li>March 24, 2009 -- <a href="http://www.bestjavainterviewquestions.com/define-hashset-class/" title="Define HashSet Class">Define HashSet Class</a> (0)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.bestjavainterviewquestions.com/define-hashtablehashmap-and-hashset/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Stored Procedures for Beginners</title>
		<link>http://www.bestjavainterviewquestions.com/stored-procedures-for-beginners/</link>
		<comments>http://www.bestjavainterviewquestions.com/stored-procedures-for-beginners/#comments</comments>
		<pubDate>Fri, 30 Jul 2010 06:00:25 +0000</pubDate>
		<dc:creator>Ramakrishna</dc:creator>
				<category><![CDATA[Jdbc questions]]></category>
		<category><![CDATA[jdbc questions]]></category>
		<category><![CDATA[Stored Procedures]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[plsql]]></category>
		<category><![CDATA[procedures]]></category>
		<category><![CDATA[stored procedures]]></category>

		<guid isPermaLink="false">http://www.bestjavainterviewquestions.com/?p=623</guid>
		<description><![CDATA[you are reading my article because you want to learn how to write stored procedures. You are new to this, and you don&#8217;t know where to start. You are exactly where I was when I wanted to learn how to write stored procedures. The purpose of this article is to help the developer who doesn&#8217;t [...]]]></description>
			<content:encoded><![CDATA[<p>you are reading my article because you want to learn how to write stored procedures. You are new to this, and you don&#8217;t know where to start. You are exactly where I was when I wanted to learn how to write stored procedures. The purpose of this article is to help the developer who doesn&#8217;t know where to start. I will give you a place to start, teach you techniques beyond the basic &#8220;hello world&#8221;, and walk you through examples. I learned how to write stored procedures alone, and have decided to let you use my experiences to your advantage. This article will consist of the following topics:</p>
<p>1. Input Variables</p>
<p>2. Input Variables with SELECT and UPDATE Statements</p>
<p>3. Exercise:  Pass Data to a SELECT Stored Procedure</p>
<p>4. Conclusion</p>
<p>5. Database script for SPFORBEGINNERS (the database referenced in this article)</p>
<p>At the end, I have also included a SQL script for creating the database used in my examples. It is a small database, and easily replicated.</p>
<p>What Are Stored Procedures?</p>
<p>Have you ever written SQL statements, like inserts, selects, and updates? Then you have already written most of a stored procedure. A stored procedure is an already written SQL statement that is saved in the database. If you find yourself using the same query over and over again, it would make sense to put it into a stored procedure. When you put this SQL statement in a stored procedure, you can then run the stored procedure from the database&#8217;s command environment.<br />
An example is:</p>
<p>exec usp_displayallusers</p>
<p>The name of the stored procedure is &#8220;usp_displayallusers&#8221;, and &#8220;exec&#8221; tells SQL Server to execute the code in the stored procedure. (Note: &#8220;usp_&#8221; in front of the stored procedure name is used to designate this stored procedure as a user-created stored procedure.) The code inside the stored procedure can be something as simple as:</p>
<p>SELECT * FROM USERLIST</p>
<p>This &#8220;select&#8221; statement will return all data in the USERLIST table. You may think, skeptically, that stored procedures aren’t terribly useful. Just save the query and run it when you need to. Too easy, right?</p>
<p>Well, there is more to the story. Many queries get more complex than &#8220;select * from . . .&#8221;  Also, you may want to call the stored procedure from an application, such as an ASP page, Visual Basic application, or a Java servlet. With a stored procedure, you can store all the logic in the database, and use a simple command to call the stored procedure. Later, if you decide to use J2EE, you only need to change the application layer, which will be significantly easier. Much of the business logic will remain in the database.</p>
<p>Enough background—let’s write some stored procedures.</p>
<p>Getting Started with Stored Procedures</p>
<p>What do I need to get started? I have heard that question often. To begin writing stored procedures, the following are essential:</p>
<p>1. A database management system.</p>
<p>2. A database built inside the database management system (see the end of this article for a sample).</p>
<p>3. A text editor, such as Notepad or Query Analyzer.</p>
<p>Items 1 and 2 are absolutely essential. You can’t write stored procedures without a database. They would be useless. Sometimes, I write my procedures in Notepad (or another text editor), and copy them into the New Stored Procedure window in My SQL Server.</p>
<p>Next, you will have to decide what you want your stored procedure to do. It can be tempting to just dive right into the task at hand, but it is always prudent to sketch out some ideas first. Some considerations should be:</p>
<p>* Do you want to view data in the database (SELECT), insert new records (INSERT INTO), or do I want to change an existing record (UPDATE)?</p>
<p>* With which tables will you have to work? Does it make sense to create a VIEW first?</p>
<p>* How often will this procedure actually be used?</p>
<p>Once you have struggled with these questions (something of an exaggeration, I guess), you will be ready to start coding!</p>
<p>Note: Throughout this article, I will focus on stored procedures for My SQL Server. You can apply the same principles to other database management systems, but I will make clear references to working in a My SQL Server environment.</p>
<p>You May Consider this things also</p>
<p>Before creating a stored procedure, consider that:</p>
<p>* CREATE PROCEDURE statements cannot be combined with other SQL statements in a single batch.</p>
<p>* To create procedures, you must have CREATE PROCEDURE permission in the database and ALTER permission on the schema in which the procedure is being created. For CLR stored procedures, you must either own the assembly referenced in &lt;method_specifier&gt;, or have REFERENCES permission on that assembly.</p>
<p>* Stored procedures are schema-scoped objects, and their names must follow the rules for identifiers.</p>
<p>* You can create a stored procedure only in the current database.</p>
<p>When creating a stored procedure, you should specify:</p>
<p>* Any input parameters and output parameters to the calling procedure or batch.</p>
<p>* The programming statements that perform operations in the database, including calling other procedures.</p>
<p>* The status value returned to the calling procedure or batch to indicate success or failure (and the reason for failure).</p>
<p>* Any error handling statements needed to catch and handle potential errors.</p>
<p>Error handing functions such as ERROR_LINE and ERROR_PROCEDURE can be specified in the stored procedure.</p>
<h2  class="related_post_title">Related Post</h2><ul class="related_post"><li>April 7, 2009 -- <a href="http://www.bestjavainterviewquestions.com/overview-of-servlets/" title="OVERVIEW OF SERVLETS">OVERVIEW OF SERVLETS</a> (0)</li><li>April 5, 2009 -- <a href="http://www.bestjavainterviewquestions.com/how-to-get-a-leap-year/" title="How to get a Leap Year">How to get a Leap Year</a> (0)</li><li>March 29, 2009 -- <a href="http://www.bestjavainterviewquestions.com/j2ee-interview-questions/" title="J2EE Interview Questions">J2EE Interview Questions</a> (0)</li><li>March 25, 2009 -- <a href="http://www.bestjavainterviewquestions.com/creating-a-stateful-session-bean/" title="Creating a Stateful session Bean">Creating a Stateful session Bean</a> (1)</li><li>March 24, 2009 -- <a href="http://www.bestjavainterviewquestions.com/define-hashset-class/" title="Define HashSet Class">Define HashSet Class</a> (0)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.bestjavainterviewquestions.com/stored-procedures-for-beginners/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to Make a Class Serializable</title>
		<link>http://www.bestjavainterviewquestions.com/how-to-make-a-class-serializable/</link>
		<comments>http://www.bestjavainterviewquestions.com/how-to-make-a-class-serializable/#comments</comments>
		<pubDate>Wed, 21 Jul 2010 11:59:59 +0000</pubDate>
		<dc:creator>Ramakrishna</dc:creator>
				<category><![CDATA[Java Serialization]]></category>
		<category><![CDATA[deserialization]]></category>
		<category><![CDATA[marker interface]]></category>
		<category><![CDATA[serializable]]></category>
		<category><![CDATA[serialization]]></category>

		<guid isPermaLink="false">http://www.bestjavainterviewquestions.com/?p=613</guid>
		<description><![CDATA[So far, we&#8217;ve focused on the mechanics of serializing an object. We&#8217;ve assumed we have a serializable object and discussed, from the point of view of client code, how to serialize it. The next step is discussing how to make a class serializable. Serialization is also called as Marker Interface There are four basic things [...]]]></description>
			<content:encoded><![CDATA[<p>So far, we&#8217;ve focused on the mechanics of serializing an object. We&#8217;ve assumed we have a serializable object and discussed, from the point of view of client code, how to serialize it. The next step is discussing how to make a class serializable.</p>
<p>Serialization is also called as Marker Interface</p>
<p><strong><em>There are four basic things you must do when you are making a class serializable. They are:</em></strong></p>
<p>1. Implement the Serializable interface.</p>
<p>2. Make sure that instance-level, locally defined state is serialized properly.</p>
<p>3. Make sure that superclass state is serialized properly.</p>
<p>4. Override equals( ) and hashCode( ).</p>
<p>Let&#8217;s look at each of these steps in more detail.<br />
Implement the Serializable Interface</p>
<p>This is by far the easiest of the steps. The Serializable interface is an empty interface; it declares no methods at all. So implementing it amounts to adding &#8220;implements Serializable&#8221; to your class declaration.</p>
<p>Reasonable people may wonder about the utility of an empty interface. Rather than define an empty interface, and require class definitions to implement it, why not just simply make every object serializable? The main reason not to do this is that there are some classes that don&#8217;t have an obvious serialization. Consider, for example, an instance of File. An instance of File represents a file. Suppose, for example, it was created using the following line of code:</p>
<p>File file = new File(&#8220;c:\\New Floder\\Temp&#8221;);</p>
<p>It&#8217;s not at all clear what should be written out when this is serialized. The problem is that the file itself has a different lifecyle than the serialized data. The file might be edited, or deleted entirely, while the serialized information remains unchanged. Or the serialized information might be used to restart the application on another machine, where &#8220;C:\\New Floder\\Temp&#8221; is the name of an entirely different file.</p>
<p>Another example is provided by the Thread[4] class. A thread represents a flow of execution within a particular JVM. You would not only have to store the stack, and all the local variables, but also all the related locks and threads, and restart all the threads properly when the instance is deserialized.</p>
<p>TIP:   Things get worse when you consider platform dependencies. In general, any class that involves native code is not really a good candidate for serialization.</p>
<p>Make Sure That Instance-Level, Locally Defined State Is Serialized Properly</p>
<p>Class definitions contain variable declarations. The instance-level, locally defined variables (e.g., the nonstatic variables) are the ones that contain the state of a particular instance. For example, in our Money class, we declared one such field:</p>
<p>public class Money extends ValueObject {<br />
private int _cents;<br />
&#8230;.<br />
}</p>
<p>The serialization mechanism has a nice default behavior&#8211;if all the instance-level, locally defined variables have values that are either serializable objects or primitive datatypes, then the serialization mechanism will work without any further effort on our part. For example, our implementations of Account, such as Account_Impl, would present no problems for the default serialization mechanism:</p>
<p>public class Account_Impl extends UnicastRemoteObject implements Account {<br />
private Money _balance;<br />
&#8230;<br />
}</p>
<p>While _balance doesn&#8217;t have a primitive type, it does refer to an instance of Money, which is a serializable class.</p>
<p>If, however, some of the fields don&#8217;t have primitive types, and don&#8217;t refer to serializable classes, more work may be necessary. Consider, for example, the implementation of ArrayList from the java.util package. An ArrayList really has only two pieces of state:</p>
<p>public class ArrayList extends AbstractList implements List, Cloneable, java.io.<br />
Serializable {<br />
private Object elementData[];<br />
private int size;<br />
&#8230;<br />
}</p>
<p>But hidden in here is a huge problem: ArrayList is a generic container class whose state is stored as an array of objects. While arrays are first-class objects in Java, they aren&#8217;t serializable objects. This means that ArrayList can&#8217;t just implement the Serializable interface. It has to provide extra information to help the serialization mechanism handle its nonserializable fields. There are three basic solutions to this problem:<br />
<em><br />
<strong>* Fields can be declared to be transient.</strong></em></p>
<p><strong><em>* The writeObject( )/readObject( ) methods can be implemented.</em></strong></p>
<p><strong><em>* serialPersistentFields can be declared. </em></strong></p>
<p>&nbsp;</p>
<p><em><strong>You can find more information on serialization</strong></em> at <a title="Using Serialization" href="http://www.bestjavainterviewquestions.com/using-serialization/" target="_blank">1</a> and <a title="Brief information about serialization" href="http://www.bestjavainterviewquestions.com/explain-briefly-about-serialization/" target="_blank">2</a></p>
<h2  class="related_post_title">Related Post</h2><ul class="related_post"><li>July 21, 2010 -- <a href="http://www.bestjavainterviewquestions.com/explain-briefly-about-serialization/" title="Explain Briefly about Serialization">Explain Briefly about Serialization</a> (0)</li><li>July 21, 2010 -- <a href="http://www.bestjavainterviewquestions.com/using-serialization/" title="Using Serialization ">Using Serialization </a> (0)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.bestjavainterviewquestions.com/how-to-make-a-class-serializable/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Using Serialization</title>
		<link>http://www.bestjavainterviewquestions.com/using-serialization/</link>
		<comments>http://www.bestjavainterviewquestions.com/using-serialization/#comments</comments>
		<pubDate>Wed, 21 Jul 2010 11:53:11 +0000</pubDate>
		<dc:creator>Ramakrishna</dc:creator>
				<category><![CDATA[Java Serialization]]></category>
		<category><![CDATA[deserialization]]></category>
		<category><![CDATA[examples of deserialization]]></category>
		<category><![CDATA[examples of serialization]]></category>
		<category><![CDATA[serialization]]></category>
		<category><![CDATA[uses of serialization]]></category>

		<guid isPermaLink="false">http://www.bestjavainterviewquestions.com/?p=610</guid>
		<description><![CDATA[Serialization is a mechanism built into the core Java libraries for writing a graph of objects into a stream of data. This stream of data can then be programmatically manipulated, and a deep copy of the objects can be made by reversing the process. This reversal is often called deserialization. Note: When serializing an object [...]]]></description>
			<content:encoded><![CDATA[<p>Serialization is a mechanism built into the core Java libraries for writing a graph of objects into a stream of data. This stream of data can then be programmatically manipulated, and a deep copy of the objects can be made by reversing the process. This reversal is often called deserialization.</p>
<p><em><strong>Note: </strong>When serializing an object to a file, the standard convention in Java is to give the file a .ser extension.</em></p>
<p><strong><em>import java.io.*;</em></strong></p>
<p><strong><em>public class SerializeDemo<br />
{</em></strong></p>
<p><strong><em>public static void main(String [] args)<br />
{</em></strong></p>
<p><strong><em>Employee e = new Employee();<br />
e.name = &#8220;Ramakrishna&#8221;;<br />
e.address = &#8220;Hyderabad&#8221;;<br />
e.SSN = 11122333;<br />
e.number = 200113;</em></strong></p>
<p><strong><em>try<br />
{</em></strong></p>
<p><strong><em>FileOutputStream fileOut =<br />
new FileOutputStream(&#8220;employee.ser&#8221;);<br />
ObjectOutputStream out =<br />
new ObjectOutputStream(fileOut);<br />
out.writeObject(e);<br />
out.close();<br />
fileOut.close();</em></strong></p>
<p><strong><em>}catch(IOException i)<br />
{<br />
i.printStackTrace();<br />
}<br />
}<br />
}</em></strong></p>
<p><em>The following DeserializeDemo program deserializes the Employee object created in the SerializeDemo program. Study the program and try to determine its output:</em></p>
<p><strong><em>import java.io.*;</em></strong></p>
<p><strong><em>public class DeserializeDemo<br />
{</em></strong></p>
<p><strong><em>public static void main(String [] args)<br />
{</em></strong></p>
<p><strong><em>Employee e = null;</em></strong></p>
<p><strong><em>try<br />
{<br />
FileInputStream fileIn =<br />
new FileInputStream(&#8220;employee.ser&#8221;);<br />
ObjectInputStream in = new ObjectInputStream(fileIn);<br />
e = (Employee) in.readObject();<br />
in.close();<br />
fileIn.close();<br />
}catch(IOException i)<br />
{<br />
i.printStackTrace();<br />
return;</em></strong></p>
<p><strong><em>}catch(ClassNotFoundException c)<br />
{<br />
System.out.println(.Employee class not found.);<br />
c.printStackTrace();<br />
return;<br />
}</em></strong></p>
<p><strong><em>System.out.println(&#8220;Deserialized Employee&#8230;&#8221;);<br />
System.out.println(&#8220;Name: &#8221; + e.name);<br />
System.out.println(&#8220;Address: &#8221; + e.address);<br />
System.out.println(&#8220;SSN: &#8221; + e.SSN);<br />
System.out.println(&#8220;Number: &#8221; + e.number);<br />
}<br />
}</em></strong></p>
<p><em>This would produce following result:</em></p>
<p><em>Deserialized Employee&#8230;<br />
Name: Ramakrishna<br />
Address:Hyderabad<br />
SSN: 0<br />
Number:200113</em></p>
<p><strong><em><br />
</em></strong></p>
<p>In particular, there are three main uses of serialization:</p>
<p>As a persistence mechanism<br />
If the stream being used is FileOutputStream, then the data will automatically be written to a file.</p>
<p>As a copy mechanism<br />
If the stream being used is ByteArrayOutputStream, then the data will be written to a byte array in memory. This byte array can then be used to create duplicates of the original objects.</p>
<p>As a communication mechanism<br />
If the stream being used comes from a socket, then the data will automatically be sent over the wire to the receiving socket, at which point another program will decide what to do.</p>
<p>The important thing to note is that the use of serialization is independent of the serialization algorithm itself. If we have a serializable class, we can save it to a file or make a copy of it simply by changing the way we use the output of the serialization mechanism.</p>
<p>As you might expect, serialization is implemented using a pair of streams. Even though the code that underlies serialization is quite complex, the way you invoke it is designed to make serialization as transparent as possible to Java developers. To serialize an object, create an instance of ObjectOutputStream and call the writeObject( ) method; to read in a serialized object, create an instance of ObjectInputStream and call the readObject( ) object.</p>
<p><strong>TIP: </strong> <em>There are two versions of the serialization protocol currently defined: PROTOCOL_VERSION_1 and PROTOCOL_VERSION_2. If you send serialized data to a 1.1 (or earlier) JVM, you should probably use PROTOCOL_VERSION_1. The most common case of this involves applets. Most applets run in browsers over which the developer has no control. This means, in particular, that the JVM running the applet could be anything, from Java 1.0.2 through the latest JVM. Most servers, on the other hand, are written using JDK1.2.2 or later.[3] If you pass serialized objects between an applet and a server, you should specify the serialization protocol. </em></p>
<h2  class="related_post_title">Related Post</h2><ul class="related_post"><li>July 21, 2010 -- <a href="http://www.bestjavainterviewquestions.com/how-to-make-a-class-serializable/" title="How to Make a Class Serializable">How to Make a Class Serializable</a> (1)</li><li>July 21, 2010 -- <a href="http://www.bestjavainterviewquestions.com/explain-briefly-about-serialization/" title="Explain Briefly about Serialization">Explain Briefly about Serialization</a> (0)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.bestjavainterviewquestions.com/using-serialization/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Explain Briefly about Serialization</title>
		<link>http://www.bestjavainterviewquestions.com/explain-briefly-about-serialization/</link>
		<comments>http://www.bestjavainterviewquestions.com/explain-briefly-about-serialization/#comments</comments>
		<pubDate>Wed, 21 Jul 2010 11:49:08 +0000</pubDate>
		<dc:creator>Ramakrishna</dc:creator>
				<category><![CDATA[Java Important Notes]]></category>
		<category><![CDATA[Java Serialization]]></category>
		<category><![CDATA[define serialization]]></category>
		<category><![CDATA[deserialization]]></category>
		<category><![CDATA[explain serialization]]></category>
		<category><![CDATA[marker interface]]></category>
		<category><![CDATA[serialization]]></category>

		<guid isPermaLink="false">http://www.bestjavainterviewquestions.com/?p=608</guid>
		<description><![CDATA[Serialization is the process of converting a set of object instances that contain references to each other into a linear stream of bytes, which can then be sent through a socket, stored to a file, or simply manipulated as a stream of data. Serialization is the mechanism used by RMI to pass objects between JVMs, [...]]]></description>
			<content:encoded><![CDATA[<p>Serialization is the process of converting a set of object instances that contain references to each other into a linear stream of bytes, which can then be sent through a socket, stored to a file, or simply manipulated as a stream of data. Serialization is the mechanism used by <a class="wp-caption" title="Frequently Asked Questions of RMI" href="http://www.bestjavainterviewquestions.com/java-rmi-interview-questions/" target="_blank">RMI </a>to pass objects between JVMs, either as arguments in a method invocation from a client to a server or as return values from a method invocation. In the first section of this book, I referred to this process several times but delayed a detailed discussion until now. In this chapter, we drill down on the serialization mechanism; by the end of it, you will understand exactly how serialization works and how to use it efficiently within your applications.</p>
<p>What does it mean for the client to pass an instance of Money to the server? At a minimum, it means that the server is able to call public methods on the instance of Money. One way to do this would be to implicitly make Money into a server as well.[1] For example, imagine that the client sends the following two pieces of information whenever it passes an instance as an argument:</p>
<ul>
<li><em> <strong>The type of the instance; in this case, Money.</strong></em></li>
<li><strong><em> A unique identifier for the object (i.e., a logical reference). For example, the address of the instance in memory.</em></strong></li>
</ul>
<p>The RMI runtime layer in the server can use this information to construct a stub for the instance of Money, so that whenever the Account server calls a method on what it thinks of as the instance of Money, the method call is relayed over the wire</p>
<p>Attempting to do things this way has three significant drawbacks:</p>
<ul>
<li><em> <strong>You can&#8217;t access fields on the objects that have been passed as arguments.</strong></em></li>
</ul>
<p>Stubs work by implementing an interface. They implement the methods in the interface by simply relaying the method invocation across the network. That is, the stub methods take all their arguments and simply marshall them for transport across the wire. Accessing a public field is really just dereferencing a pointer&#8211;there is no method invocation and hence, there isn&#8217;t a method call to forward over the wire.</p>
<ul>
<li><em> <strong>It can result in unacceptable performance due to network latency.</strong></em></li>
</ul>
<p>Even in our simple case, the instance of Account is going to need to call getCents( ) on the instance of Money. This means that a simple call to makeDeposit( ) really involves at least two distinct networked method calls: makeDeposit( ) from the client and getCents( ) from the server.</p>
<ul>
<li><em> <strong>It makes the application much more vulnerable to partial failure.</strong></em></li>
</ul>
<p>Let&#8217;s say that the server is busy and doesn&#8217;t get around to handling the request for 30 seconds. If the client crashes in the interim, or if the network goes down, the server cannot process the request at all. Until all data has been requested and sent, the application is particularly vulnerable to partial failures.</p>
<p>This last point is an interesting one. Any time you have an application that requires a long-lasting and durable connection between client and server, you build in a point of failure. The longer the connection needs to last, or the higher the communication bandwidth the connection requires, the more likely the application is to occasionally break down.<br />
TIP: The original design of the Web, with its stateless connections, serves as a good example of a distributed application that can tolerate almost any transient network failure. These three reasons imply that what is really needed is a way to copy objects and send them over the wire. That is, instead of turning arguments into implicit servers, arguments need to be completely copied so that no further network calls are needed to complete the remote method invocation. Put another way, we want the result of makeWithdrawal( ) to involve creating a copy of the instance of Money on the server side. The runtime structure should resemble</p>
<p>The desire to avoid unnecessary network dependencies has two significant consequences:</p>
<ul>
<li><strong><em>Once an object is duplicated, the two objects are completely independent of each other.</em></strong></li>
</ul>
<p>Any attempt to keep the copy and the original in sync would involve propagating changes over the network, entirely defeating the reason for making the copy in the first place.</p>
<ul>
<li><strong><em>The copying mechanism must create deep copies.</em></strong></li>
</ul>
<p>If the instance of Money references another instance, then copies must be made of both instances. Otherwise, when a method is called on the second object, the call must be relayed across the wire. Moreover, all the copies must be made immediately&#8211;we can&#8217;t wait until the second object is accessed to make the copy because the original might change in the meantime.</p>
<p>These two consequences have a very important third consequence:</p>
<ul>
<li><strong><em>If an object is sent twice, in separate method calls, two copies of the object will be created.</em></strong></li>
</ul>
<p>In addition to arguments to method calls, this holds for objects that are referenced by the arguments. If you pass object A, which has a reference to object C, and in another call you pass object B, which also has a reference to C, you will end up with two distinct copies of C on the receiving side.</p>
<h2  class="related_post_title">Related Post</h2><ul class="related_post"><li>July 21, 2010 -- <a href="http://www.bestjavainterviewquestions.com/how-to-make-a-class-serializable/" title="How to Make a Class Serializable">How to Make a Class Serializable</a> (1)</li><li>July 21, 2010 -- <a href="http://www.bestjavainterviewquestions.com/using-serialization/" title="Using Serialization ">Using Serialization </a> (0)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.bestjavainterviewquestions.com/explain-briefly-about-serialization/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>GUI Examples Using Applets</title>
		<link>http://www.bestjavainterviewquestions.com/gui-examples-using-applets/</link>
		<comments>http://www.bestjavainterviewquestions.com/gui-examples-using-applets/#comments</comments>
		<pubDate>Mon, 12 Jul 2010 11:30:26 +0000</pubDate>
		<dc:creator>Ramakrishna</dc:creator>
				<category><![CDATA[Applet interview questions]]></category>
		<category><![CDATA[applets]]></category>

		<guid isPermaLink="false">http://www.bestjavainterviewquestions.com/?p=602</guid>
		<description><![CDATA[/* Now the applet will have a GUI These are elements to interact with the user. In this example they will not perform any actions. */ import java.awt.*; import java.applet.*; public class GuiExample extends Applet { // A Button to click Button okButton; // A textField to get text input TextField nameField; // A group [...]]]></description>
			<content:encoded><![CDATA[<p><em>/* Now the applet will have a GUI<br />
These are elements to interact with the user.<br />
In this example they will not perform any actions.<br />
*/</em></p>
<p><em><br />
</em></p>
<p><strong><em>import java.awt.*;<br />
import java.applet.*;</em></strong></p>
<p><strong><em>public class GuiExample extends Applet<br />
{</em></strong></p>
<p><strong><em><br />
// A Button to click<br />
Button okButton;</em></strong></p>
<p><strong><em>// A textField to get text input<br />
TextField nameField;</em></strong></p>
<p><strong><em>// A group of radio buttons<br />
// necessary to only allow one radio button to be selected at the same time</em></strong></p>
<p><strong><em>CheckboxGroup radioGroup;<br />
// The radio buttons to be selected<br />
Checkbox radio1;<br />
Checkbox radio2;</em></strong></p>
<p><strong><em>// An independant selection box<br />
Checkbox option;</em></strong></p>
<p><strong><em>public void init()<br />
{</em></strong></p>
<p><strong><em>// Tell the applet not to use a layout manager.<br />
setLayout(null);</em></strong></p>
<p><strong><em>// initialze the button and give it a text.<br />
okButton = new Button(&#8220;A button&#8221;);</em></strong></p>
<p><strong><em>// text and length of the field<br />
nameField = new TextField(&#8220;A TextField&#8221;,100);</em></strong></p>
<p><strong><em>// initialize the radio buttons group<br />
radioGroup = new CheckboxGroup();</em></strong></p>
<p><strong><em>// first radio button. Gives the label text, tells to which<br />
// group it belongs and sets the default state (unselected)<br />
radio1 = new Checkbox(&#8220;Radio1&#8243;, radioGroup,false);</em></strong></p>
<p><strong><em>// same but selected<br />
radio2 = new Checkbox(&#8220;Radio2&#8243;, radioGroup,true);</em></strong></p>
<p><strong><em>// Label and state of the checkbox<br />
option = new Checkbox(&#8220;Option&#8221;,false);</em></strong></p>
<p><strong><em>// now we will specify the positions of the GUI components.// this is done by specifying the x and y coordinate and<br />
//the width and height.</em></strong></p>
<p><strong><em>okButton.setBounds(20,20,100,30);<br />
nameField.setBounds(20,70,100,40);<br />
radio1.setBounds(20,120,100,30);<br />
radio2.setBounds(140,120,100,30);<br />
option.setBounds(20,170,100,30);</em></strong></p>
<p><strong><em>// now that all is set we can add these components to the applet<br />
add(okButton);<br />
add(nameField);<br />
add(radio1);<br />
add(radio2);<br />
add(option);<br />
}</em></strong></p>
<p><strong><em>}</em></strong></p>
<p><strong><em><br />
</em></strong></p>
<p><em>// Thats&#8217;s it, you now have given the user visual options.<br />
// However there are no actions related to these comonents.<br />
// that makes it easier to place components.</em></p>
<h2  class="related_post_title">Related Post</h2><ul class="related_post"><li>June 8, 2008 -- <a href="http://www.bestjavainterviewquestions.com/applet-interview-question/" title="Applet Interview Question">Applet Interview Question</a> (4)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.bestjavainterviewquestions.com/gui-examples-using-applets/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How To Delete the textbox using the Javascript</title>
		<link>http://www.bestjavainterviewquestions.com/how-to-delete-the-textbox-using-the-javascript/</link>
		<comments>http://www.bestjavainterviewquestions.com/how-to-delete-the-textbox-using-the-javascript/#comments</comments>
		<pubDate>Mon, 28 Sep 2009 09:46:36 +0000</pubDate>
		<dc:creator>Ramakrishna</dc:creator>
				<category><![CDATA[Jsp Tutorial]]></category>
		<category><![CDATA[dhtml]]></category>
		<category><![CDATA[dynamic deleting textbox using javascript]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[removing the rows of form elements which are unwanted for storing in the database]]></category>

		<guid isPermaLink="false">http://www.bestjavainterviewquestions.com/?p=597</guid>
		<description><![CDATA[This topic is to delete the textbox/textarea/selectbox which will be created dynamically in the application using javascript if you need to delete the rows just u need to select that check box and go for the delete button . You can have this code for using in your application this must be related to the [...]]]></description>
			<content:encoded><![CDATA[<p>This topic is to delete the textbox/textarea/selectbox which will be created dynamically in the application using javascript</p>
<p>if you need to delete the rows just u need to select that check box and go for the delete button .</p>
<p>You can have this code for using in your application this must be related to the button which you will use in your application</p>
<p>the Code is<strong><em> </em></strong></p>
<p><strong><em><br />
</em></strong></p>
<p><strong><em>function deleteRow() {<br />
try {<br />
var table = document.getElementById(&#8216;myTable&#8217;);<br />
//alert(&#8216;table&#8217;+table);<br />
var rowCount = table.rows.length;</em></strong></p>
<p><strong><em>for(var i=0; i&lt;rowCount; i++) {<br />
var row = table.rows[i];<br />
var chkbox = row.cells[0].childNodes[0];<br />
if(null != chkbox &amp;&amp; false == chkbox.checked) {<br />
table.deleteRow(i);<br />
rowCount&#8211;;<br />
i&#8211;;<br />
}</em></strong></p>
<p><strong><em>}<br />
}catch(e) {<br />
alert(e);<br />
}<br />
}</em></strong></p>
<p><strong><em>&lt;INPUT type=&#8221;button&#8221; value=&#8221;Delete Row&#8221; onclick=&#8221;deleteRow()&#8221; /&gt;</em></strong></p>
<h2  class="related_post_title">Random Posts</h2><ul class="related_post"><li>July 15, 2008 -- <a href="http://www.bestjavainterviewquestions.com/springs-interview-questions/" title="Springs Interview Questions">Springs Interview Questions</a> (0)</li><li>September 2, 2008 -- <a href="http://www.bestjavainterviewquestions.com/define-httpsession-class/" title="Define HttpSession Class">Define HttpSession Class</a> (0)</li><li>September 2, 2008 -- <a href="http://www.bestjavainterviewquestions.com/difference-between-sessionupdate-and-sessionlock/" title="Difference between session.update() and session.lock()">Difference between session.update() and session.lock()</a> (0)</li><li>May 22, 2008 -- <a href="http://www.bestjavainterviewquestions.com/basic-java-interview-question/" title="Basic Java Interview Question">Basic Java Interview Question</a> (1)</li><li>September 22, 2008 -- <a href="http://www.bestjavainterviewquestions.com/what-is-jre-explain/" title="What is JRE ? Explain">What is JRE ? Explain</a> (1)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.bestjavainterviewquestions.com/how-to-delete-the-textbox-using-the-javascript/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>J2EE Interview Questions</title>
		<link>http://www.bestjavainterviewquestions.com/j2ee-interview-questions-3/</link>
		<comments>http://www.bestjavainterviewquestions.com/j2ee-interview-questions-3/#comments</comments>
		<pubDate>Tue, 07 Apr 2009 16:53:16 +0000</pubDate>
		<dc:creator>Ramakrishna</dc:creator>
				<category><![CDATA[J2EE Interview Question]]></category>
		<category><![CDATA[j2ee]]></category>
		<category><![CDATA[jax]]></category>
		<category><![CDATA[jms]]></category>
		<category><![CDATA[jsf]]></category>
		<category><![CDATA[jsp]]></category>
		<category><![CDATA[jts]]></category>
		<category><![CDATA[servlet]]></category>
		<category><![CDATA[xml]]></category>

		<guid isPermaLink="false">http://www.bestjavainterviewquestions.com/?p=593</guid>
		<description><![CDATA[Q)  What is J2EE Rep) Java 2 Platform, Enterprise Edition. Q)   What is J2EE application Rep) Any deployable unit of J2EE functionality. This can be a single J2EE module or a group of modules packaged into an EAR file along with a J2EE application deployment descriptor. J2EE applications are typically engineered to be distributed across [...]]]></description>
			<content:encoded><![CDATA[<p><strong> Q)  What is J2EE </strong></p>
<p><strong>Rep) </strong> Java 2 Platform, Enterprise Edition.</p>
<p><strong>Q)   What is J2EE application</strong></p>
<p><strong>Rep) </strong>Any deployable unit of J2EE functionality. This can be<br />
a single J2EE module or a group of modules packaged<br />
into an EAR file along with a J2EE application<br />
deployment descriptor. J2EE applications are typically<br />
engineered to be distributed across multiple computing<br />
tiers.</p>
<p><strong>Q)  What is J2EE component</strong></p>
<p><strong>Rep) </strong>A self-contained functional software unit supported by<br />
a container and configurable at deployment time. The<br />
J2EE specification defines the following J2EE<br />
components: Application clients and applets are<br />
components that run on the client. Java servlet and<br />
JavaServer Pages (JSP) technology components are Web<br />
components that run on the server. Enterprise<br />
JavaBeans (EJB) components (enterprise beans) are<br />
business components that run on the server. J2EE<br />
components are written in the Java programming<br />
language and are compiled in the same way as any<br />
program in the language. The difference between J2EE<br />
components and &#8220;standard&#8221; Java classes is that J2EE<br />
components are assembled into a J2EE application,<br />
verified to be well formed and in compliance with the<br />
J2EE specification, and deployed to production, where<br />
they are run and managed by the J2EE server or client<br />
container.</p>
<p><strong>Q)  What is J2EE module</strong></p>
<p><strong>Rep) </strong>A software unit that consists of one or more J2EE<br />
components of the same container type and one<br />
deployment descriptor of that type. There are four<br />
types of modules: EJB, Web, application client, and<br />
resource adapter. Modules can be deployed as<br />
stand-alone units or can be assembled into a J2EE<br />
application.</p>
<p><strong>Q)  What is J2EE product</strong></p>
<p><strong>Rep) </strong>An implementation that conforms to the J2EE platform<br />
specification.</p>
<p><strong>Q)   What is J2EE product provider</strong></p>
<p><strong>Rep) </strong>A vendor that supplies a J2EE product.</p>
<p><strong>Q)  What is J2EE server</strong></p>
<p><strong>Rep)</strong> The runtime portion of a J2EE product. A J2EE server<br />
provides EJB or Web containers or both.</p>
<p><strong>Q)   What is J2ME</strong></p>
<p><strong>Rep) </strong>Abbreviate of Java 2 Platform, Micro Edition.<br />
<strong><br />
Q)  What is J2SE</strong></p>
<p><strong>Rep) </strong>Abbreviate of Java 2 Platform, Standard Edition.</p>
<p><strong>Q)  What is JAR</strong></p>
<p><strong>Rep) </strong>Java archive. A platform-independent file format that<br />
permits many files to be aggregated into one file.</p>
<p><strong>Q)   What is Java 2 Platform, Enterprise Edition(J2EE)</strong></p>
<p><strong>Rep) </strong>An environment for developing and deploying enterprise<br />
applications. The J2EE platform consists of a set of<br />
services, application programming interfaces (APIs),<br />
and protocols that provide the functionality for<br />
developing multitiered, Web-based applications.<br />
<strong><br />
Q)  What is Java 2 Platform, Micro Edition (J2ME)</strong></p>
<p><strong>Rep) </strong>A highly optimized Java runtime environment targeting<br />
a wide range of consumer products, including pagers,<br />
cellular phones, screen phones, digital set-top boxes,<br />
and car navigation systems.</p>
<p><strong>Q)  What is Java 2 Platform, Standard Edition (J2SE)</strong></p>
<p><strong>Rep) </strong>The core Java technology platform.</p>
<p><strong>Q)  What is Java API for XML Processing (JAXP)</strong></p>
<p><strong>Rep) </strong>An API for processing XML documents. JAXP leverages<br />
the parser standards SAX and DOM so that you can<br />
choose to parse your data as a stream of events or to<br />
build a tree-structured representation of it. JAXP<br />
supports the XSLT standard, giving you control over<br />
the presentation of the data and enabling you to<br />
convert the data to other XML documents or to other<br />
formats, such as HTML. JAXP provides namespace<br />
support, allowing you to work with schema that might<br />
otherwise have naming conflicts.</p>
<p><strong>Q)  What is Java API for XML Registries (JAXR)</strong></p>
<p><strong>Rep)</strong> An API for accessing various kinds of XML registries.</p>
<p><strong>Q)  What is Java API for XML-based RPC (JAX-RPC)</strong></p>
<p><strong>Rep)</strong> An API for building Web services and clients that use<br />
remote procedure calls and XML</p>
<p><strong>Q)   What is Java IDL</strong></p>
<p><strong>Rep) </strong>A technology that provides CORBA interoperability and<br />
connectivity capabilities for the J2EE platform. These<br />
capabilities enable J2EE applications to invoke<br />
operations on remote network services using the Object<br />
Management Group IDL and IIOP.</p>
<p><strong>Q)  What is Java Message Service (JMS)</strong></p>
<p><strong>Rep)</strong> An API for invoking operations on enterprise messaging<br />
systems.</p>
<p><strong>Q)  What is Java Naming and Directory Interface (JNDI)</strong></p>
<p><strong>Rep) </strong>An API that provides naming and directory<br />
functionality.</p>
<p><strong>Q)   What is Java Secure Socket Extension (JSSE)</strong></p>
<p><strong>Rep) </strong>A set of packages that enable secure Internet<br />
communications.</p>
<p><strong>Q)   What is Java Transaction API (JTA)</strong></p>
<p><strong>Rep)</strong> An API that allows applications and J2EE servers to<br />
access transactions.</p>
<p><strong>Q)  What is Java Transaction Service (JTS)</strong></p>
<p><strong>Rep)</strong> Specifies the implementation of a transaction manager<br />
that supports JTA and implements the Java mapping of<br />
the Object Management Group Object Transaction Service<br />
1.1 specification at the level below the API.</p>
<p><strong>Q)  What is JavaBeans component</strong></p>
<p><strong>Rep) </strong>A Java class that can be manipulated by tools and<br />
composed into applications. A JavaBeans component must<br />
adhere to certain property and event interface<br />
conventions.<br />
<strong><br />
Q)  What is JavaMail</strong></p>
<p><strong>Rep) </strong>An API for sending and receiving email.</p>
<p><strong>Q)   What is JavaServer Faces Technology </strong></p>
<p><strong>Rep) </strong>A framework for building server-side user interfaces<br />
for Web applications written in the Java programming<br />
language.</p>
<p><strong>Q)  What is JavaServer Faces conversion model</strong></p>
<p><strong>Rep)</strong> A mechanism for converting between string-based markup<br />
generated by JavaServer Faces UI components and<br />
server-side Java objects.</p>
<p><strong>Q)  What is JavaServer Faces event and listener model</strong></p>
<p><strong>Rep) </strong>A mechanism for determining how events emitted by<br />
JavaServer Faces UI components are handled. This model<br />
is based on the JavaBeans component event and listener<br />
model.</p>
<p><strong>Q)  What is JavaServer Faces _expression language</strong></p>
<p><strong>Rep) </strong>A simple _expression language used by a JavaServer<br />
Faces UI component tag attributes to bind the<br />
associated component to a bean property or to bind the<br />
associated component&#8217;s value to a method or an<br />
external data source, such as a bean property. Unlike<br />
JSP EL expressions, JavaServer Faces EL expressions<br />
are evaluated by the JavaServer Faces implementation<br />
rather than by the Web container.</p>
<p><strong>Q)  What is JavaServer Faces navigation model</strong></p>
<p><strong>Rep)</strong> A mechanism for defining the sequence in which pages<br />
in a JavaServer Faces application are displayed.</p>
<p><strong>Q)  What is JavaServer Faces UI component</strong></p>
<p><strong>Rep)</strong> A user interface control that outputs data to a client<br />
or allows a user to input data to a JavaServer Faces<br />
application.</p>
<p><strong>Q)  What is JavaServer Faces UI component class</strong></p>
<p><strong>Rep) </strong>A JavaServer Faces class that defines the behavior and<br />
properties of a JavaServer Faces UI component.</p>
<p><strong>Q)  What is JavaServer Faces validation model</strong></p>
<p><strong>Rep) </strong>A mechanism for validating the data a user inputs to a<br />
JavaServer Faces UI component.</p>
<p><strong>Q)  What is JavaServer Pages (JSP)</strong></p>
<p><strong>Rep)</strong> An extensible Web technology that uses static data,<br />
JSP elements, and server-side Java objects to generate<br />
dynamic content for a client. Typically the static<br />
data is HTML or XML elements, and in many cases the<br />
client is a Web browser.</p>
<p><strong>Q)  What is JavaServer Pages Standard Tag Library(JSTL)</strong></p>
<p><strong>Rep) </strong>A tag library that encapsulates core functionality<br />
common to many JSP applications. JSTL has support for<br />
common, structural tasks such as iteration and<br />
conditionals, tags for manipulating XML documents,<br />
internationalization and locale-specific formatting<br />
tags, SQL tags, and functions.<br />
<strong><br />
Q)  What is JAXR client</strong></p>
<p><strong>Rep)</strong> A client program that uses the JAXR API to access a<br />
business registry via a JAXR provider.</p>
<h2  class="related_post_title">Related Post</h2><ul class="related_post"><li>June 23, 2008 -- <a href="http://www.bestjavainterviewquestions.com/19/" title="Java Basic Questions">Java Basic Questions</a> (1)</li><li>May 22, 2008 -- <a href="http://www.bestjavainterviewquestions.com/core-java-interview-questions/" title="Core Java Interview Questions">Core Java Interview Questions</a> (1)</li><li>May 22, 2008 -- <a href="http://www.bestjavainterviewquestions.com/basic-java-interview-question/" title="Basic Java Interview Question">Basic Java Interview Question</a> (1)</li><li>April 7, 2009 -- <a href="http://www.bestjavainterviewquestions.com/overview-of-servlets/" title="OVERVIEW OF SERVLETS">OVERVIEW OF SERVLETS</a> (0)</li><li>March 25, 2009 -- <a href="http://www.bestjavainterviewquestions.com/creating-a-stateful-session-bean/" title="Creating a Stateful session Bean">Creating a Stateful session Bean</a> (1)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.bestjavainterviewquestions.com/j2ee-interview-questions-3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>OVERVIEW OF SERVLETS</title>
		<link>http://www.bestjavainterviewquestions.com/overview-of-servlets/</link>
		<comments>http://www.bestjavainterviewquestions.com/overview-of-servlets/#comments</comments>
		<pubDate>Tue, 07 Apr 2009 16:23:43 +0000</pubDate>
		<dc:creator>Ramakrishna</dc:creator>
				<category><![CDATA[Servlet Interview Questions]]></category>
		<category><![CDATA[cgi]]></category>
		<category><![CDATA[j2ee]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[server side programming]]></category>
		<category><![CDATA[servlet]]></category>
		<category><![CDATA[servlets]]></category>
		<category><![CDATA[servlets overview]]></category>

		<guid isPermaLink="false">http://www.bestjavainterviewquestions.com/?p=590</guid>
		<description><![CDATA[OVERVIEW OF SERVLETS Servlets provide a Java based solution used to address the problems currently associated with doing server side programming including inextensible scripting solution, platform specific API’s, and incomplete interfaces. Servlets are objects that confirm to a specific interface that can be plugged into a Java based server. Servlets are to the server side [...]]]></description>
			<content:encoded><![CDATA[<p><strong>OVERVIEW OF SERVLETS</strong></p>
<p>Servlets provide a Java based solution used to address the problems currently associated with doing server side programming including inextensible scripting solution, platform specific API’s, and incomplete interfaces.</p>
<p>Servlets are objects that confirm to a specific interface that can be plugged into a Java based server. Servlets are to the server side what applets are to the client side object byte code that can be dynamically loaded off the net.<br />
They differ from applets. In that they are face less objects (with out graphics or GUI component).They serve as platform independent, dynamically loadable, pluggable  helper byte code objects on the server side that can be used to dynamically extend server side functionality.</p>
<p>For example, an HTTP servlet can be used to generate dynamic HTML content. When you use servlets to do dynamic content you get the following advantages:</p>
<p>They are faster and cleaner than CGI scripts<br />
They use a  standard API (the servlet API)<br />
They provide all the advantages of Java(run on variety of    servers with out needing to be rewritten)</p>
<p><strong>The Attractiveness of Servlets</strong></p>
<p>There are many features of servlets that make them easy and attractive to use. These include:<br />
Easily configured using the GUI based admin Tool.<br />
Can be loaded and invoked from a local disc or remotely across the network.<br />
Can be linked together, or chained so that on a servlet can call another servlet, or several servlets in sequence.<br />
Can be called dynamically from within HTML pages, using server side include tags.<br />
Are secure- even when downloading across the net work, the servlet security model and servlet sandbox protect your system from unfriendly behavior.</p>
<p><strong>The Advantages of the servlet API</strong></p>
<p>One of the great advantages of the servlet API is protocol independence. It assumes nothing about:<br />
The protocol being used to transmit on the net<br />
How it is loaded<br />
The server environment it will be running in tjese qualities are important, because it allows the servlet API to be embedded in many different kindsof servers.<br />
There are other advantages to the servlet API  as well.<br />
These include:<br />
It’s extensible-you can inherit all your functionality from the classes made available to you;<br />
It’s simple, small, and easy to use.</p>
<p><strong>JAVA SERVLET FEATURES:</strong></p>
<p>The JavaServer provides several important servlet features.<br />
These includes:<br />
Loading and Invoking Servlets</p>
<p>Servlets can be loaded both locally and remotely.</p>
<p>Filters and Servlet Chaining</p>
<p>The JavaServer uses mime types to call servlets sequentially.<br />
<em><br />
Server-Side Includes</em></p>
<p>Server can be invoked from dynamic HTML docements using    server-side include tags.</p>
<p><strong>Replacing CGI Scripts</strong></p>
<p>Servlets are an effective substitute for CGI scripts, and provide a faster and cleaner way to genarate dynamic documents.</p>
<p><strong>INTERNAL SERVLETS:</strong></p>
<p>The Java TM Web Server TM servlet architecture is very flexible and the server takes advantage of thie by dividing  its work among several internal servlets. These are:</p>
<p><strong> File Servlet:</strong></p>
<p>The File Servlet provides the standard document serving capabilities of Java Web Server. This servlet includes a caching mechanism to speed up response times for frequently accessed files.</p>
<p><strong> Invoker Servlet:</strong></p>
<p>The purpose of this servlet is to invoke other servlets which are explicitly requested by name, that is</p>
<p><em>http://&lt;server-host-name&gt;/servlets/servlet name.</em></p>
<p><strong> Server Side Include Servlet:</strong></p>
<p>Servlets can be embedded within html documents using the servlet tag. When the server detects the servlet, and sends output of the servlet to the client at the point where the servlet tag was embedded.</p>
<p><strong> Admin Servlet:</strong></p>
<p>The Admin servlet facilitates administration of the Java web server through a GUI front end Administration Tool.</p>
<p><strong> CGI Servlet:</strong></p>
<p>This servlet acts as a gateway for CGI 1.1 interface. This servlet allows any program that utilizes the CGI 1.1     standard to under operate Java Web Server.</p>
<p><strong> Image Map Servlet:</strong></p>
<p>This servlet implements server-side image maps utilizing an extension of standard NCSA map files.</p>
<h2  class="related_post_title">Related Post</h2><ul class="related_post"><li>June 23, 2008 -- <a href="http://www.bestjavainterviewquestions.com/19/" title="Java Basic Questions">Java Basic Questions</a> (1)</li><li>May 22, 2008 -- <a href="http://www.bestjavainterviewquestions.com/basic-java-interview-question/" title="Basic Java Interview Question">Basic Java Interview Question</a> (1)</li><li>April 7, 2009 -- <a href="http://www.bestjavainterviewquestions.com/j2ee-interview-questions-3/" title="J2EE Interview Questions">J2EE Interview Questions</a> (0)</li><li>March 29, 2009 -- <a href="http://www.bestjavainterviewquestions.com/j2ee-interview-questions/" title="J2EE Interview Questions">J2EE Interview Questions</a> (0)</li><li>March 25, 2009 -- <a href="http://www.bestjavainterviewquestions.com/creating-a-stateful-session-bean/" title="Creating a Stateful session Bean">Creating a Stateful session Bean</a> (1)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.bestjavainterviewquestions.com/overview-of-servlets/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

