<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-2026383876733412310</id><updated>2024-10-06T23:06:22.425-07:00</updated><category term="Apache Tomacat"/><category term="Creating a Servlet without using IDE"/><category term="Introduction to J2EE"/><category term="J2EE"/><category term="J2EE for beginners"/><category term="J2EE introduction for beginners"/><category term="JDBC Connectivity"/><category term="JDBC and Microsoft Access"/><category term="Java 2 Enterprise Edition"/><category term="Servlet"/><title type='text'>Technology and more...</title><subtitle type='html'>This blog is about everything I found useful and interesting.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://techymonk.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2026383876733412310/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://techymonk.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Ravi</name><uri>http://www.blogger.com/profile/04035715103828812563</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='22' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQnCl5FiTFsxBqZZXXU90rD4UwFS8cIN7EXmdl35kEPA-wNFaH_JlDCXzzieSEwIZ6OhjQsu-BFHu9AjHuekHnsCMenctD-eHtYndnl_yqVMHikyxw2LA2xAGHmh8du9g/s220/ravi.JPG'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>4</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-2026383876733412310.post-4206724797637648147</id><published>2011-09-24T22:38:00.000-07:00</published><updated>2011-09-24T22:45:58.136-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Introduction to J2EE"/><category scheme="http://www.blogger.com/atom/ns#" term="J2EE"/><category scheme="http://www.blogger.com/atom/ns#" term="J2EE for beginners"/><category scheme="http://www.blogger.com/atom/ns#" term="J2EE introduction for beginners"/><category scheme="http://www.blogger.com/atom/ns#" term="Java 2 Enterprise Edition"/><title type='text'>J2EE Introduction for beginners</title><content type='html'>&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: 12px; line-height: 18px; &quot;&gt;&lt;span class=&quot;Apple-style-span&quot; &gt;&lt;div&gt;J2EE - Java 2 Enterprise Edition is one of the 3 java platforms, the other being J2SE and J2ME. It is set of specifications or standards consisting of many APIs useful for building java based enterprise applications. At such it is not some software to be installed but is just a bundle of many technologies having set of APIs. &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;J2EE applications are java applications that span over LAN, WAN and broader. They are used when it comes to distributed environment and disparate systems and also when in need to make use of its technologies. &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;J2EE technologies are broadly classified into two categories: &lt;/div&gt;&lt;div&gt;1. Component technologies &lt;/div&gt;&lt;div&gt;2. Service technologies &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Kinds of J2EE Components: &lt;/div&gt;&lt;div&gt;Client Side Comonents -&amp;gt; includes applets &lt;/div&gt;&lt;div&gt;Web Components -&amp;gt; includes servelets and JSPs &lt;/div&gt;&lt;div&gt;Business Components -&amp;gt; includes EJB&lt;/div&gt;&lt;div&gt;Web components and Business components run on Server Side... &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Kinds of J2EE Services: &lt;/div&gt;&lt;div&gt;JNDI -&amp;gt; Java Naming and Directory service &lt;/div&gt;&lt;div&gt;JMS -&amp;gt; java Messaging Service &lt;/div&gt;&lt;div&gt;JTA -&amp;gt; Java Transaction API &lt;/div&gt;&lt;div&gt;JAAS -&amp;gt; Java Authentication and Authorization Service &lt;/div&gt;&lt;div&gt;Java Mail &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;J2EE is meant for building the 3 layers of java based enterprise application. The layers being: &lt;/div&gt;&lt;div&gt;1. Presentation Layer &lt;/div&gt;&lt;div&gt;2. Service/Business Layer &lt;/div&gt;&lt;div&gt;3. Data Access Layer &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;We have been talking on java based enterprise application... To clear you on it: &lt;/div&gt;&lt;div&gt;A computer application used to manage business services of an enterprise is called enterprise application and if the application is coded in java and is deployed into J2EE compliant application server then it becomes java based.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Any enterprise application generally covers 4 main tasks: &lt;/div&gt;&lt;div&gt;1. providing user interface(UI) to the user. &lt;/div&gt;&lt;div&gt;2. processing of data according to some business logic(rules) &lt;/div&gt;&lt;div&gt;3. interacting with database(data access) &lt;/div&gt;&lt;div&gt;4. storing of data &lt;/div&gt;&lt;div&gt;These tasks are logically divided into 4 layers &lt;/div&gt;&lt;div&gt;A. Presentation layer &lt;/div&gt;&lt;div&gt;B. Business/Service layer &lt;/div&gt;&lt;div&gt;C. Data Access Layer &lt;/div&gt;&lt;div&gt;D. Data Layer &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;J2EE developers are responsible for the first 3 layers while the data layer is the responsibility of database administrator(DBA). Hope you are clear on the layers... Remember they are just the logical division. Now coming to actual or physical division... &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The physical partition of enterprise application is known as &#39;tier&#39;. The enterprise application can be single-tier, two-tier, three-tier, n-tier or distributed-tier depending on number of computing systems on which the layers are installed. &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Presentation Layer is the user interface part of the application. If the app is web based then Servelets and JSPs are used to build it on server side. The main design patterns used in this layer are Front Controller, Model-View-Controller(MVC), Composite View. &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Business/Service Layer is nothing but a code that processes data according to business logic(rules). Some important design patterns used in this layer are Service Locator, Business Delegate, Session Facade. Job of service layer is to receive the business request from presentation layer or some other service layer, communicate with data access layer to get the enterprise data, process that data using defined business rules, return the result to the requested component &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Data Access layer is again a code which communicates with the database. It performs CRUD(Create, Read, Update, Delete). Therefore it is just a code communicating with database specific APIs such as JDBC. The design patterns used are Data Access Object(DTO), Data Transfer Object(DTO), Value Object. Can you guess what its job is??? It receives request from service layer, communicates with the database to perform the requested operations and sends the result back to service layer. &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;So now you clear on J2EE basics.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;We already know what is the job of service layer but in order for it to implement it, it needs some capabilities... like transactional capability, distributed computing capability, security implementation capability. &lt;/div&gt;&lt;div&gt;To have these capabilities we make use of J2EE technologies(both components and services). Just scroll up and read the first three paragraphs... This should make it clear for you. &lt;/div&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techymonk.blogspot.com/feeds/4206724797637648147/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techymonk.blogspot.com/2011/09/j2ee-introduction-for-beginners.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2026383876733412310/posts/default/4206724797637648147'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2026383876733412310/posts/default/4206724797637648147'/><link rel='alternate' type='text/html' href='http://techymonk.blogspot.com/2011/09/j2ee-introduction-for-beginners.html' title='J2EE Introduction for beginners'/><author><name>Ravi</name><uri>http://www.blogger.com/profile/04035715103828812563</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='22' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQnCl5FiTFsxBqZZXXU90rD4UwFS8cIN7EXmdl35kEPA-wNFaH_JlDCXzzieSEwIZ6OhjQsu-BFHu9AjHuekHnsCMenctD-eHtYndnl_yqVMHikyxw2LA2xAGHmh8du9g/s220/ravi.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2026383876733412310.post-8786139667165834027</id><published>2011-09-11T00:22:00.000-07:00</published><updated>2011-09-11T00:35:12.904-07:00</updated><title type='text'>Tango dance</title><content type='html'>&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEitsPb_s8jr3gUuRWvjlmlHpYNMWomz3pvUog2gTUssFolVFDumDIOlxXI28UyBm6bDGAMAY_gN81l6_JvePkiIz_VJh-zXEfmlR0azrzpTKcRYIjhPtdOCtHikyax6HjrYhkZ4JEjsYw5s/s1600/TangoCouple.jpg&quot;&gt;&lt;img style=&quot;float: right; margin: 0pt 0pt 10px 10px; cursor: pointer; width: 215px; height: 320px;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEitsPb_s8jr3gUuRWvjlmlHpYNMWomz3pvUog2gTUssFolVFDumDIOlxXI28UyBm6bDGAMAY_gN81l6_JvePkiIz_VJh-zXEfmlR0azrzpTKcRYIjhPtdOCtHikyax6HjrYhkZ4JEjsYw5s/s320/TangoCouple.jpg&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5651001188135222418&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;br /&gt;First time I saw it in the movie &quot;the scent of a women&quot;. I was so much influenced by its music. It was like what I have been looking for since my whole life. It is one of the best dance. Although I never danced but I will surely learn it. This is some info regarding Tango if you like it too.&lt;br /&gt;&lt;br /&gt;Tango is a dance that has influences from European and African culture.Dances from the candombe ceremonies of former slave peoples helped shape the modern day Tango. The dance originated in lower-class districts of Buenos Aires and Montevideo. The music derived from the fusion of various forms of music from Europe.The word &quot;tango&quot; seems to have first been used in connection with the dance in the 1890s. Initially it was just one of the many dances, but it soon became popular throughout society, as theatres and street barrel organs spread it from the suburbs to the working-class slums, which were packed with hundreds of thousands of European immigrants, primarily Italians, Spanish and French. (Source - Wikipedia)&lt;br /&gt;&lt;br /&gt;Here are list of some songs that you can look for :&lt;br /&gt;&lt;ol&gt;&lt;li&gt;Libertango&lt;/li&gt;&lt;li&gt;Santa Maria by Project Gotan&lt;br /&gt;&lt;/li&gt;&lt;/ol&gt;</content><link rel='replies' type='application/atom+xml' href='http://techymonk.blogspot.com/feeds/8786139667165834027/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techymonk.blogspot.com/2011/09/tango-dance.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2026383876733412310/posts/default/8786139667165834027'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2026383876733412310/posts/default/8786139667165834027'/><link rel='alternate' type='text/html' href='http://techymonk.blogspot.com/2011/09/tango-dance.html' title='Tango dance'/><author><name>Ravi</name><uri>http://www.blogger.com/profile/04035715103828812563</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='22' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQnCl5FiTFsxBqZZXXU90rD4UwFS8cIN7EXmdl35kEPA-wNFaH_JlDCXzzieSEwIZ6OhjQsu-BFHu9AjHuekHnsCMenctD-eHtYndnl_yqVMHikyxw2LA2xAGHmh8du9g/s220/ravi.JPG'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEitsPb_s8jr3gUuRWvjlmlHpYNMWomz3pvUog2gTUssFolVFDumDIOlxXI28UyBm6bDGAMAY_gN81l6_JvePkiIz_VJh-zXEfmlR0azrzpTKcRYIjhPtdOCtHikyax6HjrYhkZ4JEjsYw5s/s72-c/TangoCouple.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2026383876733412310.post-6883381878909997831</id><published>2011-05-27T09:54:00.000-07:00</published><updated>2011-05-27T10:42:49.821-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="JDBC and Microsoft Access"/><category scheme="http://www.blogger.com/atom/ns#" term="JDBC Connectivity"/><title type='text'>JDBC and Microsoft Access</title><content type='html'>&lt;span class=&quot;Apple-style-span&quot;&gt;Howdy,&lt;br /&gt;&lt;br /&gt;Here another most simple program.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;How to make a database connection in &lt;b&gt;Java class&lt;/b&gt; and &lt;b&gt;Microsoft Access&lt;/b&gt;&lt;br /&gt;There are following simple steps to do:&lt;br /&gt;&lt;br /&gt;&lt;ol&gt;&lt;li&gt;To connect ms access with your program (of java) you need to create a database in ms access and then create a table in it. make sure that table name  and database are different. so that you will not have confusion.&lt;/li&gt;&lt;li&gt;Save the table and then database.&lt;/li&gt;&lt;li&gt;Go to control panel.&lt;/li&gt;&lt;li&gt;Go to Administrative Tools&lt;/li&gt;&lt;li&gt;Click on Data Sources(ODBC)&lt;/li&gt;&lt;li&gt;On User DSN(Data Source Name) tab you can easily see the MS Access Database in User Data Sources.&lt;/li&gt;&lt;li&gt;Select the MS Access Database and click on configure (there will be ODBC Microsoft Access Setup open) &lt;/li&gt;&lt;li&gt;Specify Data Source Name in Text field. The Description field is optional and you can leave it blank.&lt;/li&gt;&lt;li&gt;In Database grid click on &quot;select&quot; and then go to path where database file is saved that was created by you.&lt;/li&gt;&lt;li&gt;After this. Click on &quot;Advanced &quot; button and then specify a log in name and password and then click OK&lt;/li&gt;&lt;li&gt;On System Database grid. click on none. and its done!! tadaaaaaaaa&lt;/li&gt;&lt;/ol&gt;&lt;br /&gt;I made an &quot;employee&quot; name database in MS Access and &quot;emptable&quot; named table which I am using here.&lt;br /&gt;take a look at this.&lt;br /&gt;&lt;br /&gt;This is the sample program that i had used for showing the database connectivity for a java program with Microsoft access.&lt;/span&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;import java.sql.*;&lt;/div&gt;&lt;div&gt;class Dbdemo&lt;/div&gt;&lt;div&gt;{&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;public static void main(String[] args)&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;{&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;  &lt;/span&gt;try&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;  &lt;/span&gt;{&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;   &lt;/span&gt;try&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;   &lt;/span&gt;{&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;    &lt;/span&gt;&lt;/span&gt;&lt;i&gt;/*Loading a database driver by calling Class.forName() with the Driver class name as an argument.*/&lt;/i&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;    &lt;/span&gt;Class.forName(&quot;sun.jdbc.odbc.JdbcOdbcDriver&quot;);&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;   &lt;/span&gt;}&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;   &lt;/span&gt;catch(Exception x)&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;   &lt;/span&gt;{&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;    &lt;/span&gt;System.out.println(&quot;Unable to load driver class&quot;);&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;   &lt;/span&gt;}&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;   &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;   &lt;/span&gt;&lt;i&gt;/&lt;/i&gt;&lt;/span&gt;&lt;i&gt;*The getConnection method of DriverManager class returns an open connection you can use to create JDBC statements that pass your SQL statement to DBMS*/&lt;/i&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;   &lt;/span&gt;Connection con = &lt;/div&gt;&lt;div&gt;DriverManager.getConnection(&quot;jdbc:odbc:MS Access Database&quot;,&quot;ravi&quot;,&quot;123&quot;);&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;   &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;   &lt;/span&gt;String query = &quot;select * from emptable&quot;;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;   &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;   &lt;/span&gt;&lt;i&gt;/*Instantiating the object of Statement interface(as a reference) from Connection class object con by using createStatment() method. this statement object is used     to send and execute SQL statements to a database.*/&lt;/i&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;   &lt;/span&gt;Statement stm = con.createStatement();&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;   &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;   &lt;/span&gt;&lt;i&gt;/&lt;/i&gt;&lt;/span&gt;&lt;i&gt;*executeQuery is a method of Statement Interface for Select queries. this method &lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;takes query as an argument.&lt;/i&gt;&lt;/div&gt;&lt;div&gt;&lt;i&gt;Variable rs , which is an Instance of ResultSet, contains the details of Employees*/&lt;/i&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;   &lt;/span&gt;ResultSet rs = stm.executeQuery(query);&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;   &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;   &lt;/span&gt;System.out.println(&quot;Connection established&quot;);&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;   &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;  &lt;i&gt; &lt;/i&gt;&lt;/span&gt;&lt;i&gt;/&lt;/i&gt;&lt;/span&gt;&lt;i&gt;*ResultSet object maintains a cursor, which points to its current row of data. The next() method moves cursor to next row*/&lt;/i&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;   &lt;/span&gt;while(rs.next())&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;   &lt;/span&gt;{&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;    &lt;/span&gt;&lt;i&gt;/&lt;/i&gt;&lt;/span&gt;&lt;i&gt;*The getXXX() method can get any any of the SQL types and they are automatically converted to a String.&lt;/i&gt;&lt;/div&gt;&lt;div&gt;&lt;i&gt;In getXXX() method XXX represent many types that you can check by &lt;/i&gt;&lt;/div&gt;&lt;div&gt;&lt;i&gt;&quot;javap java.sql.ResultSet&quot;*/&lt;/i&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;    &lt;/span&gt;String id = rs.getString(1); &lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;    &lt;/span&gt;String nm = rs.getString(2);&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;    &lt;/span&gt;String dept = rs.getString(3);&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;    &lt;/span&gt;String sal = rs.getString(4);&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;    &lt;/span&gt;System.out.println(&quot;epmloyee id: &quot;+id+&quot; employee name: &quot;+nm&lt;/div&gt;&lt;div&gt;+&quot; employee &lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;dept: &quot;+dept+&quot; employee salary: &quot;+sal);&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;   &lt;/span&gt;}&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;  &lt;/span&gt;}catch(Exception e)&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;  &lt;/span&gt;{&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;   &lt;/span&gt;System.out.println(e);&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;  &lt;/span&gt;}&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;}&lt;/div&gt;&lt;div&gt;}&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techymonk.blogspot.com/feeds/6883381878909997831/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techymonk.blogspot.com/2011/05/jdbc-and-microsoft-accesss.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2026383876733412310/posts/default/6883381878909997831'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2026383876733412310/posts/default/6883381878909997831'/><link rel='alternate' type='text/html' href='http://techymonk.blogspot.com/2011/05/jdbc-and-microsoft-accesss.html' title='JDBC and Microsoft Access'/><author><name>Ravi</name><uri>http://www.blogger.com/profile/04035715103828812563</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='22' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQnCl5FiTFsxBqZZXXU90rD4UwFS8cIN7EXmdl35kEPA-wNFaH_JlDCXzzieSEwIZ6OhjQsu-BFHu9AjHuekHnsCMenctD-eHtYndnl_yqVMHikyxw2LA2xAGHmh8du9g/s220/ravi.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2026383876733412310.post-1715840238085502556</id><published>2011-05-25T10:57:00.000-07:00</published><updated>2011-05-27T10:29:54.548-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Apache Tomacat"/><category scheme="http://www.blogger.com/atom/ns#" term="Creating a Servlet without using IDE"/><category scheme="http://www.blogger.com/atom/ns#" term="Servlet"/><title type='text'>Creating a Servlet without using IDE</title><content type='html'>Hi,&lt;br /&gt;&lt;br /&gt;It is my first blog. My heart felt apologies for the mistakes in the blog&lt;br /&gt;I am demonstrating a program to manually create and run a servlet. I hope the reader is aware of core java. So here we go..&lt;br /&gt;We need following stuff for this :&lt;br /&gt;&lt;br /&gt;1.JDK 1.5 or latest version, ( I am here using JDK 1.6)&lt;br /&gt;2. Apache Tomcat (Here we are using Apache Tomcat 6.0.32)&lt;br /&gt;&lt;br /&gt;The Following is the code for the TestServlet.java. It simply sends the message to the browser.&lt;br /&gt;I apologise if the code here is not well managed, because i am not so handy with blogging.&lt;br /&gt;&lt;br /&gt;&lt;p&gt;import java.io.*;&lt;br /&gt;import javax.servlet.*;&lt;br /&gt;import javax.servlet.http.*;&lt;br /&gt;&lt;br /&gt;public class TestServlet extends HttpServlet {&lt;br /&gt;   public void doGet(HttpServletRequest request,  HttpServletResponse response) throw IOException,ServletException {&lt;br /&gt;       response.setContentType(&quot;text/html&quot;);&lt;br /&gt;       PrintWriter out = response.getWriter();&lt;br /&gt;       out.println(&quot;Test Servlet &quot;);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {&lt;br /&gt;       doGet(request, response);&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;After this we need to put the information about our servlet in the web.xml file. Here is what you have to do.&lt;br /&gt;&lt;br /&gt;compile your TestServlet.java and put the class file in the following location &lt;span style=&quot;font-weight:bold;&quot;&gt;Apache Software Foundation\apache-tomcat-6.0.32\webapps\examples\WEB-INF\classes&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Now update the file web.xml  at location &lt;span style=&quot;font-weight:bold;&quot;&gt;Apache Software Foundation\apache-tomcat-6.0.32\webapps\examples\WEB-INF&lt;/span&gt; with following information &lt;br /&gt;&lt;p&gt; &amp;lt;servlet&amp;gt;&lt;br /&gt;     &amp;lt;servlet-name&amp;gt;TestServlet&amp;lt;/servlet-name&amp;gt;&lt;br /&gt;     &amp;lt;servlet-class&amp;gt;TestServlet&amp;lt;/servlet-class&amp;gt;&lt;br /&gt;     &amp;lt;/servlet&amp;gt;&lt;br /&gt;   &amp;lt;servlet-mapping&amp;gt;&lt;br /&gt;       &amp;lt;servlet-name&amp;gt;TestServlet&amp;lt;/servlet-name&amp;gt;&lt;br /&gt;       &amp;lt;url-pattern&amp;gt;/test&amp;lt;/url-pattern&amp;gt;&lt;br /&gt;   &amp;lt;/servlet-mapping&amp;gt;&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;The above information maps our servlet class to a URL Pattern , Apache tomcat picks your class file this way.&lt;br /&gt;Voila!!. You have just created a servlet. Now we need to start the tomcat server.&lt;br /&gt;&lt;br /&gt;After starting the server, type the url : &lt;span style=&quot;font-weight:bold;&quot;&gt;http://localhost:8080/examples/test&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;You will see the message on the browser, that we put in the servlet.&lt;br /&gt;&lt;br /&gt;if this blogs need any modification, your views are always welcomed.&lt;br /&gt;Ravi</content><link rel='replies' type='application/atom+xml' href='http://techymonk.blogspot.com/feeds/1715840238085502556/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techymonk.blogspot.com/2011/05/servlets.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2026383876733412310/posts/default/1715840238085502556'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2026383876733412310/posts/default/1715840238085502556'/><link rel='alternate' type='text/html' href='http://techymonk.blogspot.com/2011/05/servlets.html' title='Creating a Servlet without using IDE'/><author><name>Ravi</name><uri>http://www.blogger.com/profile/04035715103828812563</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='22' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQnCl5FiTFsxBqZZXXU90rD4UwFS8cIN7EXmdl35kEPA-wNFaH_JlDCXzzieSEwIZ6OhjQsu-BFHu9AjHuekHnsCMenctD-eHtYndnl_yqVMHikyxw2LA2xAGHmh8du9g/s220/ravi.JPG'/></author><thr:total>0</thr:total></entry></feed>