tag:blogger.com,1999:blog-58769576155545540112024-03-27T12:08:03.535+05:30Dev TalesA step by step accounting of what i learnt during my technical training to being a developer. Also trying to provide an arena where people can ask and learnAjo (Dev)http://www.blogger.com/profile/11302481405062225663noreply@blogger.comBlogger18125tag:blogger.com,1999:blog-5876957615554554011.post-43539157028209630382012-03-15T15:57:00.000+05:302012-03-15T15:57:11.614+05:30Cursors in SQL<div dir="ltr" style="text-align: left;" trbidi="on"><br />
<span style="font-family: Georgia, 'Times New Roman', serif;">A cursor is a temporary work area created in the system memory when a SQL statement is executed. A cursor contains information on a select statement and the rows of data accessed by it. This temporary work area is used to store the data retrieved from the database, and manipulate this data. A cursor can hold more than one row, but can process only one row at a time. The set of rows the cursor holds is called the active set.</span><br />
<span style="font-family: Georgia, 'Times New Roman', serif;">In SQL procedures, a cursor make it possible to define a result set (a set of data rows) and perform complex logic on a row by row basis. By using the same mechanics, an SQL procedure can also define a result set and return it directly to the caller of the SQL procedure or to a client application.</span><br />
<span style="font-family: Georgia, 'Times New Roman', serif;"><br />
</span><br />
<span style="font-family: Georgia, 'Times New Roman', serif;">A cursor can be viewed as a pointer to one row in a set of rows. The cursor can only reference one row at a time, but can move to other rows of the result set as needed.</span><br />
<span style="font-family: Georgia, 'Times New Roman', serif;"><br />
</span><br />
<span style="font-family: Georgia, 'Times New Roman', serif;">To use cursors in SQL procedures, you need to do the following:</span><br />
<span style="font-family: Georgia, 'Times New Roman', serif;">Declare a cursor that defines a result set.</span><br />
<span style="font-family: Georgia, 'Times New Roman', serif;">Open the cursor to establish the result set.</span><br />
<span style="font-family: Georgia, 'Times New Roman', serif;">Fetch the data into local variables as needed from the cursor, one row at a time.</span><br />
<span style="font-family: Georgia, 'Times New Roman', serif;">Close the cursor when done</span><br />
<span style="font-family: Georgia, 'Times New Roman', serif;">To work with cursors you must use the following SQL statements:</span><br />
<i><span style="font-family: 'Courier New', Courier, monospace;">DECLARE CURSOR</span></i><br />
<i><span style="font-family: 'Courier New', Courier, monospace;">OPEN</span></i><br />
<i><span style="font-family: 'Courier New', Courier, monospace;">FETCH</span></i><br />
<i><span style="font-family: 'Courier New', Courier, monospace;">CLOSE</span></i><br />
<span style="font-family: Georgia, 'Times New Roman', serif;"><br />
</span><br />
<span style="font-family: Georgia, 'Times New Roman', serif;">There are two types of cursors in PL/SQL:</span><br />
<span style="font-family: Georgia, 'Times New Roman', serif;"><br />
</span><br />
<b><span style="font-family: Georgia, 'Times New Roman', serif;">Implicit cursors:</span></b><br />
<span style="font-family: Georgia, 'Times New Roman', serif;"><br />
</span><br />
<span style="font-family: Georgia, 'Times New Roman', serif;">These are created by default when DML statements like, </span><span style="font-family: 'Courier New', Courier, monospace;">INSERT, UPDATE,</span><span style="font-family: Georgia, 'Times New Roman', serif;"> and</span><span style="font-family: 'Courier New', Courier, monospace;"> DELETE </span><span style="font-family: Georgia, 'Times New Roman', serif;">statements are executed. They are also created when a </span><span style="font-family: 'Courier New', Courier, monospace;">SELECT</span><span style="font-family: Georgia, 'Times New Roman', serif;"> statement that returns just one row is executed. </span><br />
<span style="font-family: Georgia, 'Times New Roman', serif;"><br />
</span><br />
<b><span style="font-family: Georgia, 'Times New Roman', serif;">Explicit cursors:</span></b><br />
<span style="font-family: Georgia, 'Times New Roman', serif;"><br />
</span><br />
<span style="font-family: Georgia, 'Times New Roman', serif;">They must be created when you are executing a</span><span style="font-family: 'Courier New', Courier, monospace;"> SELECT</span><span style="font-family: Georgia, 'Times New Roman', serif;"> statement that returns more than one row. Even though the cursor stores multiple records, only one record can be processed at a time, which is called as current row. When you fetch a row the current row position moves to next row.</span><br />
<span style="font-family: Georgia, 'Times New Roman', serif;"><br />
</span><br />
<span style="font-family: Georgia, 'Times New Roman', serif;">Both implicit and explicit cursors have the same functionality, but they differ in the way they are accessed. </span><br />
<span style="font-family: Georgia, 'Times New Roman', serif;">When you execute DML statements like</span><span style="font-family: 'Courier New', Courier, monospace;"> DELETE, INSERT, UPDATE</span><span style="font-family: Georgia, 'Times New Roman', serif;"> and </span><span style="font-family: 'Courier New', Courier, monospace;">SELECT </span><span style="font-family: Georgia, 'Times New Roman', serif;">statements, implicit statements are created to process these statements.</span><br />
<span style="font-family: Georgia, 'Times New Roman', serif;"><br />
</span><br />
<span style="font-family: Georgia, 'Times New Roman', serif;">Oracle provides few attributes called as implicit cursor attributes to check the status of DML operations. The cursor attributes available are</span><span style="font-family: 'Courier New', Courier, monospace;"> %FOUND, %NOTFOUND, %ROWCOUNT, </span><span style="font-family: Georgia, 'Times New Roman', serif;">and</span><span style="font-family: 'Courier New', Courier, monospace;"> %ISOPEN. </span><br />
<span style="font-family: Georgia, 'Times New Roman', serif;"><br />
</span><br />
<span style="font-family: Georgia, 'Times New Roman', serif;">For example, When you execute </span><span style="font-family: 'Courier New', Courier, monospace;">INSERT, UPDATE</span><span style="font-family: Georgia, 'Times New Roman', serif;">, or </span><span style="font-family: 'Courier New', Courier, monospace;">DELETE</span><span style="font-family: Georgia, 'Times New Roman', serif;"> statements the cursor attributes tell us whether any rows are affected and how many have been affected. </span><br />
<span style="font-family: Georgia, 'Times New Roman', serif;">When a </span><span style="font-family: 'Courier New', Courier, monospace;">SELECT... INTO</span><span style="font-family: Georgia, 'Times New Roman', serif;"> statement is executed in a PL/SQL Block, implicit cursor attributes can be used to find out whether any row has been returned by the</span><span style="font-family: 'Courier New', Courier, monospace;"> SELECT </span><span style="font-family: Georgia, 'Times New Roman', serif;">statement. PL/SQL returns an error when no data is selected.</span><br />
<span style="font-family: Georgia, 'Times New Roman', serif;"><br />
</span><br />
<span style="font-family: Georgia, 'Times New Roman', serif;">The status of the cursor for each of these attributes are defined below :- </span><br />
<span style="font-family: Georgia, 'Times New Roman', serif;"><br />
</span><br />
<br />
<ul style="text-align: left;"><li><b><i><span style="font-family: Georgia, 'Times New Roman', serif;"> %FOUND :</span></i></b></li>
</ul><br />
<span style="font-family: Georgia, 'Times New Roman', serif;"><br />
</span><br />
<span style="font-family: Georgia, 'Times New Roman', serif;">The return value is </span><span style="font-family: 'Courier New', Courier, monospace;">TRUE</span><span style="font-family: Georgia, 'Times New Roman', serif;">, if the DML statements like </span><span style="font-family: 'Courier New', Courier, monospace;">INSERT, DELETE</span><span style="font-family: Georgia, 'Times New Roman', serif;"> and</span><span style="font-family: 'Courier New', Courier, monospace;"> UPDATE </span><span style="font-family: Georgia, 'Times New Roman', serif;">affect at least one row and if </span><span style="font-family: 'Courier New', Courier, monospace;">SELECT ….INTO</span><span style="font-family: Georgia, 'Times New Roman', serif;"> statement return at least one row.</span><br />
<span style="font-family: Georgia, 'Times New Roman', serif;"><br />
</span><br />
<span style="font-family: Georgia, 'Times New Roman', serif;">The return value is</span><span style="font-family: 'Courier New', Courier, monospace;"> FALSE</span><span style="font-family: Georgia, 'Times New Roman', serif;">, if DML statements like</span><span style="font-family: 'Courier New', Courier, monospace;"> INSERT, DELETE</span><span style="font-family: Georgia, 'Times New Roman', serif;"> and </span><span style="font-family: 'Courier New', Courier, monospace;">UPDATE</span><span style="font-family: Georgia, 'Times New Roman', serif;"> do not affect row and if </span><span style="font-family: 'Courier New', Courier, monospace;">SELECT….INTO</span><span style="font-family: Georgia, 'Times New Roman', serif;"> statement do not return a row.</span> <span style="font-family: Georgia, 'Times New Roman', serif;"><br />
</span><br />
<span style="font-family: Georgia, 'Times New Roman', serif;"><br />
</span><br />
<b><i><span style="font-family: Georgia, 'Times New Roman', serif;">example : SQL%FOUND </span></i></b><br />
<span style="font-family: Georgia, 'Times New Roman', serif;"><br />
</span><br />
<br />
<ul style="text-align: left;"><li><b><i><span style="font-family: Georgia, 'Times New Roman', serif;">%NOTFOUND :</span></i></b></li>
</ul><br />
<span style="font-family: Georgia, 'Times New Roman', serif;"><br />
</span><br />
<span style="font-family: Georgia, 'Times New Roman', serif;">The return value is </span><span style="font-family: 'Courier New', Courier, monospace;">FALSE</span><span style="font-family: Georgia, 'Times New Roman', serif;">, if</span><span style="font-family: 'Courier New', Courier, monospace;"> DML</span><span style="font-family: Georgia, 'Times New Roman', serif;"> statements like </span><span style="font-family: 'Courier New', Courier, monospace;">INSERT</span><span style="font-family: Georgia, 'Times New Roman', serif;">, </span><span style="font-family: 'Courier New', Courier, monospace;">DELETE</span><span style="font-family: Georgia, 'Times New Roman', serif;"> and </span><span style="font-family: 'Courier New', Courier, monospace;">UPDATE </span><span style="font-family: Georgia, 'Times New Roman', serif;">at least one row and if </span><span style="font-family: 'Courier New', Courier, monospace;">SELECT ….INTO</span><span style="font-family: Georgia, 'Times New Roman', serif;"> statement return at least one row.</span><br />
<span style="font-family: Georgia, 'Times New Roman', serif;"><br />
</span><br />
<span style="font-family: Georgia, 'Times New Roman', serif;">The return value is</span><span style="font-family: 'Courier New', Courier, monospace;"> TRUE</span><span style="font-family: Georgia, 'Times New Roman', serif;">, if a DML statement like</span><span style="font-family: 'Courier New', Courier, monospace;"> INSERT, DELETE</span><span style="font-family: Georgia, 'Times New Roman', serif;"> and</span><span style="font-family: 'Courier New', Courier, monospace;"> UPDATE</span><span style="font-family: Georgia, 'Times New Roman', serif;"> do not affect even one row and if </span><span style="font-family: 'Courier New', Courier, monospace;">SELECT ….INTO</span><span style="font-family: Georgia, 'Times New Roman', serif;"> statement does not return a row.</span> <span style="font-family: Georgia, 'Times New Roman', serif;"><br />
</span><br />
<span style="font-family: Georgia, 'Times New Roman', serif;"><br />
</span><br />
<b><i><span style="font-family: Georgia, 'Times New Roman', serif;">example: SQL%NOTFOUND </span></i></b><br />
<span style="font-family: Georgia, 'Times New Roman', serif;"><br />
</span><br />
<br />
<ul style="text-align: left;"><li><b><i><span style="font-family: Georgia, 'Times New Roman', serif;">%ROWCOUNT :</span></i></b></li>
</ul><br />
<span style="font-family: Georgia, 'Times New Roman', serif;"><br />
</span><br />
<span style="font-family: Georgia, 'Times New Roman', serif;">Return the number of rows affected by the DML operations </span><span style="font-family: 'Courier New', Courier, monospace;">INSERT, DELETE, UPDATE, SELECT</span><br />
<span style="font-family: Georgia, 'Times New Roman', serif;"><br />
</span><br />
<b><i><span style="font-family: Georgia, 'Times New Roman', serif;">example : SQL%ROWCOUNT </span></i></b><br />
<span style="font-family: Georgia, 'Times New Roman', serif;"><br />
</span><br />
<span style="font-family: Georgia, 'Times New Roman', serif;"><br />
</span><br />
<span style="font-family: Georgia, 'Times New Roman', serif;">For Example: Consider the PL/SQL Block that uses implicit cursor attributes as shown below:</span><br />
<span style="font-family: Georgia, 'Times New Roman', serif;"><br />
</span><br />
<span style="font-family: 'Courier New', Courier, monospace;">DECLARE var_rows number(5);</span><br />
<span style="font-family: 'Courier New', Courier, monospace;">BEGIN</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> UPDATE employee </span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> SET salary = salary + 1000;</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> IF SQL%NOTFOUND THEN</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> dbms_output.put_line('None of the salaries where updated');</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> ELSIF SQL%FOUND THEN</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> var_rows := SQL%ROWCOUNT;</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> dbms_output.put_line('Salaries for ' || var_rows || 'employees are updated');</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> END IF; </span><br />
<span style="font-family: 'Courier New', Courier, monospace;">END; </span><br />
<span style="font-family: Georgia, 'Times New Roman', serif;"><br />
</span><br />
<span style="font-family: Georgia, 'Times New Roman', serif;">In the above PL/SQL Block, the salaries of all the employees in the ‘employee’ table are updated. If none of the employee’s salary are updated we get a message 'None of the salaries where updated'. Else we get a message like for example, 'Salaries for 1000 employees are updated' if there are 1000 rows in ‘employee’ table. </span><br />
<span style="font-family: Georgia, 'Times New Roman', serif;"><br />
</span><br />
<br />
</div>Ajo (Dev)http://www.blogger.com/profile/11302481405062225663noreply@blogger.com26tag:blogger.com,1999:blog-5876957615554554011.post-76571570343737434062012-02-17T12:38:00.002+05:302012-02-17T13:26:21.349+05:30Inheritance in Javascript<div dir="ltr" style="text-align: left;" trbidi="on"><span style="font-family: Georgia, 'Times New Roman', serif; font-size: large;"><br />
</span><br />
<span style="font-family: Georgia, 'Times New Roman', serif; font-size: large;">Javascript has grown a lot from what i remember of working on it.. I remember the plain javascript i used to work on which now has advanced a lot to include inheritance and other OOP concepts. To understand more i tried an example to understand its reaches...</span><br />
<span style="font-family: Georgia, 'Times New Roman', serif; font-size: large;"></span><br />
<span style="font-family: Georgia, 'Times New Roman', serif; font-size: large;">It's extremely hard to understand for those with classic OOP background but JavaScript has no Classes, just objects, where functions are first class objects but still objects!</span><br />
<span style="font-family: Georgia, 'Times New Roman', serif; font-size: large;">Assumed this, we can try in any case to think about a JavaScript Class as a "function which aim is to create instances of function itself".</span><br />
<span style="font-family: Georgia, 'Times New Roman', serif; font-size: large;">try with Mootools or some other library</span><br />
<span style="font-family: Georgia, 'Times New Roman', serif; font-size: large;">new Class({}) instanceof Class;</span><br />
<span style="font-family: Georgia, 'Times New Roman', serif; font-size: large;"> FALSE, since Class returns a function</span><br />
<span style="font-family: Georgia, 'Times New Roman', serif; font-size: large;"> and not the created instanceof Class</span><br />
<span style="font-family: Georgia, 'Times New Roman', serif; font-size: large;"> Nothing more and nothing less. The fact we would like to use that function to create and initialize instances is just how every Functions work, or if we prefer, a developer convention and a quick way to chain a prototype into an object.</span><br />
<span style="font-family: Georgia, 'Times New Roman', serif; font-size: large;"> Since a Class is a Function, and whatever "new Class()" will always be an "instanceof Function", Class.prototype should be exactly the Function.prototype one, so that nobody can ever say again: "Look, I have created a Class".. All that has been made is a function.. But its still elastic</span><br />
<br />
<br />
<br />
<br />
<span style="font-family: 'Courier New', Courier, monospace;"><!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"></span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><html></span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><head></span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"></span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><title>Page Start</title></span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><script type="text/javascript"></span><br />
<span style="font-family: 'Courier New', Courier, monospace;">/*Class declared: Person*/</span><br />
<span style="font-family: 'Courier New', Courier, monospace;">Person = function(id, name, age){</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> this.id = id;</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> this.name = name;</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> this.age = age;</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> alert('Accepting Person Object');</span><br />
<span style="font-family: 'Courier New', Courier, monospace;">}</span><br />
<span style="font-family: 'Courier New', Courier, monospace;">/*properties of person class*/</span><br />
<span style="font-family: 'Courier New', Courier, monospace;">Person.prototype = {</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> wakeUp: function() {</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> alert('I am awake');</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> },</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> getAge: function() {</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> return this.age;</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> },</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> </span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> toStringHere : function() {</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> return "id : "+this.id+", name : "+this.name+", age : "+this.age;</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> }</span><br />
<span style="font-family: 'Courier New', Courier, monospace;">}</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><br />
</span><br />
<span style="font-family: 'Courier New', Courier, monospace;">Person.prototype.fly = function(){</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>alert("finally i can fly");</span><br />
<span style="font-family: 'Courier New', Courier, monospace;">}</span><br />
<span style="font-family: 'Courier New', Courier, monospace;">/*An instance to help inherit the properties*/</span><br />
<span style="font-family: 'Courier New', Courier, monospace;">Inheritance_Manager = {};</span><br />
<span style="font-family: 'Courier New', Courier, monospace;">/*DOM extension mechanism || Simple extension through object*/</span><br />
<span style="font-family: 'Courier New', Courier, monospace;">Inheritance_Manager.extend = function(subClass, baseClass) {</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> function inheritance() { }</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> inheritance.prototype = baseClass.prototype;</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> subClass.prototype = new inheritance();</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> subClass.prototype.constructor = subClass;</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> subClass.baseConstructor = baseClass;</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> subClass.superClass = baseClass.prototype;</span><br />
<span style="font-family: 'Courier New', Courier, monospace;">}</span><br />
<span style="font-family: 'Courier New', Courier, monospace;">/*Class Declared : Manager */</span><br />
<span style="font-family: 'Courier New', Courier, monospace;">Manager = function(id, name, age, salary) {</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>alert('Registering Manager');</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> Manager.baseConstructor.call(this, id, name, age);</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> this.salary = salary;</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> alert("Registration Complete");</span><br />
<span style="font-family: 'Courier New', Courier, monospace;">}</span><br />
<span style="font-family: 'Courier New', Courier, monospace;">/*Manager Inherits Person and its handling of constructor*/</span><br />
<span style="font-family: 'Courier New', Courier, monospace;">Inheritance_Manager.extend(Manager, Person);</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><br />
</span><br />
<span style="font-family: 'Courier New', Courier, monospace;">Manager.prototype.lead = function(){</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> alert('I am a good leader');</span><br />
<span style="font-family: 'Courier New', Courier, monospace;">}</span><br />
<span style="font-family: 'Courier New', Courier, monospace;">/*use objects to check how the various functions are accessed*/</span><br />
<span style="font-family: 'Courier New', Courier, monospace;">var p = new Person(1, 'RAS', 22);</span><br />
<span style="font-family: 'Courier New', Courier, monospace;">document.write(p.toStringHere()+"<br>");</span><br />
<span style="font-family: 'Courier New', Courier, monospace;">var pm = new Manager(1, 'Ajo Koshy', 22, '27000');</span><br />
<span style="font-family: 'Courier New', Courier, monospace;">document.write(pm.toStringHere()+"<br>");</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"></script></span><br />
<span style="font-family: 'Courier New', Courier, monospace;"></head></span><br />
<span style="font-family: 'Courier New', Courier, monospace;"></html></span></div>Ajo (Dev)http://www.blogger.com/profile/11302481405062225663noreply@blogger.com0tag:blogger.com,1999:blog-5876957615554554011.post-38190836525406696752012-02-07T15:36:00.001+05:302012-02-07T15:43:32.665+05:30Escape Sequencer<div dir="ltr" style="text-align: left;" trbidi="on"><br />
<span style="font-family: Georgia, 'Times New Roman', serif;">To access json strings which have been returned with a double quote often poses a problem on the server side as the characters are not in sync with the values and cannot be processed... So the following problem will help you process the same problem by escaping the character in the json data daved in a file.</span><br />
<span style="font-family: Georgia, 'Times New Roman', serif;"><br />
</span><br />
<span style="font-family: Georgia, 'Times New Roman', serif;">//buzz.txt </span><br />
<span style="font-family: Georgia, 'Times New Roman', serif;"><br />
</span><br />
<span style="font-family: Georgia, 'Times New Roman', serif;"></span><br />
<span style="font-family: Georgia, 'Times New Roman', serif;">{"groupOp":"AND","rules":[{"field":"tlc_product_number","op":"eq","data":"2563"},{"field":"tlc_product_desc","op":"eq","data":"1" SPECIAL LABEL (CATERING)"},{"field":"fobsdate","op":"eq","data":"02/01/2012"}]</span><br />
<div><span style="font-family: Georgia, 'Times New Roman', serif;"><br />
</span></div><br />
<span style="font-family: Georgia, 'Times New Roman', serif;"><br />
</span><br />
<span style="font-family: Georgia, 'Times New Roman', serif;">// EscapeSequencer.java</span><br />
<span style="font-family: Georgia, 'Times New Roman', serif;"><br />
</span><br />
<span style="font-family: Georgia, 'Times New Roman', serif;"><br />
</span><br />
<span style="font-family: 'Courier New', Courier, monospace;">package com.string.regex;</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><br />
</span><br />
<span style="font-family: 'Courier New', Courier, monospace;">import java.io.BufferedReader;</span><br />
<span style="font-family: 'Courier New', Courier, monospace;">import java.io.FileReader;</span><br />
<span style="font-family: 'Courier New', Courier, monospace;">import java.io.IOException;</span><br />
<span style="font-family: 'Courier New', Courier, monospace;">import java.util.ArrayList;</span><br />
<span style="font-family: 'Courier New', Courier, monospace;">import java.util.List;</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><br />
</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><br />
</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><br />
</span><br />
<span style="font-family: 'Courier New', Courier, monospace;">public class EscapeSequencer {</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>public static void main(String args[]){</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>List<Integer> ind1= new ArrayList<Integer>();</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>List<Integer> ind2= new ArrayList<Integer>();</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>String val= "";</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>try {</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>val= readFileAsString("C:/buzz");</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println(val);</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>} catch (IOException e) {</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>// TODO Auto-generated catch block</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>e.printStackTrace();</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>int pro=val.indexOf("data\":\"")+6;</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>String word1 = "data\":\"";</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>String word2 = "\"}";</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>String value="";</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>String filterVal=val.substring(pro,val.indexOf('"', pro));</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>for(int i=0;i<val.length();i++)</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>{</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>if(i+word1.length()<=val.length()){</span><br />
<span class="Apple-tab-span" style="white-space: pre;"><span style="font-family: 'Courier New', Courier, monospace;"> </span></span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>String compString = val.substring(i, i+word1.length());</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>if(compString.equalsIgnoreCase(word1))</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>{</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><br />
</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>i=i+word1.length();</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>ind1.add(i);</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><br />
</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span><br />
<span class="Apple-tab-span" style="white-space: pre;"><span style="font-family: 'Courier New', Courier, monospace;"> </span></span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><br />
</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>//System.out.println(ind1.toString());</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><br />
</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>for(int i=0;i<val.length();i++)</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>{</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>if(i+word2.length()<=val.length()){</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>String compString= val.substring(i,i+word2.length());</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>if(compString.equalsIgnoreCase(word2))</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>{</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>i=i+word2.length();</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>ind2.add(i);</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>//System.out.println(ind2.toString());</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><br />
</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println(val.indexOf("\"}"));</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>for(int j=0;j<ind1.size();j++){</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>try{</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>filterVal=val.substring(ind1.get(j)+1,ind2.get(j)-2);</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>//System.out.println(val.indexOf("\"}"));</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>catch(StringIndexOutOfBoundsException sie)</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>{</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>sie.printStackTrace();</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>value=filterVal;</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>//System.out.println(value+"...");</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>filterVal=filterVal.replace("\\", "\\\\")</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span> .replace("\"", "\\\"")</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span> .replace("\r", "\\r")</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span> .replace("\n", "\\n");</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>val=val.replace(value, filterVal);</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println(val);</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><br />
</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>private static String readFileAsString(String filePath)</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> throws java.io.IOException{</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> StringBuffer fileData = new StringBuffer(1000);</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> BufferedReader reader = new BufferedReader(</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> new FileReader(filePath));</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> char[] buf = new char[1024];</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> int numRead=0;</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> while((numRead=reader.read(buf)) != -1){</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> String readData = String.valueOf(buf, 0, numRead);</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> fileData.append(readData);</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> buf = new char[1024];</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> }</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> reader.close();</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> return fileData.toString();</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> }</span><br />
<span style="font-family: 'Courier New', Courier, monospace;">}</span><br />
<div><br />
</div></div>Ajo (Dev)http://www.blogger.com/profile/11302481405062225663noreply@blogger.com19tag:blogger.com,1999:blog-5876957615554554011.post-15390693236004833322012-01-12T13:58:00.000+05:302012-01-12T13:58:01.212+05:30Appian<div dir="ltr" style="text-align: left;" trbidi="on"><span style="font-family: Georgia, 'Times New Roman', serif;">I have been working on the appian api and trust me its very different from what i expected... the no of hassles faced are so much that for just shifting from 1 version to other i had to do a POC.. It was worth it.. :)</span><br />
<span style="font-family: Georgia, 'Times New Roman', serif;"><br />
</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><br />
</span><br />
<br />
<span style="font-family: 'Courier New', Courier, monospace;">package com.trial;</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><br />
</span><br />
<span style="font-family: 'Courier New', Courier, monospace;">import com.ibm.icu.text.DateFormatSymbols;</span><br />
<span style="font-family: 'Courier New', Courier, monospace;">import com.ibm.icu.text.SimpleDateFormat;</span><br />
<span style="font-family: 'Courier New', Courier, monospace;">import com.ibm.icu.util.Calendar;</span><br />
<span style="font-family: 'Courier New', Courier, monospace;">import java.util.ArrayList;</span><br />
<span style="font-family: 'Courier New', Courier, monospace;">import java.util.List;</span><br />
<span style="font-family: 'Courier New', Courier, monospace;">import java.util.Locale;</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><br />
</span><br />
<span style="font-family: 'Courier New', Courier, monospace;">/**</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> *This program helps to find out the difference in calendar implementations of Appian 5.0 and Appian 6.0</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> *@author ajo.koshy</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> *@version 1.0</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> *The only requirements are 4 jar files :</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> *a) appian-asi</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> *b) appian-util</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> *c) appian-globalization</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> *d) icu4j-4.0.1</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> * */</span><br />
<span style="font-family: 'Courier New', Courier, monospace;">public class TrialExec {</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>/**</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span> * @throws None</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span> * @author ajo.koshy</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span> * */</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>public static void main(String args[]){</span><br />
<span class="Apple-tab-span" style="white-space: pre;"><span style="font-family: 'Courier New', Courier, monospace;"> </span></span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>String ans="";</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>Calendar cal = Calendar.getInstance(Locale.UK);// Use Locale.US for different answer</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>SimpleDateFormat dtf = new SimpleDateFormat("MM/dd/yy", Locale.UK);// Use Locale.US for different answer</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>DateFormatSymbols symbols = dtf.getDateFormatSymbols();</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>String[] shortWeekdays = symbols.getShortWeekdays();</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>List<String> weekdayInitials = new ArrayList<String>();</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>int firstDayOfWeek = cal.getFirstDayOfWeek();</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>cal.set(2012, 0, 1);</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>int blankSpaces = cal.get(7) - firstDayOfWeek;</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>int newBlankSpaces = getLeadingBlankSpaces(cal);</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><br />
</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span> for (int i = firstDayOfWeek; i < shortWeekdays.length; i++) {</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span> /*if (shortWeekdays[i].length() > 0) {</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span> </span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span> }*/</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span> weekdayInitials.add(Character.toString(shortWeekdays[i].charAt(0)));</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span> }</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span> </span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span> for (int i = 0; i < firstDayOfWeek; i++) {</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span> if (shortWeekdays[i].length() > 0) {</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span> weekdayInitials.add(Character.toString(shortWeekdays[i].charAt(0)));</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span> }</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span> }</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><br />
</span><br />
<span class="Apple-tab-span" style="white-space: pre;"><span style="font-family: 'Courier New', Courier, monospace;"> </span></span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>for(int i=0;i<weekdayInitials.size();i++)</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>{</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>ans=ans+" "+weekdayInitials.get(i);</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span><br />
<span class="Apple-tab-span" style="white-space: pre;"><span style="font-family: 'Courier New', Courier, monospace;"> </span></span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println(ans);</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println(cal.getTime());</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println("blankspaces are = "+blankSpaces);</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println("now blankspaces are = "+newBlankSpaces);</span><br />
<span class="Apple-tab-span" style="white-space: pre;"><span style="font-family: 'Courier New', Courier, monospace;"> </span></span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span><br />
<span class="Apple-tab-span" style="white-space: pre;"><span style="font-family: 'Courier New', Courier, monospace;"> </span></span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>private static int getLeadingBlankSpaces(Calendar firstDayOfTargetMonthAndYear) {</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>/**</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span> * @author ajo.koshy</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span> * @param Calendar Object</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span> * */</span><br />
<span class="Apple-tab-span" style="white-space: pre;"><span style="font-family: 'Courier New', Courier, monospace;"> </span></span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>int firstDayOfWeek = firstDayOfTargetMonthAndYear.getFirstDayOfWeek();</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>int daysPerWeek = firstDayOfTargetMonthAndYear.getMaximum(7);</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>int dayOfWeek = firstDayOfTargetMonthAndYear.get(7);</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>return (daysPerWeek + (dayOfWeek - firstDayOfWeek)) % daysPerWeek;</span><br />
<span class="Apple-tab-span" style="white-space: pre;"><span style="font-family: 'Courier New', Courier, monospace;"> </span></span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>/**</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span> * @return nothing.. but prints values that differ with the locale</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span> * */</span><br />
<span class="Apple-tab-span" style="white-space: pre;"><span style="font-family: 'Courier New', Courier, monospace;"> </span></span><br />
<span style="font-family: 'Courier New', Courier, monospace;">}</span><br />
<div><br />
</div></div>Ajo (Dev)http://www.blogger.com/profile/11302481405062225663noreply@blogger.com14tag:blogger.com,1999:blog-5876957615554554011.post-11074716814505823102011-12-14T11:09:00.000+05:302012-06-09T15:25:00.381+05:30Custom login interceptor<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
The login in a struts page needs a proper interceptor to handle all possible cases of login... Have tried to make one that works :)<br />
<br />
<br />
<span style="font-family: 'Courier New', Courier, monospace;">package com.interceptor;</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><br /></span><br />
<span style="font-family: 'Courier New', Courier, monospace;">import java.util.List;</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><br /></span><br />
<span style="font-family: 'Courier New', Courier, monospace;">import javax.servlet.http.Cookie;</span><br />
<span style="font-family: 'Courier New', Courier, monospace;">import javax.servlet.http.HttpServletRequest;</span><br />
<span style="font-family: 'Courier New', Courier, monospace;">import javax.servlet.http.HttpServletResponse;</span><br />
<span style="font-family: 'Courier New', Courier, monospace;">import javax.servlet.http.HttpSession;</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><br /></span><br />
<span style="font-family: 'Courier New', Courier, monospace;">import org.apache.commons.lang.xwork.StringUtils;</span><br />
<span style="font-family: 'Courier New', Courier, monospace;">import org.apache.struts2.StrutsStatics;</span><br />
<span style="font-family: 'Courier New', Courier, monospace;">import org.hibernate.HibernateException;</span><br />
<span style="font-family: 'Courier New', Courier, monospace;">import org.hibernate.Session;</span><br />
<span style="font-family: 'Courier New', Courier, monospace;">import org.hibernate.SessionFactory;</span><br />
<span style="font-family: 'Courier New', Courier, monospace;">import org.hibernate.cfg.Configuration;</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><br /></span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><br /></span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><br /></span><br />
<span style="font-family: 'Courier New', Courier, monospace;">import com.opensymphony.xwork2.ActionContext;</span><br />
<span style="font-family: 'Courier New', Courier, monospace;">import com.opensymphony.xwork2.ActionInvocation;</span><br />
<span style="font-family: 'Courier New', Courier, monospace;">import com.opensymphony.xwork2.interceptor.AbstractInterceptor;</span><br />
<span style="font-family: 'Courier New', Courier, monospace;">import com.user.User_Info;</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><br /></span><br />
<span style="font-family: 'Courier New', Courier, monospace;">public class LoginInterceptor extends AbstractInterceptor implements StrutsStatics</span><br />
<span style="font-family: 'Courier New', Courier, monospace;">{</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><br /></span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>private static final long serialVersionUID = 1L;</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>HttpSession session;</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>HttpServletRequest request;</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>HttpServletResponse response;</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>String t;</span><br />
<span class="Apple-tab-span" style="font-family: 'Courier New', Courier, monospace; white-space: pre;"> </span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>@Override</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>public String intercept(ActionInvocation actin) throws Exception</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>{</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>//System.out.println("call interceptor");</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>ActionContext ctx=actin.getInvocationContext();</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span> request=(HttpServletRequest)ctx.get(HTTP_REQUEST) ;</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span> response=(HttpServletResponse) ctx.get(HTTP_RESPONSE);</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span> session = request.getSession (true);</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span> Object user = session.getAttribute ("user");</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span> if (user == null)</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span> {</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span> <span class="Apple-tab-span" style="white-space: pre;"> </span>//System.out.println("inside near user=null");</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span> <span class="Apple-tab-span" style="white-space: pre;"> </span>String trylog = request.getParameter("user");</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span> if (! StringUtils.isBlank (trylog) )</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span> {</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span> <span class="Apple-tab-span" style="white-space: pre;"> </span>//System.out.println("try");</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span> <span class="Apple-tab-span" style="white-space: pre;"> </span>String usern=request.getParameter("user").toString();</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span> <span class="Apple-tab-span" style="white-space: pre;"> </span></span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span> <span class="Apple-tab-span" style="white-space: pre;"> </span>String pass=request.getParameter("pass").toString();</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span> <span class="Apple-tab-span" style="white-space: pre;"> </span>SessionFactory sf=new Configuration().configure("hibernate.cfg.xml").buildSessionFactory();</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span> <span class="Apple-tab-span" style="white-space: pre;"> </span>Session ses= sf.openSession();</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span> <span class="Apple-tab-span" style="white-space: pre;"> </span>//System.out.println("enter id");</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span> <span class="Apple-tab-span" style="white-space: pre;"> </span>User_Info u=new User_Info();</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span> <span class="Apple-tab-span" style="white-space: pre;"> </span>try</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span> <span class="Apple-tab-span" style="white-space: pre;"> </span>{</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span> <span class="Apple-tab-span" style="white-space: pre;"> </span>List l = ses.createQuery("select password from com.user.User_Info e where e.user_id="+"'"+usern+"'").list();</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span> <span class="Apple-tab-span" style="white-space: pre;"> </span>for(Object o:l)</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span> <span class="Apple-tab-span" style="white-space: pre;"> </span>{</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span> <span class="Apple-tab-span" style="white-space: pre;"> </span> t=(String) o;</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span> <span class="Apple-tab-span" style="white-space: pre;"> </span></span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span> <span class="Apple-tab-span" style="white-space: pre;"> </span>}</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><br /></span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span> <span class="Apple-tab-span" style="white-space: pre;"> </span>}</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span> <span class="Apple-tab-span" style="white-space: pre;"> </span>catch (HibernateException e)</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span> <span class="Apple-tab-span" style="white-space: pre;"> </span>{</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span> <span class="Apple-tab-span" style="white-space: pre;"> </span>e.printStackTrace();</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span> <span class="Apple-tab-span" style="white-space: pre;"> </span>}</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span> <span class="Apple-tab-span" style="white-space: pre;"> </span>if(pass.equals(t.toString()))</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span> <span class="Apple-tab-span" style="white-space: pre;"> </span>{</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span> <span class="Apple-tab-span" style="white-space: pre;"> </span>//System.out.println("ho gaya");</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span> <span class="Apple-tab-span" style="white-space: pre;"> </span>session.setAttribute("user", usern);</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span> <span class="Apple-tab-span" style="white-space: pre;"> </span>//request.setAttribute("page", "dummy.jsp");//Following line of code is for a concern of a project for using a master page to include other pages by calling the page required to be included from session</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span> <span class="Apple-tab-span" style="white-space: pre;"> </span>return "success";</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span> <span class="Apple-tab-span" style="white-space: pre;"> </span>}</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span> <span class="Apple-tab-span" style="white-space: pre;"> </span>/*else</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span> <span class="Apple-tab-span" style="white-space: pre;"> </span>{</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span> <span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println("cookie");</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span> <span class="Apple-tab-span" style="white-space: pre;"> </span>Cookie c[]=request.getCookies();</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span> <span class="Apple-tab-span" style="white-space: pre;"> </span>if(c==null)</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>{</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span> <span class="Apple-tab-span" style="white-space: pre;"> </span></span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span> <span class="Apple-tab-span" style="white-space: pre;"> </span>int counter = 1;</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span> <span class="Apple-tab-span" style="white-space: pre;"> </span>Cookie cnt = new Cookie("count",new Integer(counter).toString());</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span> <span class="Apple-tab-span" style="white-space: pre;"> </span>cnt.setMaxAge(65000);</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span> <span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println(cnt);</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span> <span class="Apple-tab-span" style="white-space: pre;"> </span>response.addCookie(cnt);</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span> <span class="Apple-tab-span" style="white-space: pre;"> </span>}</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span> <span class="Apple-tab-span" style="white-space: pre;"> </span>else</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>{</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span> <span class="Apple-tab-span" style="white-space: pre;"> </span>for(int i=0;i<c.length;i++)</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>{</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span> <span class="Apple-tab-span" style="white-space: pre;"> </span> if(c[i].getName().equals("count"))</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span> <span class="Apple-tab-span" style="white-space: pre;"> </span> {</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span> <span class="Apple-tab-span" style="white-space: pre;"> </span> int count = Integer.parseInt(c[i].getValue());</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span> <span class="Apple-tab-span" style="white-space: pre;"> </span> if(count<3)</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span> {</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span> <span class="Apple-tab-span" style="white-space: pre;"> </span> count++;</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span> <span class="Apple-tab-span" style="white-space: pre;"> </span> //System.out.println("now="+count);</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span> <span class="Apple-tab-span" style="white-space: pre;"> </span> c[i].setValue(new Integer(count).toString());</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span> <span class="Apple-tab-span" style="white-space: pre;"> </span> response.addCookie(c[i]);</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span> <span class="Apple-tab-span" style="white-space: pre;"> </span> return "login";</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span> <span class="Apple-tab-span" style="white-space: pre;"> </span> }</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span> <span class="Apple-tab-span" style="white-space: pre;"> </span> else</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span> <span class="Apple-tab-span" style="white-space: pre;"> </span> {</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span> <span class="Apple-tab-span" style="white-space: pre;"> </span> count++;</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span> <span class="Apple-tab-span" style="white-space: pre;"> </span> c[i].setValue(new Integer(count).toString());</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span> <span class="Apple-tab-span" style="white-space: pre;"> </span> response.addCookie(c[i]);</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span> return "change";</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span> <span class="Apple-tab-span" style="white-space: pre;"> </span> }</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span> <span class="Apple-tab-span" style="white-space: pre;"> </span> }</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span> <span class="Apple-tab-span" style="white-space: pre;"> </span>}</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span> <span class="Apple-tab-span" style="white-space: pre;"> </span></span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span> </span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span> <span class="Apple-tab-span" style="white-space: pre;"> </span> ses.close();</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span> <span class="Apple-tab-span" style="white-space: pre;"> </span> System.out.println(u);</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span> <span class="Apple-tab-span" style="white-space: pre;"> </span>}*/</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span> <span class="Apple-tab-span" style="white-space: pre;"> </span>return "login";</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span> <span class="Apple-tab-span" style="white-space: pre;"> </span></span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span> }</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><br /></span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span> else</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>{</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span> </span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span> Object action = actin.getAction ();</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span> <span class="Apple-tab-span" style="white-space: pre;"> </span> if (action instanceof com.opensymphony.xwork2.ValidationAware)</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span> {</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span> <span class="Apple-tab-span" style="white-space: pre;"> </span>((com.opensymphony.xwork2.ValidationAware) action).addActionError ("Username / password / code incorrect!");</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span> <span class="Apple-tab-span" style="white-space: pre;"> </span> }</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span> <span class="Apple-tab-span" style="white-space: pre;"> </span></span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span> }</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span> return "login";</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span> }</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>else</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span> {</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span> <span class="Apple-tab-span" style="white-space: pre;"> </span>return actin.invoke();</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span> }</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> }</span><br />
<span style="font-family: 'Courier New', Courier, monospace;">}</span></div>Ajo (Dev)http://www.blogger.com/profile/11302481405062225663noreply@blogger.com80tag:blogger.com,1999:blog-5876957615554554011.post-4037085698603457722011-11-29T13:10:00.000+05:302011-11-29T13:10:57.121+05:30Distance Calculator using google api distance matrix, and json parsing<div dir="ltr" style="text-align: left;" trbidi="on"><br />
<span style="font-family: Georgia, 'Times New Roman', serif;"><br />
</span><br />
<span style="font-family: Georgia, 'Times New Roman', serif;">Was working on google api for my project to calculate the distance between 2 places.. Google maps has that functionality but i needed a sneak peek into the api for that.. I did a little research for the same and found out that they used json objects in Distance Matrix for the same. So i tried to learn json parsing which is very simple by the way. You will need the json jar file to run this and its quite good at calculating distance between any two places on earth...</span><br />
<span style="font-family: Georgia, 'Times New Roman', serif;">Try it out.. Its very simple.</span><br />
<span style="font-family: Georgia, 'Times New Roman', serif;"><br />
</span><br />
<span style="font-family: Georgia, 'Times New Roman', serif;">the data from the url for 2 places say noida to delhi will be a json object of the format</span><br />
<span style="font-family: Georgia, 'Times New Roman', serif;"><br />
</span><br />
<span style="font-family: Georgia, 'Times New Roman', serif;">You just need to know how to parse through and get thae data. :)</span><br />
<br />
<b><span style="font-size: large;">//JSON object :</span></b><br />
<br />
<span style="font-family: 'Courier New', Courier, monospace;">{</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> "destination_addresses" : [ "Bokaro, झारखण्ड, India" ],</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> "origin_addresses" : [ "Noida, Delhi, India" ],</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> "rows" : [</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> {</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> "elements" : [</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> {</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> "distance" : {</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> "text" : "1,201 km",</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> "value" : 1200769</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> },</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> "duration" : {</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> "text" : "15 hours 19 mins",</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> "value" : 55119</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> },</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> "status" : "OK"</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> }</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> ]</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> }</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> ],</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> "status" : "OK"</span><br />
<span style="font-family: 'Courier New', Courier, monospace;">}</span><br />
<br />
<br />
<b><span style="font-size: large;">//JSONInterface.java</span></b><br />
<br />
<span style="font-family: 'Courier New', Courier, monospace;">package com.distanceMatrix;</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><br />
</span><br />
<span style="font-family: 'Courier New', Courier, monospace;">import java.io.*;</span><br />
<span style="font-family: 'Courier New', Courier, monospace;">import java.net.URL;</span><br />
<span style="font-family: 'Courier New', Courier, monospace;">import java.nio.charset.Charset;</span><br />
<span style="font-family: 'Courier New', Courier, monospace;">import org.json.*;</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><br />
</span><br />
<span style="font-family: 'Courier New', Courier, monospace;">public class JSONInterface </span><br />
<span style="font-family: 'Courier New', Courier, monospace;">{</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>Integer tem;</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>Float dist;</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><br />
</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>private static String readAll(Reader rd) throws IOException </span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>{</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span> StringBuilder sb = new StringBuilder();</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span> int cp;</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span> while ((cp = rd.read()) != -1) </span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span> {</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span> sb.append((char) cp);</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span> }</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span> return sb.toString();</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span> }</span><br />
<span class="Apple-tab-span" style="white-space: pre;"><span style="font-family: 'Courier New', Courier, monospace;"> </span></span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>public static JSONObject readJsonFromUrl(String url) throws IOException, JSONException </span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>{</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span> InputStream is = new URL(url).openStream();</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span> try </span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span> {</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span> BufferedReader rd = new BufferedReader(new InputStreamReader(is, Charset.forName("UTF-8")));</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span> String jsonText = readAll(rd);</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span> JSONObject json = new JSONObject(jsonText);</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span> return json;</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span> }</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span> finally </span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span> {</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span> is.close();</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span> }</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><br />
</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>public float calcDistance(StringBuffer beg, StringBuffer end) </span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>{</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>JSONObject json=null;</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>try </span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>{</span><br />
<span class="Apple-tab-span" style="white-space: pre;"><span style="font-family: 'Courier New', Courier, monospace;"> </span></span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>json = readJsonFromUrl("https://maps.googleapis.com/maps/api/distancematrix/json?origins="+beg+"&destinations="+end+"&mode=driving&sensor=false");</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>json.get("rows");</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>JSONArray arr=null;</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>arr = json.getJSONArray("rows");</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>tem=(Integer)arr.getJSONObject(0).getJSONArray("elements").getJSONObject(0).getJSONObject("distance").getInt("value");</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>dist=(float)tem/1000;</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>catch (JSONException e) </span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>{</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>e.printStackTrace();</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>} </span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>catch (IOException e)</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>{</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span> <span class="Apple-tab-span" style="white-space: pre;"> </span>e.printStackTrace();</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>return dist;</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span><br />
<span style="font-family: 'Courier New', Courier, monospace;">}</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><br />
</span><br />
<br />
<br />
<b><span style="font-size: large;">//JSONDiatanceCalculator.java</span></b><br />
<br />
<br />
<span style="font-family: 'Courier New', Courier, monospace;">package com.distanceMatrix;</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><br />
</span><br />
<span style="font-family: 'Courier New', Courier, monospace;">import java.io.BufferedReader;</span><br />
<span style="font-family: 'Courier New', Courier, monospace;">import java.io.IOException;</span><br />
<span style="font-family: 'Courier New', Courier, monospace;">import java.io.InputStreamReader;</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><br />
</span><br />
<span style="font-family: 'Courier New', Courier, monospace;">public class JSONDiatanceCalculator </span><br />
<span style="font-family: 'Courier New', Courier, monospace;">{</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>static String beg,end;</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>static StringBuffer start=new StringBuffer(), stop=new StringBuffer();</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>static float totDistance;</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>public static void main(String args[])</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>{</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>JSONInterface ji=new JSONInterface();</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>BufferedReader br=new BufferedReader(new InputStreamReader(System.in));</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>try</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>{</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println("Enter the source place : ");</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>beg=br.readLine();</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println("Enter the distance place : ");</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>end=br.readLine();</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>start.append(beg);</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>stop.append(end);</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>for(int i=0; i<start.length(); i++)</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>{</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>if(start.charAt(i)==' ')</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>{</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>start.deleteCharAt(i);</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>start.insert(i, "%20");</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>for(int i=0;i<stop.length();i++)</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>{</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>if(stop.charAt(i)==' ')</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>{</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>stop.deleteCharAt(i);</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>stop.insert(i, "%20");</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>totDistance=ji.calcDistance(start,stop);</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println("The distance between "+beg+" and "+end+" is = "+totDistance);</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>catch(IOException e)</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>{</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println("Improper place value set..");</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>e.printStackTrace();</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>catch(Exception e)</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>{</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println("Json type exception");</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>e.printStackTrace();</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span><br />
<span style="font-family: 'Courier New', Courier, monospace;">}</span><br />
<div><br />
</div></div>Ajo (Dev)http://www.blogger.com/profile/11302481405062225663noreply@blogger.com33tag:blogger.com,1999:blog-5876957615554554011.post-5524299610698369162011-09-27T09:46:00.000+05:302012-06-09T15:25:23.567+05:30JCaptcha<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
<div align="center" class="MsoNormal" style="text-align: center;">
<span class="Apple-style-span" style="font-family: 'Times New Roman', serif;"><span class="Apple-style-span" style="font-size: 21px; line-height: 24px;"><b><br />
</b></span></span></div>
<div align="center" class="MsoNormal" style="text-align: center;">
<br /></div>
<div style="line-height: 12.0pt; margin-bottom: 12.0pt; margin-left: 0in; margin-right: 0in; margin-top: 12.0pt;">
<span lang="EN-IN">Lots of guys asked me help in integrating a simple jCaptcha module to their struts application.Was a bit busy with my work so am making this entry late. hope this is helpful</span></div>
<div style="line-height: 12.0pt; margin-bottom: 12.0pt; margin-left: 0in; margin-right: 0in; margin-top: 12.0pt;">
<span lang="EN-IN">JCaptcha stands for <span class="apple-style-span"><span style="background-color: white;">Java Completely Automated Public Test to tell Computers and Humans Apart. Four years since the inception, the 1.0 release is the first declared as stable, available on the</span></span><span class="apple-converted-space"><span style="background-color: white;"> </span></span><a href="http://repo2.maven.org/maven2/com/octo/captcha/"><span style="background-color: white; color: windowtext; text-decoration: none;">central Maven repository</span></a><span class="apple-converted-space"><span style="background-color: white;"> </span></span><span class="apple-style-span"><span style="background-color: white;">or on</span></span><span class="apple-converted-space"><span style="background-color: white;"> </span></span><a href="http://sourceforge.net/project/showfiles.php?group_id=97877&package_id=104743&release_id=658521"><span style="background-color: white; color: windowtext; text-decoration: none;">Sourceforge</span></a><span class="apple-style-span"><span style="background-color: white;">. The 1.0 release keep the JDK3 backward compatibility, next one 2.0-alpha1 will be built with JDK6 and provide compatibility with JDK5.</span></span><span style="background-color: white;"> The JCaptcha project is designed to ease extension, integration and configuration.<o:p></o:p></span></span></div>
<div style="margin-bottom: 12.0pt; margin-left: 0in; margin-right: 0in; margin-top: 12.0pt; mso-line-height-alt: 12.0pt;">
<span class="Apple-style-span" style="font-family: 'Times New Roman', serif; font-size: 16px; line-height: 18px;">jCaptcha has the objective of checking the authenticity of the user trying to perform some action on the page. It allows providing a check on the page by verifying the user’s value with the image value generated to access the functionality of user. It can be used to determine the validity of registration in a page.</span></div>
<div class="MsoNormal">
<b style="mso-bidi-font-weight: normal;"><span lang="EN-IN" style="font-family: 'Times New Roman', serif; font-size: 13pt; line-height: 115%;">Prerequisites:<o:p></o:p></span></b></div>
<div class="MsoNormal">
<span class="apple-style-span"><span lang="EN-IN" style="background-color: white; color: black; font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;">The user should be using java version 1.6 or higher.<o:p></o:p></span></span></div>
<div class="MsoNormal">
<span class="apple-style-span"><span lang="EN-IN" style="background-color: white; color: black; font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;">The jar files required are:<o:p></o:p></span></span></div>
<div class="MsoListParagraphCxSpFirst" style="mso-list: l0 level1 lfo1; text-indent: -.25in;">
<span class="apple-style-span"><span lang="EN-IN" style="color: black; font-family: Symbol; font-size: 12pt; line-height: 115%;">·<span style="font-family: 'Times New Roman'; font-size: 7pt; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal;"> </span></span></span><span class="apple-style-span"><span lang="EN-IN" style="background-color: white; color: black; font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;">jcaptcha-all.jar<o:p></o:p></span></span></div>
<div class="MsoListParagraphCxSpLast" style="mso-list: l0 level1 lfo1; text-indent: -.25in;">
<span lang="EN-IN" style="font-family: Symbol; font-size: 12pt; line-height: 115%;">·<span style="font-family: 'Times New Roman'; font-size: 7pt; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal;"> </span></span><span class="apple-style-span"><span lang="EN-IN" style="background-color: white; color: black; font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;">commons-collection-3.2</span></span><span lang="EN-IN" style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;"><o:p></o:p></span></div>
<div class="MsoNormal">
<b style="mso-bidi-font-weight: normal;"><span lang="EN-IN" style="font-family: 'Times New Roman', serif; font-size: 13pt; line-height: 115%;"><br />
</span></b></div>
<div class="MsoNormal">
<b style="mso-bidi-font-weight: normal;"><span lang="EN-IN" style="font-family: 'Times New Roman', serif; font-size: 13pt; line-height: 115%;"><br />
</span></b></div>
<div class="MsoNormal">
<b style="mso-bidi-font-weight: normal;"><span lang="EN-IN" style="font-family: 'Times New Roman', serif; font-size: 13pt; line-height: 115%;"><br />
</span></b></div>
<div class="MsoNormal">
<span class="Apple-style-span" style="font-family: 'Times New Roman', serif;"><span class="Apple-style-span" style="font-size: 17px; line-height: 19px;"><b><br />
</b></span></span></div>
<div class="MsoNormal">
<span lang="EN-IN" style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;">J<span class="apple-style-span"><span style="background-color: white;">Captcha tries to strictly respect the Inversion of Control pattern, to ease creation of components for concrete applications.</span></span><span class="apple-converted-space"><span style="background-color: white;"> </span></span><span class="apple-style-span"><span style="background-color: white;">An application using JCaptcha should only manipulate a CaptchaService instance.<o:p></o:p></span></span></span></div>
<div class="MsoNormal">
<span class="apple-style-span"><b style="mso-bidi-font-weight: normal;"><span lang="EN-IN" style="background-color: white; font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;">Step 1:<o:p></o:p></span></b></span></div>
<div class="MsoNormal">
<span class="apple-style-span"><span lang="EN-IN" style="background-color: white; font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;"> For maven users the simple procedure is to include the specific jar dependency to the pom.xml file instance as follows:<o:p></o:p></span></span></div>
<div class="MsoNoSpacing">
<span class="apple-style-span"><span lang="EN-IN" style="background-color: white; font-family: 'Courier New'; font-size: 12pt;"><dependency><o:p></o:p></span></span></div>
<div class="MsoNoSpacing">
<span class="apple-style-span"><span lang="EN-IN" style="background-color: white; font-family: 'Courier New'; font-size: 12pt;"> <groupId>com.octo.captcha</groupId><o:p></o:p></span></span></div>
<div class="MsoNoSpacing">
<span class="apple-style-span"><span lang="EN-IN" style="background-color: white; font-family: 'Courier New'; font-size: 12pt;"> <artifactId>jcaptcha</artifactId><o:p></o:p></span></span></div>
<div class="MsoNoSpacing">
<span class="apple-style-span"><span lang="EN-IN" style="background-color: white; font-family: 'Courier New'; font-size: 12pt;"> <version>1.0</version><o:p></o:p></span></span></div>
<div class="MsoNoSpacing">
<span class="apple-style-span"><span lang="EN-IN" style="background-color: white; font-family: 'Courier New'; font-size: 12pt;"></dependency><o:p></o:p></span></span></div>
<div class="MsoNoSpacing">
<br /></div>
<div class="MsoNormal">
<span class="apple-style-span"><span lang="EN-IN" style="background-color: white; font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;">For those who don’t use maven the simple procedure is to add the <span style="color: black;">jcaptcha-all.jar and commons-collection-3.2 or greater to the application class path, ie in the WEB-INF/lib folder.</span><o:p></o:p></span></span></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<b style="mso-bidi-font-weight: normal;"><span lang="EN-IN" style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;">Step 2:<o:p></o:p></span></b></div>
<div class="MsoNormal">
<span lang="EN-IN" style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;">Provide the reference of the new servlet in the web.xml file to instantiate and allow access to the servlet as:<o:p></o:p></span></div>
<div class="MsoNoSpacing">
<span lang="EN-IN" style="font-family: 'Courier New'; font-size: 12pt;"><br />
<servlet><o:p></o:p></span></div>
<div class="MsoNoSpacing">
<span lang="EN-IN" style="font-family: 'Courier New'; font-size: 12pt;"> <servlet-name>jcaptcha</servlet-name><o:p></o:p></span></div>
<div class="MsoNoSpacing">
<span lang="EN-IN" style="font-family: 'Courier New'; font-size: 12pt;"> <servlet-class>com.octo.captcha.servlet.image.SimpleImageCaptchaServlet</servlet-class><o:p></o:p></span></div>
<div class="MsoNoSpacing">
<span lang="EN-IN" style="font-family: 'Courier New'; font-size: 12pt;"></servlet><o:p></o:p></span></div>
<div class="MsoNoSpacing">
<span lang="EN-IN" style="font-family: 'Courier New'; font-size: 12pt;"><servlet-mapping><o:p></o:p></span></div>
<div class="MsoNoSpacing">
<span lang="EN-IN" style="font-family: 'Courier New'; font-size: 12pt;"> <servlet-name>jcaptcha</servlet-name><o:p></o:p></span></div>
<div class="MsoNoSpacing">
<span lang="EN-IN" style="font-family: 'Courier New'; font-size: 12pt;"> <url-pattern>/jcaptcha.jpg</url-pattern><o:p></o:p></span></div>
<div class="MsoNoSpacing">
<span lang="EN-IN" style="font-family: 'Courier New'; font-size: 12pt;"></servlet-mapping><o:p></o:p></span></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<b style="mso-bidi-font-weight: normal;"><span lang="EN-IN" style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;">Step 3:<o:p></o:p></span></b></div>
<div class="MsoNormal">
<span class="apple-style-span"><span lang="EN-IN" style="background-color: white; color: black; font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;">Add an image tag to the form you want to protect, by referring to the servlet call which asks the SimpleImageCaptchaServlet to generate a fresh new captcha.<o:p></o:p></span></span></div>
<div class="MsoNoSpacing">
<span lang="EN-IN" style="font-family: 'Courier New'; font-size: 12pt;"><img src="jcaptcha.jpg" /> <input type="text" name="jcaptcha" value="" /><o:p></o:p></span></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<b style="mso-bidi-font-weight: normal;"><span lang="EN-IN" style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;">Step 4:<o:p></o:p></span></b></div>
<div class="MsoNormal">
<span lang="EN-IN" style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;">In the action file that validates the previous form’s action validate the input of the user with respect to the captcha value.<o:p></o:p></span></div>
<div class="MsoNoSpacing">
<span lang="EN-IN" style="font-family: 'Courier New'; font-size: 12pt;">String userCaptchaResponse =request.getParameter ("jcaptcha");<o:p></o:p></span></div>
<div class="MsoNoSpacing">
<span lang="EN-IN" style="font-family: 'Courier New'; font-size: 12pt;">boolean captchaPassed = SimpleImageCaptchaServlet.validateResponse(request,userCaptchaResponse);<o:p></o:p></span></div>
<div class="MsoNoSpacing">
<span lang="EN-IN" style="font-family: 'Courier New'; font-size: 12pt;">if(captchaPassed)<o:p></o:p></span></div>
<div class="MsoNoSpacing">
<span lang="EN-IN" style="font-family: 'Courier New'; font-size: 12pt;">{<o:p></o:p></span></div>
<div class="MsoNoSpacing">
<span lang="EN-IN" style="font-family: 'Courier New'; font-size: 12pt;">// proceed to submit action<o:p></o:p></span></div>
<div class="MsoNoSpacing">
<span lang="EN-IN" style="font-family: 'Courier New'; font-size: 12pt;">}<o:p></o:p></span></div>
<div class="MsoNoSpacing">
<span lang="EN-IN" style="font-family: 'Courier New'; font-size: 12pt;">Else<o:p></o:p></span></div>
<div class="MsoNoSpacing">
<span lang="EN-IN" style="font-family: 'Courier New'; font-size: 12pt;">{<o:p></o:p></span></div>
<div class="MsoNoSpacing">
<span lang="EN-IN" style="font-family: 'Courier New'; font-size: 12pt;">// return error to user<o:p></o:p></span></div>
<div class="MsoNoSpacing">
<span lang="EN-IN" style="font-family: 'Courier New'; font-size: 12pt;">}<o:p></o:p></span></div>
<div class="MsoNormal">
<br /></div>
</div>Ajo (Dev)http://www.blogger.com/profile/11302481405062225663noreply@blogger.com1tag:blogger.com,1999:blog-5876957615554554011.post-62079687898582917712011-09-12T12:46:00.002+05:302011-09-12T13:44:43.950+05:30jQuery Basics<div dir="ltr" style="text-align: left;" trbidi="on"><br />
<span class="Apple-style-span" style="font-family: Verdana, sans-serif;">A-> Attribute</span><br />
<span class="Apple-style-span" style="font-family: Verdana, sans-serif;">B-><span class="Apple-tab-span" style="white-space: pre;"> </span>Element</span><br />
<span class="Apple-style-span" style="font-family: Verdana, sans-serif;">C-><span class="Apple-tab-span" style="white-space: pre;"> </span>Element</span><br />
<span class="Apple-style-span" style="font-family: Verdana, sans-serif;">D-> Class</span><br />
<span class="Apple-style-span" style="font-family: Verdana, sans-serif;">I-><span class="Apple-tab-span" style="white-space: pre;"> </span>Id</span><br />
<span class="Apple-style-span" style="font-family: Verdana, sans-serif;">V-><span class="Apple-tab-span" style="white-space: pre;"> </span>Value</span><br />
<span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><br />
</span><br />
<span class="Apple-style-span" style="font-family: Verdana, sans-serif;">Selector<span class="Apple-tab-span" style="white-space: pre;"> </span>Description</span><br />
<span class="Apple-style-span" style="font-family: Verdana, sans-serif;">-------------------------------------------------------------------------------------</span><br />
<span class="Apple-style-span" style="font-family: Verdana, sans-serif;">*<span class="Apple-tab-span" style="white-space: pre;"> </span>Matches any element</span><br />
<span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><br />
</span><br />
<span class="Apple-style-span" style="font-family: Verdana, sans-serif;">B<span class="Apple-tab-span" style="white-space: pre;"> </span>Matches all element with tag name B</span><br />
<span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><br />
</span><br />
<span class="Apple-style-span" style="font-family: Verdana, sans-serif;">B C<span class="Apple-tab-span" style="white-space: pre;"> </span>Matches all element with tag name C that are descendants of B</span><br />
<span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><br />
</span><br />
<span class="Apple-style-span" style="font-family: Verdana, sans-serif;">B>C<span class="Apple-tab-span" style="white-space: pre;"> </span>Matches all C that are direct children of B</span><br />
<span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><br />
</span><br />
<span class="Apple-style-span" style="font-family: Verdana, sans-serif;">B+C<span class="Apple-tab-span" style="white-space: pre;"> </span>Match all C immediately preceded by sibling </span><br />
<span class="Apple-style-span" style="font-family: Verdana, sans-serif;">B</span><br />
<span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><br />
</span><br />
<span class="Apple-style-span" style="font-family: Verdana, sans-serif;">B~C<span class="Apple-tab-span" style="white-space: pre;"> </span>Match all C preceded by any B</span><br />
<span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><br />
</span><br />
<span class="Apple-style-span" style="font-family: Verdana, sans-serif;">B:has(C)<span class="Apple-tab-span" style="white-space: pre;"> </span>Match all B that has at least 1 descendant C</span><br />
<span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><br />
</span><br />
<span class="Apple-style-span" style="font-family: Verdana, sans-serif;">B.D<span class="Apple-tab-span" style="white-space: pre;"> </span>Match all B with class D</span><br />
<span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><br />
</span><br />
<span class="Apple-style-span" style="font-family: Verdana, sans-serif;">.D<span class="Apple-tab-span" style="white-space: pre;"> </span>Match all class D. (*.D)</span><br />
<span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><br />
</span><br />
<span class="Apple-style-span" style="font-family: Verdana, sans-serif;">B#I<span class="Apple-tab-span" style="white-space: pre;"> </span>Match all B with id I</span><br />
<span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><br />
</span><br />
<span class="Apple-style-span" style="font-family: Verdana, sans-serif;">#I<span class="Apple-tab-span" style="white-space: pre;"> </span>Match all id I <span class="Apple-tab-span" style="white-space: pre;"> </span>(*#I)</span><br />
<span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><br />
</span><br />
<span class="Apple-style-span" style="font-family: Verdana, sans-serif;">B[A]<span class="Apple-tab-span" style="white-space: pre;"> </span>Match all B with attribute A of any value</span><br />
<span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><br />
</span><br />
<span class="Apple-style-span" style="font-family: Verdana, sans-serif;">B[A=V]<span class="Apple-tab-span" style="white-space: pre;"> </span>Match all B with attribute A and value V</span><br />
<span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><br />
</span><br />
<span class="Apple-style-span" style="font-family: Verdana, sans-serif;">B[A^=V]<span class="Apple-tab-span" style="white-space: pre;"> </span>Match all B with attribute A and value beginning with V</span><br />
<span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><br />
</span><br />
<span class="Apple-style-span" style="font-family: Verdana, sans-serif;">B[A$=V]<span class="Apple-tab-span" style="white-space: pre;"> </span>Match all B with attribute A and value ending with V</span><br />
<span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><br />
</span><br />
<span class="Apple-style-span" style="font-family: Verdana, sans-serif;">B[A*=V]<span class="Apple-tab-span" style="white-space: pre;"> </span>Match all B with attribute A and value containing V</span><br />
<span class="Apple-style-span" style="font-family: Verdana, sans-serif;">..........................................................................................</span><br />
<span class="Apple-style-span" style="font-family: Verdana, sans-serif;">:first<span class="Apple-tab-span" style="white-space: pre;"> </span>First match of the page</span><br />
<span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><br />
</span><br />
<span class="Apple-style-span" style="font-family: Verdana, sans-serif;">:last<span class="Apple-tab-span" style="white-space: pre;"> </span>Last match of the page</span><br />
<span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><br />
</span><br />
<span class="Apple-style-span" style="font-family: Verdana, sans-serif;">:first-child<span class="Apple-tab-span" style="white-space: pre;"> </span>First child element</span><br />
<span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><br />
</span><br />
<span class="Apple-style-span" style="font-family: Verdana, sans-serif;">:last-child<span class="Apple-tab-span" style="white-space: pre;"> </span>Last child element</span><br />
<span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><br />
</span><br />
<span class="Apple-style-span" style="font-family: Verdana, sans-serif;">:only-child<span class="Apple-tab-span" style="white-space: pre;"> </span>All element without siblings</span><br />
<span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><br />
</span><br />
<span class="Apple-style-span" style="font-family: Verdana, sans-serif;">:nth-child(n)<span class="Apple-tab-span" style="white-space: pre;"> </span>nth child element</span><br />
<span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><br />
</span><br />
<span class="Apple-style-span" style="font-family: Verdana, sans-serif;">:nth-child(even|odd)<span class="Apple-tab-span" style="white-space: pre;"> </span>Even or odd children</span><br />
<span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><br />
</span><br />
<span class="Apple-style-span" style="font-family: Verdana, sans-serif;">:nth-child(Xn+Y)<span class="Apple-tab-span" style="white-space: pre;"> </span>Element computed by the supplied formula</span><br />
<span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><br />
</span><br />
<span class="Apple-style-span" style="font-family: Verdana, sans-serif;">:even|:odd<span class="Apple-tab-span" style="white-space: pre;"> </span>Even|Odd matching elements page wide</span><br />
<span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><br />
</span><br />
<span class="Apple-style-span" style="font-family: Verdana, sans-serif;">:eq(n)<span class="Apple-tab-span" style="white-space: pre;"> </span>nth matching element</span><br />
<span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><br />
</span><br />
<span class="Apple-style-span" style="font-family: Verdana, sans-serif;">:gt(n)<span class="Apple-tab-span" style="white-space: pre;"> </span>matching elements after n and excluding the </span><br />
<span class="Apple-style-span" style="font-family: Verdana, sans-serif;">nth</span><br />
<span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><br />
</span><br />
<span class="Apple-style-span" style="font-family: Verdana, sans-serif;">:lt(n)<span class="Apple-tab-span" style="white-space: pre;"> </span>matching elements before n and excluding the nth</span><br />
<span class="Apple-style-span" style="font-family: Verdana, sans-serif;">-----------------------------------------------------------------------------------------</span><br />
<div><br />
</div><table border="0" cellpadding="0" cellspacing="0" class="MsoTableGrid" style="border-collapse: collapse; border: none; mso-border-insideh: none; mso-border-insidev: none; mso-padding-alt: 0in 5.4pt 0in 5.4pt; mso-yfti-tbllook: 1184;"><tbody>
<tr><td style="padding: 0in 5.4pt 0in 5.4pt;" valign="top"><br />
</td><td style="padding: 0in 5.4pt 0in 5.4pt;" valign="top"><br />
</td></tr>
<tr><td style="padding: 0in 5.4pt 0in 5.4pt;" valign="top"><br />
</td><td style="padding: 0in 5.4pt 0in 5.4pt;" valign="top"><br />
</td></tr>
</tbody></table></div>Ajo (Dev)http://www.blogger.com/profile/11302481405062225663noreply@blogger.com0tag:blogger.com,1999:blog-5876957615554554011.post-44100799588657277292011-09-06T16:27:00.002+05:302012-06-09T15:26:40.419+05:30Sample Application using the frameworks of struts2, hibernate, spring and log4j<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
//User.java<br />
<br />
<span style="font-family: 'Courier New', Courier, monospace;">package com.action;</span><br />
<span style="font-family: 'Courier New', Courier, monospace;">import javax.servlet.http.HttpServletRequest;</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><br /></span><br />
<span style="font-family: 'Courier New', Courier, monospace;">import org.apache.log4j.BasicConfigurator;</span><br />
<span style="font-family: 'Courier New', Courier, monospace;">import org.apache.log4j.Logger;</span><br />
<span style="font-family: 'Courier New', Courier, monospace;">import org.apache.struts2.interceptor.ServletRequestAware;</span><br />
<span style="font-family: 'Courier New', Courier, monospace;">import com.opensymphony.xwork2.Action;</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><br /></span><br />
<span style="font-family: 'Courier New', Courier, monospace;">public class User implements Action,ServletRequestAware</span><br />
<span style="font-family: 'Courier New', Courier, monospace;">{</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>static Logger l=Logger.getLogger("com.action.User");</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>HttpServletRequest request;</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>int id;</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>String userName, passWord;</span><br />
<span class="Apple-tab-span" style="font-family: 'Courier New', Courier, monospace; white-space: pre;"> </span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>public int getId()</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>{</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>return id;</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>public void setId(int id)</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>{</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>this.id = id;</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>public String getUserName()</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>{</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>return userName;</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>public void setUserName(String userName)</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>{</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>this.userName = userName;</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>public String getPassWord()</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>{</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>return passWord;</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>public void setPassWord(String passWord)</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>{</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>this.passWord = passWord;</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>public String toString()</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>{</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>BasicConfigurator.configure();</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>l.info("Return the values as a string");</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>return "Username : "+userName+" , Password : "+passWord;</span><br />
<span class="Apple-tab-span" style="font-family: 'Courier New', Courier, monospace; white-space: pre;"> </span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>@Override</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>public String execute() throws Exception</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>{</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>BasicConfigurator.configure();</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>boolean userVal=request.getParameter("userName").toString().equals("");</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>if(userVal)</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>{</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>l.info("Guest User logging");</span><br />
<span class="Apple-tab-span" style="font-family: 'Courier New', Courier, monospace; white-space: pre;"> </span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>else if(!userVal&&request.getParameter("passWord").toString().equals(""))</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>{</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>l.error("User trying to log without password");</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>return INPUT;</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span><br />
<span class="Apple-tab-span" style="font-family: 'Courier New', Courier, monospace; white-space: pre;"> </span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>l.info("successful login");</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>return SUCCESS;</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>@Override</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>public void setServletRequest(HttpServletRequest arg0)</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>{</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>request=arg0;</span><br />
<span class="Apple-tab-span" style="font-family: 'Courier New', Courier, monospace; white-space: pre;"> </span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span><br />
<span style="font-family: 'Courier New', Courier, monospace;">}</span><br />
<br />
<br />
//applicationContext.xml<br />
<br />
<span style="font-family: 'Courier New', Courier, monospace;"><?xml version="1.0" encoding="UTF-8"?></span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><beans xmlns="http://www.springframework.org/schema/beans"</span><br />
<span style="font-family: 'Courier New', Courier, monospace;">xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"</span><br />
<span style="font-family: 'Courier New', Courier, monospace;">xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"></span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><!--Bean 1--></span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span><bean id="user" class="com.action.User"></span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span><property name="id" value="1"/></span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span><property name="userName" value="Guest"/></span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span><property name="passWord" value="No Password Required"/></span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span></bean></span><br />
<span style="font-family: 'Courier New', Courier, monospace;"></beans></span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><br /></span><br />
<br />
//home.jsp<br />
<br />
<span style="font-family: 'Courier New', Courier, monospace;"><%@ page language="java" contentType="text/html; charset=ISO-8859-1"</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> pageEncoding="ISO-8859-1"%></span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> <%@taglib prefix="s" uri="/struts-tags"%></span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> <%@ page import="org.springframework.context.support.ClassPathXmlApplicationContext,org.springframework.beans.factory.BeanFactory,org.apache.log4j.BasicConfigurator,com.action.*,org.apache.log4j.Logger" %></span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> <%@page import="org.hibernate.cfg.Configuration,org.hibernate.Transaction,org.hibernate.SessionFactory,org.hibernate.Session" %></span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"></span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><br /></span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><%@page import="org.apache.struts2.interceptor.SessionAware"%><html></span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><head></span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"></span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><title>Logger Home</title></span><br />
<span style="font-family: 'Courier New', Courier, monospace;"></head></span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><body></span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><%</span><br />
<span style="font-family: 'Courier New', Courier, monospace;">Logger l=Logger.getLogger("com.action.User");</span><br />
<span style="font-family: 'Courier New', Courier, monospace;">BeanFactory beanfactory = new ClassPathXmlApplicationContext("applicationContext.xml");</span><br />
<span style="font-family: 'Courier New', Courier, monospace;">User u=(User)beanfactory.getBean("user");</span><br />
<span style="font-family: 'Courier New', Courier, monospace;">BasicConfigurator.configure();</span><br />
<span style="font-family: 'Courier New', Courier, monospace;">boolean flag=request.getParameter("userName").toString().equals("");</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>if(flag==false)</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>{</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>l.info("setting new username and password");</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>u.setUserName(request.getParameter("userName").toString());</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>u.setPassWord(request.getParameter("passWord").toString());</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>else</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>{</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>l.info("guest logged in");</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>/*u.setUserName(request.getAttribute("userName").toString());</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>u.setPassWord("No password required");*/</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>SessionFactory sf=new Configuration().configure().buildSessionFactory();</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>Session ses= sf.openSession();</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>Transaction tr= ses.beginTransaction();</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>ses.save(u);</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>tr.commit();</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>out.println(u.toString());</span><br />
<span class="Apple-tab-span" style="font-family: 'Courier New', Courier, monospace; white-space: pre;"> </span><br />
<span style="font-family: 'Courier New', Courier, monospace;">%></span><br />
<span style="font-family: 'Courier New', Courier, monospace;"></body></span><br />
<span style="font-family: 'Courier New', Courier, monospace;"></html></span><br />
<br />
<br />
//login.jsp<br />
<br />
<span style="font-family: 'Courier New', Courier, monospace;"><%@ page language="java" contentType="text/html; charset=ISO-8859-1"</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> pageEncoding="ISO-8859-1"%></span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> <%@taglib prefix="s" uri="/struts-tags"%></span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"></span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><html></span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><head></span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"></span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><title>MyLogger</title></span><br />
<span style="font-family: 'Courier New', Courier, monospace;"></head></span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><body></span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><s:form action="log" ></span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><s:textfield name="userName" label="Username:"/></span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><s:password name= "passWord" label="Password"/></span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><s:submit value="Submit"/></span><br />
<span style="font-family: 'Courier New', Courier, monospace;"></s:form></span><br />
<span style="font-family: 'Courier New', Courier, monospace;"></body></span><br />
<span style="font-family: 'Courier New', Courier, monospace;"></html></span><br />
<br />
//struts.xml<br />
<span style="font-family: 'Courier New', Courier, monospace;"><?xml version="1.0" encoding="UTF-8"?></span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><!DOCTYPE struts PUBLIC</span><br />
<span style="font-family: 'Courier New', Courier, monospace;">"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"</span><br />
<span style="font-family: 'Courier New', Courier, monospace;">"http://struts.apache.org/dtds/struts-2.0.dtd "></span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><struts></span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><package name="logger" extends="struts-default"></span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><action name="log" class="com.action.User"></span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><result name="input">login.jsp</result></span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><result>home.jsp</result></span><br />
<span style="font-family: 'Courier New', Courier, monospace;"></action></span><br />
<span style="font-family: 'Courier New', Courier, monospace;"></package></span><br />
<span style="font-family: 'Courier New', Courier, monospace;"></struts></span><br />
<br />
<br />
//user.hbm.xml<br />
<br />
<span style="font-family: 'Courier New', Courier, monospace;"><?xml version="1.0" encoding="UTF-8"?></span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><!DOCTYPE hibernate-mapping PUBLIC "-//hibernate/hibernate Mapping DTD 3.0//EN"</span><br />
<span style="font-family: 'Courier New', Courier, monospace;">"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"></span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><hibernate-mapping></span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span><class name="com.action.User" table="Logger"></span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span><id name="id" column="ID"></span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span><generator class="increment" /></span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span></id></span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span><property name="userName" column="UserName"/></span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span><property name="passWord" column ="PassWord"/></span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span></class></span><br />
<span class="Apple-tab-span" style="font-family: 'Courier New', Courier, monospace; white-space: pre;"> </span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span></hibernate-mapping></span><br />
<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>//hibernate.cfg.xml<br />
<br />
<span style="font-family: 'Courier New', Courier, monospace;"><?xml version="1.0" encoding="UTF-8"?></span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><!DOCTYPE hibernate-mapping PUBLIC "-//hibernate/hibernate Mapping DTD 3.0//EN"</span><br />
<span style="font-family: 'Courier New', Courier, monospace;">"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"></span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><hibernate-mapping></span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span><class name="com.action.User" table="Logger"></span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span><id name="id" column="ID"></span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span><generator class="increment" /></span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span></id></span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span><property name="userName" column="UserName"/></span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span><property name="passWord" column ="PassWord"/></span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span></class></span><br />
<span class="Apple-tab-span" style="font-family: 'Courier New', Courier, monospace; white-space: pre;"> </span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span></hibernate-mapping></span><br />
<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>//log4j.properties<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span><span style="font-family: 'Courier New', Courier, monospace;">log4j.appender.rollingFile=org.apache.log4j.RollingFileAppender</span><br />
<span style="font-family: 'Courier New', Courier, monospace;">log4j.appender.User=org.apache.log4j.RollingFileAppender</span><br />
<span style="font-family: 'Courier New', Courier, monospace;">log4j.appender.rollingFile.File=C:/appl.log</span><br />
<span style="font-family: 'Courier New', Courier, monospace;">log4j.appender.rollingFile.MaxFileSize=2MB</span><br />
<span style="font-family: 'Courier New', Courier, monospace;">log4j.appender.rollingFile.MaxBackupIndex=2</span><br />
<span style="font-family: 'Courier New', Courier, monospace;">log4j.appender.rollingFile.layout = org.apache.log4j.PatternLayout</span><br />
<span style="font-family: 'Courier New', Courier, monospace;">log4j.appender.rollingFile.layout.ConversionPattern=*Calling from line no %L* on Date: [%d] with Priority:(%p) Filename: %F At Thread: %t Using Class : %c from Method: {%M}- giving Message : %m%n</span><br />
<span style="font-family: 'Courier New', Courier, monospace;">log4j.appender.User.File=C:/Userlog.log</span><br />
<span style="font-family: 'Courier New', Courier, monospace;">log4j.appender.User.MaxFileSize=2MB</span><br />
<span style="font-family: 'Courier New', Courier, monospace;">log4j.appender.User.MaxBackupIndex=2</span><br />
<span style="font-family: 'Courier New', Courier, monospace;">log4j.appender.User.layout = org.apache.log4j.PatternLayout</span><br />
<span style="font-family: 'Courier New', Courier, monospace;">log4j.appender.User.layout.ConversionPattern=*Calling from line no %L* on Date: [%d] with Priority:(%p) Filename: %F At Thread: %t Using Class : %c from Method: {%M}- giving Message : %m%n</span><br />
<span style="font-family: 'Courier New', Courier, monospace;">log4j.category.com.action.User = INFO, User</span><br />
<span style="font-family: 'Courier New', Courier, monospace;">log4j.rootLogger = INFO, rollingFile</span><br />
<div>
<br /></div>
</div>Ajo (Dev)http://www.blogger.com/profile/11302481405062225663noreply@blogger.com18tag:blogger.com,1999:blog-5876957615554554011.post-68516104134291129732011-09-05T11:45:00.002+05:302011-09-05T11:45:47.345+05:30hibernate class mappings<div dir="ltr" style="text-align: left;" trbidi="on"><span class="Apple-style-span" style="color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px;"></span><br />
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">One table per class:<br />
primary to primary<br />
mapping using column<br />
data in all tables for class as designed<br />
<br />
<br />
One table per Class hierarchy<br />
one table overall<br />
value selection based on discriminator<br />
unnormalised form of data<br />
<br />
One table per concrete class with abstract<br />
abstract table implemented as empty<br />
concrete implementing classes have common fields<br />
set abstract as ttue to prevent any data entry to the class<br />
polymorphism as implicit to make the mapping through hibernate layer<br />
data access through abstract object<br />
<br />
One to many<br />
use of foreign primary keys<br />
key column sets relation<br />
one to many relation to be specified<br />
makes auto mapping<br />
<br />
One to one<br />
indirect transform by specifying unique constraint<br />
linked linking for updation<br />
resolved simplicity</div><div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><br />
</div><div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><br />
</div><span class="Apple-style-span" style="color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px;"><div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">go to following link to access hibernate docs</div><div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><a href="http://www.dil.univ-mrs.fr/~massat/docs/hibernate-3.1/api/" style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; color: #0b5793; cursor: pointer; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: none; outline-width: initial; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-decoration: none;">http://www.dil.univ-mrs.fr/~massat/docs/hibernate-3.1/api/</a></div></span></div>Ajo (Dev)http://www.blogger.com/profile/11302481405062225663noreply@blogger.com0tag:blogger.com,1999:blog-5876957615554554011.post-79669162050590086122011-09-05T11:44:00.000+05:302012-06-09T15:27:24.608+05:30Sample application for spring with loggingFeatured<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
many people asked me to help them with a sample of spring to know the basic as well as about logging using log4j</div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<br /></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<br /></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
So i have made an application that allows you to get a gist of how both of them work.</div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
Before seeing the code go through the following data:</div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
*********************************************************************</div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
Layout pattern :</div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<br /></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
%d -> date</div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
%p -> priority</div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
%F -> filename</div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
%t -> thread</div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
%c -> class</div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
%L -> line no</div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
%M -> method</div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
%m -> message</div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
%n -> newline character</div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<br /></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
*********************************************************************</div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<br /></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
Steps:</div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
1. create a package my.spring and copy the java files into it</div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
2. paste the applicationContext.xml and the log4j.properties into the source folder but outside the package.</div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
3. Add the requisite jar files as mentioned in the next section.</div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<br /></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
********************************************************************</div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<br /></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
Required jar files:</div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
common-logging.jar</div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
log4j-1.2.11.jar</div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
spring-aop.jar</div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
spring-beans.jar</div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
spring-context-support.jar</div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
spring-context.jar</div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
spring-core.jar</div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
spring-jdbc.jar//optional</div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
spring-jms.jarspring-orm.jar//optional</div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
spring-test.jar</div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
spring-tx.jar//optional</div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
spring-web.jar//optional</div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
spring-webmvc-portlet.jar//optional</div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
spring-webmvc-struts.jar//optional</div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
spring-webmvc.jar//optional</div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
spring.jar</div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<br /></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<br />
The optional jars are to be used in case when the database and web service coding needs to be done</div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
*********************************************************************</div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<br /></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<br /></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<br /></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<br /></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
</div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333; font-family: Arial, Helvetica, sans-serif;"><span class="Apple-style-span" style="font-size: 12px;">//person.java</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333; font-family: Arial, Helvetica, sans-serif;"><span class="Apple-style-span" style="font-size: 12px;"><br />
</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;">package my.spring;</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;"><br />
</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;">import org.apache.log4j.BasicConfigurator;</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;">import org.apache.log4j.Logger;</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;"><br />
</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;">public class Person </span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;">{</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span>static Logger l=Logger.getLogger("my.spring.Person");// creating the logger instance for the the respective class.</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span>String name, address;</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span>// constructor for the sake of constructor injection against setter injection...</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span>public Person()</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span>{<span class="Apple-tab-span" style="white-space: pre;"> </span></span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span>public Person(String name, String address)</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span>{</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span>BasicConfigurator.configure();// for writing the logger values to the console.</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span>l.info("Using constructor injection.");//adding the statements to be printed.</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span>this.name=name;</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span>this.address=address;</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span>/*Getter and Setter function definition for all the data members of the class.*/</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span>public String getName() </span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span>{</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span>return name;</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;"><br />
</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span>public void setName(String name)</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span>{</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span>this.name = name;</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;"><br />
</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span>public String getAddress()</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span>{</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span>return address;</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;"><br />
</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span>public void setAddress(String address) </span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span>{</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span>this.address = address;</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-tab-span" style="font-size: 12px; white-space: pre;"><span class="Apple-style-span" style="color: #333333; font-family: 'Courier New', Courier, monospace;"> </span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;"><br />
</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;">}</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333; font-family: Arial, Helvetica, sans-serif;"><span class="Apple-style-span" style="font-size: 12px;"><br />
</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333; font-family: Arial, Helvetica, sans-serif;"><span class="Apple-style-span" style="font-size: 12px;">//Trainee.java</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333; font-family: Arial, Helvetica, sans-serif;"><span class="Apple-style-span" style="font-size: 12px;"><br />
</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333; font-family: Arial, Helvetica, sans-serif;"><span class="Apple-style-span" style="font-size: 12px;"><br />
</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;">package my.spring;</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;"><br />
</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;">import org.apache.log4j.BasicConfigurator;</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;">import org.apache.log4j.Logger;</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;"><br />
</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;">public class Trainee </span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;">{</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span>static Logger l=Logger.getLogger("my.spring.Trainee");// creating the logger instance for the the respective class.</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span>String eid,post ;</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span>Person person;//object reference to the person class as a data member here</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;">/*Getter and Setter function definition for all the data members of the class.*/</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;"><br />
</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span>public Person getPerson()</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span>{</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span>return person;</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;"><br />
</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span>public void setPerson(Person person)</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span>{</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span>this.person = person;</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;"><br />
</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span>public String getEid() </span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span>{</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span>return eid;</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;"><br />
</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span>public void setEid(String eid) </span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span>{</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span>this.eid = eid;</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;"><br />
</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span>public String getPost()</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span>{</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span>return post;</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;"><br />
</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span>public void setPost(String post) </span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span>{</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span>this.post = post;</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span>public String toString()//overriding of the function to print requisite values..</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span>{</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span>BasicConfigurator.configure();// for writing the logger values to the console.</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span>l.info("Using the overridden toString method.");//adding the statements to be printed.</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span>return "Employee id : "+getEid()+", Employee name :"+getPerson().getName()+", Employee Address : "+getPerson().getAddress()+", Post : "+getPost();</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-tab-span" style="font-size: 12px; white-space: pre;"><span class="Apple-style-span" style="color: #333333; font-family: 'Courier New', Courier, monospace;"> </span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-tab-span" style="font-size: 12px; white-space: pre;"><span class="Apple-style-span" style="color: #333333; font-family: 'Courier New', Courier, monospace;"> </span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;"><br />
</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;">}</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333; font-family: Arial, Helvetica, sans-serif;"><span class="Apple-style-span" style="font-size: 12px;"><br />
</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333; font-family: Arial, Helvetica, sans-serif;"><span class="Apple-style-span" style="font-size: 12px;">//TestMe.java</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333; font-family: Arial, Helvetica, sans-serif;"><span class="Apple-style-span" style="font-size: 12px;"><br />
</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;">package my.spring;</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;"><br />
</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;">import java.io.BufferedReader;</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;">import java.io.IOException;</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;">import java.io.InputStreamReader;</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;"><br />
</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;">import org.apache.log4j.BasicConfigurator;</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;">import org.apache.log4j.Logger;</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;">import org.springframework.beans.factory.BeanFactory;</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;">/*Use below import for ClassPathXmlApplicationContext calling*/</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;">import org.springframework.context.support.ClassPathXmlApplicationContext;</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;">/*Use this import statement for the FileSystemXmlApplicationContext calling..*/</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;">/* import org.springframework.context.support.FileSystemXmlApplicationContext;</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;">*/</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;">public class TestMe </span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;">{</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span>static Logger l=Logger.getLogger("my.spring.TestMe");// creating the logger instance for the the respective class.</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span>public static void main(String args[])</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span>{</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span> BasicConfigurator.configure();// for writing the logger values to the console.</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span>l.info("Started the application");//adding the statements to be printed.</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span>BufferedReader br= new BufferedReader(new InputStreamReader(System.in));</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span>BeanFactory beanfactory = new ClassPathXmlApplicationContext("applicationContext.xml");//Loads the file for parsing and initializing</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span>/*</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span> BeanFactory beanfactory = new FileSystemXmlApplicationContext("C:/Users/Ajo.Koshy/Mage/workspace/SpringTry1/bin/applicationContext.xml");</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span>*/ <span class="Apple-tab-span" style="white-space: pre;"> </span></span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span>Trainee t=(Trainee)beanfactory.getBean("trainee");//Lazy loading of the bean required to be called.</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span>try </span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span>{</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println("Enter your name : ");</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span>t.getPerson().setName(br.readLine());</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span>//Add other properties as required to be added to set.</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span>} </span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span>catch (IOException e) </span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span>{</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span>e.printStackTrace();</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println(t.toString());</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span>l.info("Exiting the application");</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;"><br />
</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;">}</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333; font-family: Arial, Helvetica, sans-serif;"><span class="Apple-style-span" style="font-size: 12px;"><br />
</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333; font-family: Arial, Helvetica, sans-serif;"><span class="Apple-style-span" style="font-size: 12px;">//applicationContext.xml</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333; font-family: Arial, Helvetica, sans-serif;"><span class="Apple-style-span" style="font-size: 12px;"><br />
</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;"><?xml version="1.0" encoding="UTF-8"?></span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;"><beans xmlns="http://www.springframework.org/schema/beans"</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;">xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;">xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"></span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;"><!--Bean 1--></span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span><bean id="trainee" class="my.spring.Trainee"></span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span><property name="eid" value="300695"/></span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span><property name="post" value="Software Engineer"/></span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span><property name="person" ><ref bean="person"/></span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span></property></span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span></bean></span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span><!--Bean 2 as reference to a value of Bean 1 --></span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span><bean id="person" class="my.spring.Person"></span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span><!--Uncomment the following for dependency injection--></span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span><!--<property name="name" value="Ajo Koshy"/></span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span><property name="address" value="Noida"/></span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span>--><!--This can be used for constructor setting--></span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span><constructor-arg index="0" value="Ajo Koshy"/></span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span><constructor-arg index="1" value="Noida"/></span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span></bean></span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;"></beans></span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333; font-family: Arial, Helvetica, sans-serif;"><span class="Apple-style-span" style="font-size: 12px;"><br />
</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333; font-family: Arial, Helvetica, sans-serif;"><span class="Apple-style-span" style="font-size: 12px;"><br />
</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333; font-family: Arial, Helvetica, sans-serif;"><span class="Apple-style-span" style="font-size: 12px;">//log4j.properties</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333; font-family: Arial, Helvetica, sans-serif;"><span class="Apple-style-span" style="font-size: 12px;"><br />
</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333; font-family: Arial, Helvetica, sans-serif;"><span class="Apple-style-span" style="font-size: 12px;"><br />
</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333; font-family: Arial, Helvetica, sans-serif;"><span class="Apple-style-span" style="font-size: 12px;"><br />
</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;">log4j.appender.rollingFile=org.apache.log4j.RollingFileAppender</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;">log4j.appender.Trainee=org.apache.log4j.RollingFileAppender</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;">log4j.appender.Person=org.apache.log4j.RollingFileAppender</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;">log4j.appender.TestMe=org.apache.log4j.RollingFileAppender</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;">log4j.appender.rollingFile.File=C:/mylog.log</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;">log4j.appender.rollingFile.MaxFileSize=2MB</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;">log4j.appender.rollingFile.MaxBackupIndex=2</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;">log4j.appender.rollingFile.layout = org.apache.log4j.PatternLayout</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;">log4j.appender.rollingFile.layout.ConversionPattern=*Calling from line no %L* [%d] (%p) %F %t %c {%M}- %m%n</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;">log4j.appender.Trainee.File=C:/Traineelog.log</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;">log4j.appender.Trainee.MaxFileSize=2MB</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;">log4j.appender.Trainee.MaxBackupIndex=2</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;">log4j.appender.Trainee.layout = org.apache.log4j.PatternLayout</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;">log4j.appender.Trainee.layout.ConversionPattern=*Calling from line no %L* [%d](%p) %F %t %c {%M}- %m%n</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;">log4j.appender.Person.File=C:/Personlog.log</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;">log4j.appender.Person.MaxFileSize=2MB</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;">log4j.appender.Person.MaxBackupIndex=2</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;">log4j.appender.Person.layout = org.apache.log4j.PatternLayout</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;">log4j.appender.Person.layout.ConversionPattern=*Calling from line no %L* [%d](%p) %F %t %c {%M}- %m%n</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;">log4j.appender.TestMe.File=C:/TestMelog.log</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;">log4j.appender.TestMe.MaxFileSize=2MB</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;">log4j.appender.TestMe.MaxBackupIndex=2</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;">log4j.appender.TestMe.layout = org.apache.log4j.PatternLayout</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;">log4j.appender.TestMe.layout.ConversionPattern=*Calling from line no %L* [%d](%p) %F %t %c {%M}- %m%n</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;">log4j.category.my.spring.TestMe = INFO, TestMe</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;">log4j.category.my.spring.Person = INFO, Person</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;">log4j.category.my.spring.Trainee = INFO, Trainee</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: 12px;">log4j.rootLogger = INFO, rollingFile</span></span></div>
<div style="border-style: none; border-width: 0px; color: #333333; font-size: 12px; margin: 0px; padding: 0px;">
<span style="font-family: 'Courier New', Courier, monospace;"><br /></span></div>
<br /></div>Ajo (Dev)http://www.blogger.com/profile/11302481405062225663noreply@blogger.com22tag:blogger.com,1999:blog-5876957615554554011.post-61970732096326817962011-09-05T11:42:00.000+05:302012-05-24T16:30:37.525+05:30exploring event.keycode in javascript<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
Sets or retrieves the Unicode key code associated with the key that caused the event.</div>
<div class="input" style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<strong>Syntax</strong></div>
<blockquote style="color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px;">
<div class="LW_CodeSnippetContainer" style="zoom: 1;">
<a href="http://www.blogger.com/post-create.g?blogID=5876957615554554011" style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; color: #0b5793; cursor: pointer; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: none; outline-width: initial; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-decoration: none;"></a> <br />
<div class="LW_CodeSnippetContainerCodeCollection" style="zoom: 1;">
<div class="LW_CodeSnippetContainerCode" id="CodeSnippetContainerCode0" style="zoom: 1;">
<div style="zoom: 1;">
<pre style="background-attachment: initial; background-clip: initial; background-color: #fafaff; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-color: rgb(238, 238, 238); border-bottom-style: solid; border-bottom-width: 1px; border-left-color: rgb(238, 238, 238); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(238, 238, 238); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(238, 238, 238); border-top-style: solid; border-top-width: 1px; font-family: 'Courier New', Courier, monospace; font-size: 11px; font: inherit; outline-color: initial; outline-style: none; outline-width: initial; white-space: pre;">[ sKeyCode = ] object.keyCode
</pre>
</div>
</div>
</div>
</div>
</blockquote>
<div class="input" style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<strong>Possible Values</strong></div>
<blockquote style="color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px;">
<span class="clsRange">sKeyCode</span> <strong>Integer</strong> that specifies or receives the Unicode key code. <br />
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
The property is read/write. The property has no default value.</div>
</blockquote>
<div class="input" style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<strong>Remarks</strong></div>
<blockquote style="color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px;">
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
The property is used with the onkeydown, onkeyup and onkeypress events.</div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
The property's value is 0 if no key caused the event.</div>
</blockquote>
<div class="input" style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<strong>Standards Information</strong></div>
<blockquote style="color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px;">
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
There is no public standard that applies to this property.</div>
</blockquote>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<br /></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<br /></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
For more info you can visit:</div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<a href="http://www.webonweboff.com/tips/js/event_key_codes.aspx" style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; color: #0b5793; cursor: pointer; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: none; outline-width: initial; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-decoration: none;">http://www.webonweboff.com/tips/js/event_key_codes.aspx</a></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<br /></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<a href="http://unixpapa.com/js/key.html" style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; color: #0b5793; cursor: pointer; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: none; outline-width: initial; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-decoration: none;">http://unixpapa.com/js/key.html</a></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<br /></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
for a demo of the same download the following file.. the source is in the html </div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<br /></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<br /></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<br /></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="background-color: #fff2cc;"><br />
</span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="background-color: #fff2cc;"><br />
</span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
</div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="background-color: white; font-family: 'Courier New', Courier, monospace; font-size: 12px;"><!--var keyCode = event.keyCode ? event.keyCode : event.which ? event.which : event.charCode;</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="background-color: white; font-family: 'Courier New', Courier, monospace; font-size: 12px;"><br />
</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="background-color: white; font-family: 'Courier New', Courier, monospace; font-size: 12px;">/*</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="background-color: white; font-family: 'Courier New', Courier, monospace; font-size: 12px;"> *</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="background-color: white; font-family: 'Courier New', Courier, monospace; font-size: 12px;"> *var someVar = (...some condition to check...) ? valueIfTrue : valueIfFalse;</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="background-color: white; font-family: 'Courier New', Courier, monospace; font-size: 12px;"> *</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="background-color: white; font-family: 'Courier New', Courier, monospace; font-size: 12px;"> *the syntax has some extra details I'm not much familiar with.</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="background-color: white; font-family: 'Courier New', Courier, monospace; font-size: 12px;"> *</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="background-color: white; font-family: 'Courier New', Courier, monospace; font-size: 12px;"> *That's a compound statement - it uses two, nested, ternary operators. It's clearer when you add parentheses:</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="background-color: white; font-family: 'Courier New', Courier, monospace; font-size: 12px;"> *</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="background-color: white; font-family: 'Courier New', Courier, monospace; font-size: 12px;"> *So if the first test (event.keyCode) fails, the second value is used, which is itself the result of another ternary operator. If the second test (event.which) fails, the final value (event.charCode) is used.</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="background-color: white; font-family: 'Courier New', Courier, monospace; font-size: 12px;"> *priority wise:</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="background-color: white; font-family: 'Courier New', Courier, monospace; font-size: 12px;"> *event.keyCode>event.which>event.charCode</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="background-color: white; font-family: 'Courier New', Courier, monospace; font-size: 12px;"> *</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="background-color: white; font-family: 'Courier New', Courier, monospace; font-size: 12px;">*/</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="background-color: white; font-family: 'Courier New', Courier, monospace; font-size: 12px;"><br />
</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="background-color: white; font-family: 'Courier New', Courier, monospace; font-size: 12px;">var keyCode = (event.keyCode ? event.keyCode : (event.which ? event.which : event.charCode));</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="background-color: white; font-family: 'Courier New', Courier, monospace; font-size: 12px;"><br />
</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="background-color: white; font-family: 'Courier New', Courier, monospace; font-size: 12px;">/*</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="background-color: white; font-family: 'Courier New', Courier, monospace; font-size: 12px;"> *</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="background-color: white; font-family: 'Courier New', Courier, monospace; font-size: 12px;"> *For a demo of this pls paste the following code:</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="background-color: white; font-family: 'Courier New', Courier, monospace; font-size: 12px;"> *Save as KeyCode.html and run.... :)</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="background-color: white; font-family: 'Courier New', Courier, monospace; font-size: 12px;"> *</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="background-color: white; font-family: 'Courier New', Courier, monospace; font-size: 12px;">*/</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="background-color: white; font-family: 'Courier New', Courier, monospace; font-size: 12px;">--></span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="background-color: white; font-family: 'Courier New', Courier, monospace; font-size: 12px;"><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> </span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="background-color: white; font-family: 'Courier New', Courier, monospace; font-size: 12px;"><html> </span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="background-color: white; font-family: 'Courier New', Courier, monospace; font-size: 12px;"><head> </span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="background-color: white; font-family: 'Courier New', Courier, monospace; font-size: 12px;"><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> </span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="background-color: white; font-family: 'Courier New', Courier, monospace; font-size: 12px;"><title>JavaScript Event KeyCode Test Page</title> </span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="background-color: white; font-family: 'Courier New', Courier, monospace; font-size: 12px;"><script type="text/javascript"> </span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="background-color: white; font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span>focusInput = function()</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="background-color: white; font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span>{</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="background-color: white; font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span>document.getElementById("input").focus();</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="background-color: white; font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span>};</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-tab-span" style="font-size: 12px; white-space: pre;"><span class="Apple-style-span" style="background-color: white; color: #333333; font-family: 'Courier New', Courier, monospace;"> </span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="background-color: white; font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span>clear = function()</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="background-color: white; font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span>{</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="background-color: white; font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span>var eventTypes = ["onkeydown", "onkeypress", "onkeyup"];</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="background-color: white; font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span>var codeTypes = ["keycode", "charcode", "which"];</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="background-color: white; font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span>for(var event = 0; event < eventTypes.length; event++)</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="background-color: white; font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span>{</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="background-color: white; font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span>for(var code = 0; code < codeTypes.length; code++)</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="background-color: white; font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span>{</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="background-color: white; font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span>var element = document.getElementById(eventTypes[event] + "_" + codeTypes[code]);</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="background-color: white; font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span>while (element.firstChild != null)</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="background-color: white; font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span>{</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="background-color: white; font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span>element.removeChild(element.firstChild);</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="background-color: white; font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="background-color: white; font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="background-color: white; font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="background-color: white; font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span>};</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-tab-span" style="font-size: 12px; white-space: pre;"><span class="Apple-style-span" style="background-color: white; color: #333333; font-family: 'Courier New', Courier, monospace;"> </span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="background-color: white; font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span>processKeyEvent = function(eventType, event)</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="background-color: white; font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span>{</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="background-color: white; font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span>if (window.event)</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="background-color: white; font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span>{</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="background-color: white; font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span>event = window.event;</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="background-color: white; font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-tab-span" style="font-size: 12px; white-space: pre;"><span class="Apple-style-span" style="background-color: white; color: #333333; font-family: 'Courier New', Courier, monospace;"> </span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="background-color: white; font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span>var element = document.getElementById(eventType + "_keycode");</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="background-color: white; font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span>var text = document.createTextNode("'" + event.keyCode + "'");</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="background-color: white; font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span>element.appendChild(text);</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-tab-span" style="font-size: 12px; white-space: pre;"><span class="Apple-style-span" style="background-color: white; color: #333333; font-family: 'Courier New', Courier, monospace;"> </span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="background-color: white; font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span>element = document.getElementById(eventType + "_charcode");</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="background-color: white; font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span>text = document.createTextNode("'" + event.charCode + "'");</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="background-color: white; font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span>element.appendChild(text);</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-tab-span" style="font-size: 12px; white-space: pre;"><span class="Apple-style-span" style="background-color: white; color: #333333; font-family: 'Courier New', Courier, monospace;"> </span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="background-color: white; font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span>element = document.getElementById(eventType + "_which");</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="background-color: white; font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span>text = document.createTextNode("'" + event.which + "'");</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="background-color: white; font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span>element.appendChild(text);</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="background-color: white; font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span>};</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-tab-span" style="font-size: 12px; white-space: pre;"><span class="Apple-style-span" style="background-color: white; color: #333333; font-family: 'Courier New', Courier, monospace;"> </span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="background-color: white; font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span>processKeyDown = function(event)</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="background-color: white; font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span>{</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="background-color: white; font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span>clear();</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="background-color: white; font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span>processKeyEvent("onkeydown", event);</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="background-color: white; font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span>};</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span style="background-color: white;"><span style="font-family: 'Courier New', Courier, monospace;"><br /></span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="background-color: white; font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span>processKeyPress = function(event)</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="background-color: white; font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span>{</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="background-color: white; font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span>processKeyEvent("onkeypress", event);</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="background-color: white; font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span>};</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span style="background-color: white;"><span style="font-family: 'Courier New', Courier, monospace;"><br /></span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="background-color: white; font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span>processKeyUp = function(event)</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="background-color: white; font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span>{</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="background-color: white; font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span>processKeyEvent("onkeyup", event);</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="background-color: white; font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span>};</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="background-color: white; font-family: 'Courier New', Courier, monospace; font-size: 12px;"></script> </span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="background-color: white; font-family: 'Courier New', Courier, monospace; font-size: 12px;"></head> </span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="background-color: white; font-family: 'Courier New', Courier, monospace; font-size: 12px;"><body> </span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="background-color: white; font-family: 'Courier New', Courier, monospace; font-size: 12px;"><marquee></span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="background-color: white; font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span><h1>Dark Mage</h1> </span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="background-color: white; font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span></marquee></span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="background-color: white; font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span><p>Input: <input id="input" type="text" value=""/></p> </span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="background-color: white; font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span><table border="1" align="center"> </span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="background-color: white; font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span><thead> </span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="background-color: white; font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span><tr> </span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="background-color: white; font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span><th></th> </span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="background-color: white; font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span><th>onKeyDown</th> </span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="background-color: white; font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span><th>onKeyPress</th> </span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="background-color: white; font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span><th>onKeyUp</th> </span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="background-color: white; font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span></tr> </span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="background-color: white; font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span></thead> </span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="background-color: white; font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span><tr> </span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="background-color: white; font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span><th>event.keyCode</th> </span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="background-color: white; font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span><TD id="onkeydown_keycode"></td> </span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="background-color: white; font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span><td id="onkeypress_keycode"></td> </span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="background-color: white; font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span><td id="onkeyup_keycode"></td> </span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="background-color: white; font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span></tr> </span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="background-color: white; font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span><tr> </span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="background-color: white; font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span><th>event.charCode</th> </span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="background-color: white; font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span><td id="onkeydown_charcode"></td> </span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="background-color: white; font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span><td id="onkeypress_charcode"></td> </span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="background-color: white; font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span><td id="onkeyup_charcode"></td> </span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="background-color: white; font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span></tr> </span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="background-color: white; font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span><tr> </span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="background-color: white; font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span><th>event.which</th> </span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="background-color: white; font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span><td id="onkeydown_which"></td> </span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="background-color: white; font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span><td id="onkeypress_which"></td> </span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="background-color: white; font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span><td id="onkeyup_which"></td> </span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="background-color: white; font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span></tr> </span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="background-color: white; font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span></table> </span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="background-color: white; font-family: 'Courier New', Courier, monospace; font-size: 12px;"><script> </span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="background-color: white; font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span>window.onload=focusInput;</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="background-color: white; font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span>document.getElementById("input").onkeydown=processKeyDown;</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="background-color: white; font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span>document.getElementById("input").onkeypress=processKeyPress;</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="background-color: white; font-family: 'Courier New', Courier, monospace; font-size: 12px;"><span class="Apple-tab-span" style="white-space: pre;"> </span>document.getElementById("input").onkeyup=processKeyUp;</span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="background-color: white; font-family: 'Courier New', Courier, monospace; font-size: 12px;"></script> </span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="background-color: white; font-family: 'Courier New', Courier, monospace; font-size: 12px;"></body> </span></span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span class="Apple-style-span" style="color: #333333;"><span class="Apple-style-span" style="background-color: white; font-family: 'Courier New', Courier, monospace; font-size: 12px;"></html> </span></span></div>
<br /></div>Ajo (Dev)http://www.blogger.com/profile/11302481405062225663noreply@blogger.com0tag:blogger.com,1999:blog-5876957615554554011.post-15236128021201760562011-08-29T17:05:00.000+05:302012-06-09T15:28:29.563+05:30Hibernate<div dir="ltr" style="text-align: left;" trbidi="on">
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"></span><br />
<div class="post_cont" style="border-bottom-color: rgb(225, 225, 225); border-bottom-style: solid; border-bottom-width: 1px; border-left-color: rgb(225, 225, 225); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(225, 225, 225); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(225, 225, 225); border-top-style: solid; border-top-width: 1px; padding-bottom: 4px; padding-left: 4px; padding-right: 4px; padding-top: 4px; zoom: 1;">
<div class="inner_cont" style="background-color: #f1f5fa; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; padding-top: 5px; zoom: 1;">
<div class="post" style="float: left; width: 657px; zoom: 1;">
<div class="posted_by" style="color: #888888; font-size: 11px; zoom: 1;">
<br /></div>
<div class="posted_by" style="zoom: 1;">
<span class="Apple-style-span" style="font-size: x-small;">The required jar files are</span></div>
<div class="post_body wordwrap" style="color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; overflow-x: hidden; overflow-y: hidden; padding-bottom: 10px; padding-left: 0px; padding-right: 0px; padding-top: 10px; word-wrap: break-word; zoom: 1;">
<ul style="list-style-image: none; list-style-position: outside; list-style-type: disc; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 5px; padding-left: 18px; padding-right: 5px; padding-top: 5px;">
<li>asm.jar</li>
</ul>
<ul style="list-style-image: none; list-style-position: outside; list-style-type: disc; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 5px; padding-left: 18px; padding-right: 5px; padding-top: 5px;">
<li>commons-collections-2.1.1.jar</li>
</ul>
<ul style="list-style-image: none; list-style-position: outside; list-style-type: disc; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 5px; padding-left: 18px; padding-right: 5px; padding-top: 5px;">
<li>commons-logging-1.0.4.jar</li>
</ul>
<ul style="list-style-image: none; list-style-position: outside; list-style-type: disc; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 5px; padding-left: 18px; padding-right: 5px; padding-top: 5px;">
<li>cglib-2.1.3.jar</li>
</ul>
<ul style="list-style-image: none; list-style-position: outside; list-style-type: disc; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 5px; padding-left: 18px; padding-right: 5px; padding-top: 5px;">
<li>dom4j-1.6.1.jar</li>
</ul>
<ul style="list-style-image: none; list-style-position: outside; list-style-type: disc; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 5px; padding-left: 18px; padding-right: 5px; padding-top: 5px;">
<li>ehcache-1.6.0-beta1.jar</li>
</ul>
<ul style="list-style-image: none; list-style-position: outside; list-style-type: disc; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 5px; padding-left: 18px; padding-right: 5px; padding-top: 5px;">
<li>hibernate3.jar</li>
</ul>
<ul style="list-style-image: none; list-style-position: outside; list-style-type: disc; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 5px; padding-left: 18px; padding-right: 5px; padding-top: 5px;">
<li>jta.jar</li>
</ul>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<br /></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
Put all the xml files in the source folder outside the created package.</div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<br /></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
Mention the class and default values properly</div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<br /></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
in the configuration to create session factory add the xml in case it is not detected directly.</div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<br /></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<br /></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
SessionFactory sf=new Configuration().configure("hibernate.cfg.xml").buildSessionFactory();</div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<br /></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<br /></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
Also checkout the following example</div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<br /></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<br /></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
Happy hibernating:)</div>
</div>
<div class="interest_block" style="color: #333333; font-size: 11px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 15px; zoom: 1;">
<div class="interest_number" style="padding-bottom: 3px; padding-left: 2px; padding-right: 0px; padding-top: 0px; zoom: 1;">
<span class="Apple-style-span" style="font-size: 12px;">//DataEntry.java</span></div>
</div>
</div>
</div>
</div>
<div class="comment_block" style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: #333333; font-size: 11px; margin-top: 25px; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; padding-top: 5px; zoom: 1;">
<div class="comment_list comment_list_bottom" style="border-top-color: rgb(231, 231, 231); border-top-style: solid; border-top-width: 1px; zoom: 1;">
<div class="comment_entry" style="border-bottom-color: rgb(231, 231, 231); border-bottom-style: solid; border-bottom-width: 1px; padding-bottom: 6px; padding-left: 4px; padding-right: 4px; padding-top: 6px; zoom: 1;">
<div class="comment down" style="float: left; width: 659px; zoom: 1;">
<div class="comment_body wordwrap" style="font-size: 12px; overflow: hidden; padding: 7px 0px; word-wrap: break-word; zoom: 1;">
<div style="border-style: none; border-width: 0px; margin: 0px; padding: 0px;">
<span style="font-family: 'Courier New', Courier, monospace;">/*****************************************************************************</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> * In this program we are trying to applying the one-to-many relationship in</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> * both the ways.</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> * Concept:</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> * Trinaers can take multiple technologies</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> * A technology can be taken by multiple Trainers</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> *</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> * Through this application you can check how the logic works for one-to-many</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> * in both ways but its not suitable for actual implementation because this</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> * application creats two tables only - TRAINER and TECHNOLOGY.</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> *</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> * After running this application you will found that there is problem with</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> * inserting of new record next time.</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> * To resolve this problem you can convert this application to many-to-many.</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> *</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> */</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><br /></span><br />
<span style="font-family: 'Courier New', Courier, monospace;">package ajo.hib;</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><br /></span><br />
<span style="font-family: 'Courier New', Courier, monospace;">import java.io.BufferedReader;</span><br />
<span style="font-family: 'Courier New', Courier, monospace;">import java.io.IOException;</span><br />
<span style="font-family: 'Courier New', Courier, monospace;">import java.io.InputStreamReader;</span><br />
<span style="font-family: 'Courier New', Courier, monospace;">import java.util.HashSet;</span><br />
<span style="font-family: 'Courier New', Courier, monospace;">import java.util.Set;</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><br /></span><br />
<span style="font-family: 'Courier New', Courier, monospace;">import org.hibernate.*;</span><br />
<span style="font-family: 'Courier New', Courier, monospace;">import org.hibernate.cfg.Configuration;</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><br /></span><br />
<span style="font-family: 'Courier New', Courier, monospace;">public class DataEntry {</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> public static void main(String[] args)throws IOException {</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> int i;</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> BufferedReader br=new BufferedReader(new InputStreamReader(System.in));</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> System.out.println("2.insert 3.delete 1.update\n Enter your choice: ");</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> i=Integer.parseInt(br.readLine());</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> Employee e= new Employee(); e.setEmpId("E102");</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> </span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> EmployeeDAO ed= new EmployeeDAO();</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> </span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> switch(i)</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> {</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> </span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> case 1:</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> //for update</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> ed.update(e);</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> break;</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> </span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> case 2:</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> // for insert operation</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> //Employee e = new Employee();</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> e.setEmpId("E102");</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> e.setEmpName("Mahesh");</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><br /></span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> //EmployeeDAO ed = new EmployeeDAO();</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><br /></span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> ed.insert(e);</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> break;</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> case 3:</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> //for delete</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> e.setEmpId("E102");</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> </span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> EmployeeDAO eDAO= new EmployeeDAO();</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> </span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> eDAO.delete(e);</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> break;</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> default:</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> System.out.println("Invalid");</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> break;</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> }</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> }</span><br />
<span style="font-family: 'Courier New', Courier, monospace;">}</span></div>
<div style="border-style: none; border-width: 0px; font-family: Arial, Helvetica, sans-serif; margin: 0px; padding: 0px;">
<br /></div>
<div style="border-style: none; border-width: 0px; font-family: Arial, Helvetica, sans-serif; margin: 0px; padding: 0px;">
//EmployeeDAO.java</div>
<div style="border-style: none; border-width: 0px; margin: 0px; padding: 0px;">
<span style="font-family: 'Courier New', Courier, monospace;">package ajo.hib;</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><br /></span><br />
<span style="font-family: 'Courier New', Courier, monospace;">import org.hibernate.Session;</span><br />
<span style="font-family: 'Courier New', Courier, monospace;">import org.hibernate.SessionFactory;</span><br />
<span style="font-family: 'Courier New', Courier, monospace;">import org.hibernate.Transaction;</span><br />
<span style="font-family: 'Courier New', Courier, monospace;">import org.hibernate.cfg.Configuration;</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><br /></span><br />
<span style="font-family: 'Courier New', Courier, monospace;">public class EmployeeDAO implements IEmployeeDAO {</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><br /></span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> public void insert(Employee e)</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> {</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> SessionFactory sf=new Configuration().configure("hibernate.cfg.xml").buildSessionFactory();</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> Session ses= sf.openSession();</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> Transaction tr= ses.beginTransaction();</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> </span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> </span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> ses.save(e);</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> //e.setEmpName("rajeev"); // update statement gets fired for this</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> tr.commit();</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><br /></span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> }</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> </span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> public void update(Employee e)</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> {</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> SessionFactory sf=new Configuration().configure("hibernate.cfg.xml").buildSessionFactory();</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> Session ses= sf.openSession();</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> Transaction tr= ses.beginTransaction();</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> </span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> e=(Employee) ses.load("ajo.hib.Employee", e.getEmpId());</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> </span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> e.setEmpName("Ajo");</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> </span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> System.out.println(e);</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> </span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> ses.save(e);</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> //ses.refresh(e);</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> tr.commit();</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> System.out.println(e);</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> }</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> public void delete(Employee e)</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> {</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> SessionFactory sf=new Configuration().configure("hibernate.cfg.xml").buildSessionFactory();</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> Session ses= sf.openSession();</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> Transaction tr= ses.beginTransaction();</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> </span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> e=(Employee) ses.load("ajo.hib.Employee", e.getEmpId());</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> System.out.println(e);</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> ses.delete(e);</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> tr.commit();</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> System.out.println(e);</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> }</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> </span><br />
<span style="font-family: 'Courier New', Courier, monospace;">}</span></div>
<div style="border-style: none; border-width: 0px; font-family: Arial, Helvetica, sans-serif; margin: 0px; padding: 0px;">
//IEmployeeDAO.java</div>
<div style="border-style: none; border-width: 0px; margin: 0px; padding: 0px;">
<span style="font-family: 'Courier New', Courier, monospace;"><br /></span></div>
<div style="border-style: none; border-width: 0px; margin: 0px; padding: 0px;">
<span style="font-family: 'Courier New', Courier, monospace;">package ajo.hib;</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><br /></span><br />
<span style="font-family: 'Courier New', Courier, monospace;">public interface IEmployeeDAO {</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><br /></span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> public void update(Employee e);</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> public void insert(Employee e);</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> public void delete(Employee e);</span><br />
<span style="font-family: 'Courier New', Courier, monospace;">}</span></div>
<div style="border-style: none; border-width: 0px; margin: 0px; padding: 0px;">
<span style="font-family: 'Courier New', Courier, monospace;"><br /></span></div>
<div style="border-style: none; border-width: 0px; margin: 0px; padding: 0px;">
<span style="font-family: 'Courier New', Courier, monospace;">//Employee.java</span></div>
<div style="border-style: none; border-width: 0px; margin: 0px; padding: 0px;">
<span style="font-family: 'Courier New', Courier, monospace;"><br /></span></div>
<div style="border-style: none; border-width: 0px; margin: 0px; padding: 0px;">
<span style="font-family: 'Courier New', Courier, monospace;">package ajo.hib;</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><br /></span><br />
<span style="font-family: 'Courier New', Courier, monospace;">public class Employee</span><br />
<span style="font-family: 'Courier New', Courier, monospace;">{</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> String empName;</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> String empId;</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> public String getEmpName() {</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> return empName;</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> }</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> public void setEmpName(String empName) {</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> this.empName = empName;</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> }</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> public String getEmpId() {</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> return empId;</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> }</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> public void setEmpId(String empId) {</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> this.empId = empId;</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> }</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> </span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> @Override</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> public String toString() {</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> // TODO Auto-generated method stub</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> return " Employee ID : "+empId + " Name : "+empName;</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> }</span><br />
<span style="font-family: 'Courier New', Courier, monospace;">}</span></div>
<div style="border-style: none; border-width: 0px; font-family: Arial, Helvetica, sans-serif; margin: 0px; padding: 0px;">
<br /></div>
<div style="border-style: none; border-width: 0px; font-family: Arial, Helvetica, sans-serif; margin: 0px; padding: 0px;">
//employee.hbm.xml</div>
<div style="border-style: none; border-width: 0px; margin: 0px; padding: 0px;">
<span style="font-family: 'Courier New', Courier, monospace;"><?xml version="1.0" encoding="UTF-8"?></span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><!DOCTYPE hibernate-mapping PUBLIC "-//hibernate/hibernate Mapping DTD 3.0//EN"</span><br />
<span style="font-family: 'Courier New', Courier, monospace;">"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"></span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><hibernate-mapping></span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> <class name="ajo.hib.Employee" table="empl"></span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> <id name="empId" column="EMPLOYEE_ID"></span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> <generator class="assigned"/></span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> </id></span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> <property name="empName"/></span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> </class></span><br />
<span style="font-family: 'Courier New', Courier, monospace;"></hibernate-mapping></span></div>
<div style="border-style: none; border-width: 0px; font-family: Arial, Helvetica, sans-serif; margin: 0px; padding: 0px;">
<br /></div>
<div style="border-style: none; border-width: 0px; font-family: Arial, Helvetica, sans-serif; margin: 0px; padding: 0px;">
//hibernate.cfg.xml</div>
<div style="border-style: none; border-width: 0px; font-family: Arial, Helvetica, sans-serif; margin: 0px; padding: 0px;">
<br /></div>
<div style="border-style: none; border-width: 0px; margin: 0px; padding: 0px;">
<span style="font-family: 'Courier New', Courier, monospace;"><?xml version="1.0" encoding="UTF-8"?></span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><!DOCTYPE hibernate-configuration PUBLIC "-//hibernate/hibernate Configuration DTD//EN"</span><br />
<span style="font-family: 'Courier New', Courier, monospace;">"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"></span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><br /></span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><hibernate-configuration></span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> <session-factory></span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> <property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property></span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> <property name="hibernate.connection.url">jdbc:mysql://localhost/test</property></span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> <property name="hibernate.connection.username">root</property></span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> <property name="hibernate.connection.password">admin1234</property></span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> <property name="hibernate.connection.pool_size">1</property></span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> <property name="dialect">org.hibernate.dialect.MySQLDialect</property></span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> <property name="hibernate.show_sql">true</property></span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> <property name="hibernate.hbm2ddl.auto">update</property></span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> <mapping resource="employee.hbm.xml"/></span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> </session-factory></span><br />
<span style="font-family: 'Courier New', Courier, monospace;"></hibernate-configuration></span></div>
</div>
</div>
</div>
</div>
</div>
</div>Ajo (Dev)http://www.blogger.com/profile/11302481405062225663noreply@blogger.com3tag:blogger.com,1999:blog-5876957615554554011.post-79306818622581739462011-08-29T16:56:00.000+05:302012-06-09T15:28:59.203+05:30sorting using comparator and comparable<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
<span class="Apple-style-span" style="color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11px;"></span><br />
<div class="post_body wordwrap" style="font-size: 12px; overflow: hidden; padding: 10px 0px; word-wrap: break-word; zoom: 1;">
<div style="border-style: none; border-width: 0px; font-family: Arial, Helvetica, sans-serif; margin: 0px; padding: 0px;">
People have problem in sorting class objects</div>
<div style="border-style: none; border-width: 0px; font-family: Arial, Helvetica, sans-serif; margin: 0px; padding: 0px;">
<br /></div>
<div style="border-style: none; border-width: 0px; font-family: Arial, Helvetica, sans-serif; margin: 0px; padding: 0px;">
<br /></div>
<div style="border-style: none; border-width: 0px; font-family: Arial, Helvetica, sans-serif; margin: 0px; padding: 0px;">
here is a way to do that</div>
<div style="border-style: none; border-width: 0px; font-family: Arial, Helvetica, sans-serif; margin: 0px; padding: 0px;">
<br /></div>
<div style="border-style: none; border-width: 0px; font-family: Arial, Helvetica, sans-serif; margin: 0px; padding: 0px;">
<br /></div>
<div style="border-style: none; border-width: 0px; font-family: Arial, Helvetica, sans-serif; margin: 0px; padding: 0px;">
have attached some code for example</div>
<div style="border-style: none; border-width: 0px; font-family: Arial, Helvetica, sans-serif; margin: 0px; padding: 0px;">
<br /></div>
<div style="border-style: none; border-width: 0px; font-family: Arial, Helvetica, sans-serif; margin: 0px; padding: 0px;">
<br /></div>
<div style="border-style: none; border-width: 0px; font-family: Arial, Helvetica, sans-serif; margin: 0px; padding: 0px;">
i think its self explanatory</div>
<div style="border-style: none; border-width: 0px; font-family: Arial, Helvetica, sans-serif; margin: 0px; padding: 0px;">
<br /></div>
<div style="border-style: none; border-width: 0px; font-family: Arial, Helvetica, sans-serif; margin: 0px; padding: 0px;">
<br /></div>
<div style="border-style: none; border-width: 0px; font-family: Arial, Helvetica, sans-serif; margin: 0px; padding: 0px;">
<br /></div>
<div style="border-style: none; border-width: 0px; font-family: Arial, Helvetica, sans-serif; margin: 0px; padding: 0px;">
public class Employee {<br />
private int empId;<br />
private String name;<br />
private int age;<br />
<br />
public Employee(int empId, String name, int age) {<br />
// set values on attributes<br />
}<br />
// getters & setters<br />
}<br />
<br />
<br />
*************************************************<br />
<br />
<br />
import java.util.*;<br />
<br />
public class Util {<br />
<br />
public static List<Employee> getEmployees() {<br />
<br />
List<Employee> col = new ArrayList<Employee>();<br />
<br />
col.add(new Employee(5, "Frank", 28));<br />
col.add(new Employee(1, "Jorge", 19));<br />
col.add(new Employee(6, "Bill", 34));<br />
col.add(new Employee(3, "Michel", 10));<br />
col.add(new Employee(7, "Simpson", 8));<br />
col.add(new Employee(4, "Clerk",16 ));<br />
col.add(new Employee(8, "Lee", 40));<br />
col.add(new Employee(2, "Mark", 30));<br />
<br />
return col;<br />
}<br />
}<br />
<br />
**********************************************<br />
<br />
public class Employee implements Comparable<Employee> {<br />
private int empId;<br />
private String name;<br />
private int age;<br />
<br />
/**<br />
* Compare a given Employee with this object.<br />
* If employee id of this object is<br />
* greater than the received object,<br />
* then this object is greater than the other.<br />
*/<br />
public int compareTo(Employee o) {<br />
return this.empId - o.empId ;<br />
}<br />
….<br />
}<br />
<br />
************************************************************<br />
<br />
<br />
import java.util.*;<br />
<br />
public class TestEmployeeSort {<br />
<br />
public static void main(String[] args) { <br />
List coll = Util.getEmployees();<br />
Collections.sort(coll); // sort method<br />
printList(coll);<br />
}<br />
<br />
private static void printList(List<Employee> list) {<br />
System.out.println("EmpId\tName\tAge");<br />
for (Employee e: list) {<br />
System.out.println(e.getEmpId() + "\t" + e.getName() + "\t" + e.getAge());<br />
}<br />
}<br />
}</div>
<div style="border-style: none; border-width: 0px; font-family: Arial, Helvetica, sans-serif; margin: 0px; padding: 0px;">
<br /></div>
<div style="border-style: none; border-width: 0px; font-family: Arial, Helvetica, sans-serif; margin: 0px; padding: 0px;">
<br /></div>
<div style="border-style: none; border-width: 0px; font-family: Arial, Helvetica, sans-serif; margin: 0px; padding: 0px;">
<br /></div>
<div style="border-style: none; border-width: 0px; font-family: Arial, Helvetica, sans-serif; margin: 0px; padding: 0px;">
<br /></div>
<div style="border-style: none; border-width: 0px; font-family: Arial, Helvetica, sans-serif; margin: 0px; padding: 0px;">
<br /></div>
<div style="border-style: none; border-width: 0px; font-family: Arial, Helvetica, sans-serif; margin: 0px; padding: 0px;">
<br /></div>
<div style="border-style: none; border-width: 0px; font-family: Arial, Helvetica, sans-serif; margin: 0px; padding: 0px;">
<br /></div>
<div style="border-style: none; border-width: 0px; font-family: Arial, Helvetica, sans-serif; margin: 0px; padding: 0px;">
<br /></div>
<div style="border-style: none; border-width: 0px; font-family: Arial, Helvetica, sans-serif; margin: 0px; padding: 0px;">
</div>
<div style="border-style: none; border-width: 0px; font-family: Arial, Helvetica, sans-serif; margin: 0px; padding: 0px;">
Here is another example... using your own custom sort method by implementing comparator and passing it along with your sort method</div>
<div style="border-style: none; border-width: 0px; font-family: Arial, Helvetica, sans-serif; margin: 0px; padding: 0px;">
<br /></div>
<div style="border-style: none; border-width: 0px; font-family: Arial, Helvetica, sans-serif; margin: 0px; padding: 0px;">
</div>
<pre class="brush: java;fontsize: 100; first-line: 1; " style="background-color: #fafaff; border: 1px solid rgb(238, 238, 238); font: inherit; outline: none; white-space: pre;"><span style="font-family: 'Courier New', Courier, monospace;">package compareExamples;
import java.io.*;
import java.util.*;
public class Laptop implements Comparable<Laptop> {
// Implementing compareTo on custom objects!
// Member elements
String manufacturer;
String color;
String model;
Laptop() {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
try {
System.out.print("Manufacturer: ");
manufacturer = in.readLine();
System.out.print("Model: ");
model = in.readLine();
System.out.println("Color: ");
color = in.readLine();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
@Override
public int compareTo(Laptop o) {
String obj1_1 = manufacturer+" "+model+" "+color;
String obj1_2 = manufacturer+" "+model;
String obj2_1 = o.manufacturer+" "+o.model+" "+o.color;
String obj2_2 = o.manufacturer+" "+o.model;
if(manufacturer.equalsIgnoreCase(o.manufacturer)){
if(model.equalsIgnoreCase(o.model)) {
if(color.equalsIgnoreCase(o.color)) {
return 0;
}
else
return obj1_1.compareToIgnoreCase(obj2_1);
}
else
return obj1_2.compareToIgnoreCase(obj2_2);
}
else
return manufacturer.compareToIgnoreCase(o.manufacturer);
}
public static void main(String args[]) {
Laptop a[] = new Laptop[5];
for(int i=0;i<5;i++) {
a[i] = new Laptop();
}
// Sorting with the help of the logic defined in compareTo method of the class Laptop
Arrays.sort(a);
for(Laptop b : a) {
System.out.println(b.manufacturer+"\n"+b.model+"\n"+b.color+"\n\n");
}
System.out.println("********************************************");
// Custom sorting with the help of the comparator defined in the class CompareLoptopByColor's compare method
CompareLaptopByColor com = new CompareLaptopByColor();
Arrays.sort(a,com);
for(Laptop b : a) {
System.out.println(b.manufacturer+"\n"+b.model+"\n"+b.color+"\n\n");
}
}
}</span>
</pre>
<div style="border-style: none; border-width: 0px; font-family: Arial, Helvetica, sans-serif; margin: 0px; padding: 0px;">
<br /></div>
<div style="border-style: none; border-width: 0px; font-family: Arial, Helvetica, sans-serif; margin: 0px; padding: 0px;">
-------------------------- The custom comparator class-------------------------</div>
<div style="border-style: none; border-width: 0px; font-family: Arial, Helvetica, sans-serif; margin: 0px; padding: 0px;">
<br /></div>
<div style="border-style: none; border-width: 0px; font-family: Arial, Helvetica, sans-serif; margin: 0px; padding: 0px;">
</div>
<pre class="brush: bash;fontsize: 100; first-line: 1; " style="background-color: #fafaff; border: 1px solid rgb(238, 238, 238); font: inherit; outline: none; white-space: pre;"><span style="font-family: 'Courier New', Courier, monospace;">package compareExamples;
import java.util.Comparator;
public class CompareLaptopByColor implements Comparator<Laptop> {
@Override
public int compare(Laptop arg0, Laptop arg1) {
return arg0.color.compareToIgnoreCase(arg1.color);
}
}</span></pre>
</div>
</div>Ajo (Dev)http://www.blogger.com/profile/11302481405062225663noreply@blogger.com0tag:blogger.com,1999:blog-5876957615554554011.post-53489497824993381702011-08-29T16:55:00.000+05:302011-08-29T16:55:20.922+05:30jstl defination<div dir="ltr" style="text-align: left;" trbidi="on"><span class="Apple-style-span" style="color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px;"> What are the difference between <%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c" %> and the one without "rt"? Sometimes when I remove "rt" the JSP won't compile, what is the reason?</span><br />
<span class="Apple-style-span" style="color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px;"><br />
</span><br />
<span class="Apple-style-span" style="color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px;"><br />
</span><br />
<span class="Apple-style-span" style="color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px;"><br />
</span><br />
<span class="Apple-style-span" style="color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px;"> Unless you are using a very old version of JSP (JSP 1.2 or 1.1 to be exact) you shouldn't be using either of those. Those are JSTL 1.0 URIs and are not suited to modern versions of JSP.</span><br />
<span class="Apple-style-span" style="color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px;"><br />
</span><br />
<span class="Apple-style-span" style="color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px;"></span><br />
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">you can instead use <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> even this will work</div></div>Ajo (Dev)http://www.blogger.com/profile/11302481405062225663noreply@blogger.com0tag:blogger.com,1999:blog-5876957615554554011.post-40545838179433356632011-08-29T16:53:00.001+05:302011-08-29T16:53:48.914+05:30collections redefined<div dir="ltr" style="text-align: left;" trbidi="on"><span class="Apple-style-span" style="color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px;">set : doesnt allow duplicates<br />
<br />
list : allows insertion & deletion easy<br />
<br />
tree : sorting<br />
<br />
hash : easy search<br />
<br />
linking : maintains order of insertion<br />
<br />
map : mapped name/value pairs<br />
<br />
<br />
<br />
now for every collection just mmatch the keyword and properties to know what is used for what reason...<br />
<br />
<br />
like hashset=== hash+set: doesnt allow3 duplicates and help in easy search..<br />
<br />
<br />
enjoy adding and learning. :)</span></div>Ajo (Dev)http://www.blogger.com/profile/11302481405062225663noreply@blogger.com28tag:blogger.com,1999:blog-5876957615554554011.post-59995441273244460402011-08-29T16:52:00.001+05:302012-06-09T15:29:40.728+05:30Unique Selector<div dir="ltr" style="text-align: left;" trbidi="on">
<span class="Apple-style-span" style="color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px;"></span><br />
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
for selecting a uniquely defined no for people : for eg to take questions for people in a quiz as such that adjascent people face different questions we put forth the following logic:</div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<br /></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span style="font-family: 'Courier New', Courier, monospace;">take range=total_no_of_questions;</span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span style="font-family: 'Courier New', Courier, monospace;">prime[]={list of prime nos other than two equal to no of people attending the quiz};</span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span style="font-family: 'Courier New', Courier, monospace;">pos= math.random*(the no of people attending)</span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span style="font-family: 'Courier New', Courier, monospace;">my_random=prime[pos]</span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span style="font-family: 'Courier New', Courier, monospace;">for(int i=1;i<=range;i++)</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> {</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"> my_question=(my_random*i)%range+1;</span><br />
<span style="font-family: 'Courier New', Courier, monospace;">system.out.println("my random quetion no is : "+my_question); </span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span style="font-family: 'Courier New', Courier, monospace;"> }</span></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<br /></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<br /></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<br /></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<br /></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<br /></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
check out this logic and comment here...</div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<br /></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<br /></div>
<div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
;)</div>
</div>Ajo (Dev)http://www.blogger.com/profile/11302481405062225663noreply@blogger.com0tag:blogger.com,1999:blog-5876957615554554011.post-91020906577820964612011-07-12T10:18:00.001+05:302011-07-12T10:18:53.981+05:30PrefaceWell i believe this is going to be my first techie post...I would like to dedicate this to my friends who brought me to the place where i stand now..<br />
<span class="Apple-style-span" style="color: #00a3ff; font-family: Georgia, Times, serif; font-size: 13px; font-style: italic; font-weight: bold; line-height: 20px;"></span><br />
<div><span class="Apple-style-span" style="font-weight: normal;"><span class="Apple-style-span" style="font-style: normal;"><span class="Apple-style-span" style="color: black;">Now a newbie in the professional world. Myself Ajo is back to you... My friend Fareez has inspired me to share my corporate experiences with you...</span></span></span></div><div><span class="Apple-style-span" style="font-weight: normal;"><span class="Apple-style-span" style="font-style: normal;"><span class="Apple-style-span" style="color: black;"><br />
</span></span></span></div><div><span class="Apple-style-span" style="font-weight: normal;"><span class="Apple-style-span" style="font-style: normal;"><span class="Apple-style-span" style="color: black;">I just want to help you people out there so that you can continue your path into your dreams.</span></span></span></div><div><span class="Apple-style-span" style="font-weight: normal;"><span class="Apple-style-span" style="font-style: normal;"><span class="Apple-style-span" style="color: black;">As Wordsworth once said</span></span></span></div><div><span class="Apple-style-span" style="font-weight: normal;"><span class="Apple-style-span" style="font-style: normal;"><span class="Apple-style-span" style="color: black;"><i> " To dream is to believe in the impossible and work to make it possible"</i>.</span></span></span></div><div><span class="Apple-style-span" style="font-weight: normal;"><span class="Apple-style-span" style="font-style: normal;"><span class="Apple-style-span" style="color: black;"> Keep working. Troubleshoot me and i will try my best to help you out so that you can work yourself into a proper format..</span></span></span></div><div><span class="Apple-style-span" style="font-weight: normal;"><span class="Apple-style-span" style="font-style: normal;"><span class="Apple-style-span" style="color: black;">Happy working</span></span></span></div>Ajo (Dev)http://www.blogger.com/profile/11302481405062225663noreply@blogger.com0