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

<channel>
	<title>TechieDrill &#187; program</title>
	<atom:link href="http://techiedrill.com/tag/program/feed/" rel="self" type="application/rss+xml" />
	<link>http://techiedrill.com</link>
	<description>Your World Of Technical Tutorials</description>
	<lastBuildDate>Tue, 10 Aug 2010 20:39:11 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.5</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Java Servlet Sample Program</title>
		<link>http://techiedrill.com/2009/12/java-servlet-sample-program/</link>
		<comments>http://techiedrill.com/2009/12/java-servlet-sample-program/#comments</comments>
		<pubDate>Sat, 05 Dec 2009 18:42:20 +0000</pubDate>
		<dc:creator>karnamrajesh</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[program]]></category>
		<category><![CDATA[sample]]></category>
		<category><![CDATA[servlet]]></category>
		<category><![CDATA[servlets]]></category>

		<guid isPermaLink="false">http://techiedrill.com/?p=475</guid>
		<description><![CDATA[import javax.servlet.*;
import java.io.*;
public class HelloServlet extends HttpServlet
{
 public void doGet(HttpServletRequest request,
 HttpServletResponse response)
 throws ServletException, IOException
 {
 response.setContentType(&#8221;text/html&#8221;);
 PrintWriter out = response.getWriter();
 out.println(&#8221;&#60;html&#62;&#60;head&#62;&#60;title&#62;Hello!&#60;/title&#62;&#60;/head&#62;&#8221;);
 out.println(&#8221;&#60;body bgcolor=\&#8221;white\&#8221;&#62;&#60;h1&#62;Hello Servlet World&#60;/h1&#62;&#8221;);
 out.println(&#8221;&#60;/body&#62;&#60;/html&#62;&#8221;);
 out.close();
 }
}
Servlets are the server side programming language.
Servlets are loaded by the container which instantiates the init() followed by the service() method. Destory() method is called to take [...]]]></description>
			<content:encoded><![CDATA[<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">import javax.servlet.*;</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">import java.io.*;</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">public class HelloServlet extends HttpServlet</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">{</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;"><span style="white-space: pre;"> </span>public void doGet(HttpServletRequest request,</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;"><span style="white-space: pre;"> </span>HttpServletResponse response)</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;"><span style="white-space: pre;"> </span>throws ServletException, IOException</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;"><span style="white-space: pre;"> </span>{</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;"><span style="white-space: pre;"> </span>response.setContentType(&#8221;text/html&#8221;);</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;"><span style="white-space: pre;"> </span>PrintWriter out = response.getWriter();</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;"><span style="white-space: pre;"> </span>out.println(&#8221;&lt;html&gt;&lt;head&gt;&lt;title&gt;Hello!&lt;/title&gt;&lt;/head&gt;&#8221;);</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;"><span style="white-space: pre;"> </span>out.println(&#8221;&lt;body bgcolor=\&#8221;white\&#8221;&gt;&lt;h1&gt;Hello Servlet World&lt;/h1&gt;&#8221;);</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;"><span style="white-space: pre;"> </span>out.println(&#8221;&lt;/body&gt;&lt;/html&gt;&#8221;);</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;"><span style="white-space: pre;"> </span>out.close();</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;"><span style="white-space: pre;"> </span>}</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">}</div>
<p>Servlets are the server side programming language.</p>
<p>Servlets are loaded by the container which instantiates the init() followed by the service() method. Destory() method is called to take the servlets out of service. init() and destroy() methods are called automatically and are called only once throughout the life cycle</p>
<p>Try out the sample simple servlet program</p>
<p>import javax.servlet.*;</p>
<p>import java.io.*;</p>
<p>public class HelloServlet extends HttpServlet</p>
<p>{</p>
<p><span style="white-space: pre;"> </span>public void doGet(HttpServletRequest request,</p>
<p><span style="white-space: pre;"> </span>HttpServletResponse response)</p>
<p><span style="white-space: pre;"> </span>throws ServletException, IOException</p>
<p><span style="white-space: pre;"> </span>{</p>
<p><span style="white-space: pre;"> </span>response.setContentType(&#8221;text/html&#8221;);</p>
<p><span style="white-space: pre;"> </span>PrintWriter out = response.getWriter();</p>
<p><span style="white-space: pre;"> </span>out.println(&#8221;&lt;html&gt;&lt;head&gt;&lt;title&gt;Hello!&lt;/title&gt;&lt;/head&gt;&#8221;);</p>
<p><span style="white-space: pre;"> </span>out.println(&#8221;&lt;body bgcolor=\&#8221;white\&#8221;&gt;&lt;h1&gt;Hello Servlet World&lt;/h1&gt;&#8221;);</p>
<p><span style="white-space: pre;"> </span>out.println(&#8221;&lt;/body&gt;&lt;/html&gt;&#8221;);</p>
<p><span style="white-space: pre;"> </span>out.close();</p>
<p><span style="white-space: pre;"> </span>}</p>
<p>}</p>
]]></content:encoded>
			<wfw:commentRss>http://techiedrill.com/2009/12/java-servlet-sample-program/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
