<?xml version="1.0" encoding="UTF-8" standalone="no"?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><rss xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" version="2.0"><channel><title>Java J2ee Tutorials</title><description></description><managingEditor>noreply@blogger.com (Alex Rabe)</managingEditor><pubDate>Fri, 1 Nov 2024 03:46:35 -0700</pubDate><generator>Blogger http://www.blogger.com</generator><openSearch:totalResults xmlns:openSearch="http://a9.com/-/spec/opensearchrss/1.0/">33</openSearch:totalResults><openSearch:startIndex xmlns:openSearch="http://a9.com/-/spec/opensearchrss/1.0/">1</openSearch:startIndex><openSearch:itemsPerPage xmlns:openSearch="http://a9.com/-/spec/opensearchrss/1.0/">25</openSearch:itemsPerPage><link>http://javaj2eetutorials.blogspot.com/</link><language>en-us</language><itunes:explicit>no</itunes:explicit><itunes:subtitle/><itunes:owner><itunes:email>noreply@blogger.com</itunes:email></itunes:owner><item><title>javascript code to alert before delete a record</title><link>http://javaj2eetutorials.blogspot.com/2012/12/javascript-code-to-alert-before-delete.html</link><category>javascript</category><author>noreply@blogger.com (Alex Rabe)</author><pubDate>Mon, 10 Dec 2012 22:53:00 -0800</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-2445219189346048747.post-1438064678587533812</guid><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
&lt;span style="background-color: white; font-family: 'Trebuchet MS', Trebuchet, sans-serif; font-size: 13px; line-height: 18px;"&gt;Write the javascript file js/delete.js containing the utility methods&lt;/span&gt;&lt;br style="background-color: white; font-family: 'Trebuchet MS', Trebuchet, sans-serif; font-size: 13px; line-height: 18px;" /&gt;&lt;br /&gt;
&lt;div class="syntaxhighlighter  " id="highlighter_723909" style="background-color: rgb(255, 255, 255) !important; background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 13px; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 1em 0px !important; min-height: auto !important; outline: 0px !important; padding: 1px !important; position: relative !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: 722.7000122070313px;"&gt;
&lt;div class="bar                                                                                                                                                                                                            show" style="background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"&gt;
&lt;div class="toolbar" style="background-color: rgb(248, 248, 248) !important; background-image: none !important; border: 1px solid rgb(231, 229, 220) !important; bottom: auto !important; float: none !important; font-size: 1px !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; padding: 8px 8px 8px 0px !important; position: absolute !important; right: 0px !important; top: 0px !important; vertical-align: baseline !important; width: auto !important;"&gt;
view source&lt;div class="item copyToClipboard" style="background-image: none !important; border: 0px !important; bottom: auto !important; float: left !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px 0px 0px 8px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"&gt;
&lt;embed allowscriptaccess="always" flashvars="highlighterId=highlighter_723909" height="16" id="highlighter_723909_clipboard" menu="false" src="http://alexgorbatchev.com/pub/sh/2.1.382/scripts/clipboard.swf" title="copy to clipboard" type="application/x-shockwave-flash" width="16" wmode="transparent"&gt;&lt;/embed&gt;&lt;/div&gt;
rint?&lt;/div&gt;
&lt;/div&gt;
&lt;div class="lines" style="background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"&gt;
&lt;div class="line alt1" style="background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"&gt;
&lt;table style="background-image: none !important; border-collapse: collapse !important; border: 0px !important; bottom: auto !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; text-align: left !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"&gt;&lt;tbody style="background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"&gt;
&lt;tr style="background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"&gt;&lt;td class="number" style="background-image: none !important; border: 0px !important; bottom: auto !important; color: rgb(175, 175, 175) !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: top !important; width: 3em !important;"&gt;&lt;code style="background-image: none !important; border: 0px !important; bottom: auto !important; display: block !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; padding: 0px 0.3em 0px 0px !important; position: static !important; right: auto !important; text-align: right !important; top: auto !important; vertical-align: baseline !important; width: 2.7em !important;"&gt;01&lt;/code&gt;&lt;/td&gt;&lt;td class="content" style="background-image: none !important; border-left-color: rgb(108, 226, 108) !important; border-left-style: solid !important; border-width: 0px 0px 0px 3px !important; bottom: auto !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; padding: 0px 0px 0px 0.5em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: top !important; width: auto !important; word-wrap: break-word;"&gt;&lt;code class="keyword" style="background-image: none !important; border: 0px !important; bottom: auto !important; color: rgb(0, 102, 153) !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"&gt;function&lt;/code&gt;&amp;nbsp;&lt;code class="plain" style="background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"&gt;go(url)&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;div class="line alt2" style="background-color: rgb(248, 248, 248) !important; background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"&gt;
&lt;table style="background-image: none !important; border-collapse: collapse !important; border: 0px !important; bottom: auto !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; text-align: left !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"&gt;&lt;tbody style="background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"&gt;
&lt;tr style="background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"&gt;&lt;td class="number" style="background-image: none !important; border: 0px !important; bottom: auto !important; color: rgb(175, 175, 175) !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: top !important; width: 3em !important;"&gt;&lt;code style="background-image: none !important; border: 0px !important; bottom: auto !important; display: block !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; padding: 0px 0.3em 0px 0px !important; position: static !important; right: auto !important; text-align: right !important; top: auto !important; vertical-align: baseline !important; width: 2.7em !important;"&gt;02&lt;/code&gt;&lt;/td&gt;&lt;td class="content" style="background-image: none !important; border-left-color: rgb(108, 226, 108) !important; border-left-style: solid !important; border-width: 0px 0px 0px 3px !important; bottom: auto !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; padding: 0px 0px 0px 0.5em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: top !important; width: auto !important; word-wrap: break-word;"&gt;&lt;code class="plain" style="background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"&gt;{&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;div class="line alt1" style="background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"&gt;
&lt;table style="background-image: none !important; border-collapse: collapse !important; border: 0px !important; bottom: auto !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; text-align: left !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"&gt;&lt;tbody style="background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"&gt;
&lt;tr style="background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"&gt;&lt;td class="number" style="background-image: none !important; border: 0px !important; bottom: auto !important; color: rgb(175, 175, 175) !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: top !important; width: 3em !important;"&gt;&lt;code style="background-image: none !important; border: 0px !important; bottom: auto !important; display: block !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; padding: 0px 0.3em 0px 0px !important; position: static !important; right: auto !important; text-align: right !important; top: auto !important; vertical-align: baseline !important; width: 2.7em !important;"&gt;03&lt;/code&gt;&lt;/td&gt;&lt;td class="content" style="background-image: none !important; border-left-color: rgb(108, 226, 108) !important; border-left-style: solid !important; border-width: 0px 0px 0px 3px !important; bottom: auto !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; padding: 0px 0px 0px 0.5em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: top !important; width: auto !important; word-wrap: break-word;"&gt;&lt;code class="spaces" style="background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"&gt;&amp;nbsp;&lt;/code&gt;&lt;code class="plain" style="background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"&gt;window.location = url;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;div class="line alt2" style="background-color: rgb(248, 248, 248) !important; background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"&gt;
&lt;table style="background-image: none !important; border-collapse: collapse !important; border: 0px !important; bottom: auto !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; text-align: left !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"&gt;&lt;tbody style="background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"&gt;
&lt;tr style="background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"&gt;&lt;td class="number" style="background-image: none !important; border: 0px !important; bottom: auto !important; color: rgb(175, 175, 175) !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: top !important; width: 3em !important;"&gt;&lt;code style="background-image: none !important; border: 0px !important; bottom: auto !important; display: block !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; padding: 0px 0.3em 0px 0px !important; position: static !important; right: auto !important; text-align: right !important; top: auto !important; vertical-align: baseline !important; width: 2.7em !important;"&gt;04&lt;/code&gt;&lt;/td&gt;&lt;td class="content" style="background-image: none !important; border-left-color: rgb(108, 226, 108) !important; border-left-style: solid !important; border-width: 0px 0px 0px 3px !important; bottom: auto !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; padding: 0px 0px 0px 0.5em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: top !important; width: auto !important; word-wrap: break-word;"&gt;&lt;code class="plain" style="background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"&gt;}&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;div class="line alt1" style="background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"&gt;
&lt;table style="background-image: none !important; border-collapse: collapse !important; border: 0px !important; bottom: auto !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; text-align: left !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"&gt;&lt;tbody style="background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"&gt;
&lt;tr style="background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"&gt;&lt;td class="number" style="background-image: none !important; border: 0px !important; bottom: auto !important; color: rgb(175, 175, 175) !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: top !important; width: 3em !important;"&gt;&lt;code style="background-image: none !important; border: 0px !important; bottom: auto !important; display: block !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; padding: 0px 0.3em 0px 0px !important; position: static !important; right: auto !important; text-align: right !important; top: auto !important; vertical-align: baseline !important; width: 2.7em !important;"&gt;05&lt;/code&gt;&lt;/td&gt;&lt;td class="content" style="background-image: none !important; border-left-color: rgb(108, 226, 108) !important; border-left-style: solid !important; border-width: 0px 0px 0px 3px !important; bottom: auto !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; padding: 0px 0px 0px 0.5em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: top !important; width: auto !important; word-wrap: break-word;"&gt;&amp;nbsp;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;div class="line alt2" style="background-color: rgb(248, 248, 248) !important; background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"&gt;
&lt;table style="background-image: none !important; border-collapse: collapse !important; border: 0px !important; bottom: auto !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; text-align: left !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"&gt;&lt;tbody style="background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"&gt;
&lt;tr style="background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"&gt;&lt;td class="number" style="background-image: none !important; border: 0px !important; bottom: auto !important; color: rgb(175, 175, 175) !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: top !important; width: 3em !important;"&gt;&lt;code style="background-image: none !important; border: 0px !important; bottom: auto !important; display: block !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; padding: 0px 0.3em 0px 0px !important; position: static !important; right: auto !important; text-align: right !important; top: auto !important; vertical-align: baseline !important; width: 2.7em !important;"&gt;06&lt;/code&gt;&lt;/td&gt;&lt;td class="content" style="background-image: none !important; border-left-color: rgb(108, 226, 108) !important; border-left-style: solid !important; border-width: 0px 0px 0px 3px !important; bottom: auto !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; padding: 0px 0px 0px 0.5em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: top !important; width: auto !important; word-wrap: break-word;"&gt;&lt;code class="keyword" style="background-image: none !important; border: 0px !important; bottom: auto !important; color: rgb(0, 102, 153) !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"&gt;function&lt;/code&gt;&amp;nbsp;&lt;code class="plain" style="background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"&gt;delete(url)&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;div class="line alt1" style="background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"&gt;
&lt;table style="background-image: none !important; border-collapse: collapse !important; border: 0px !important; bottom: auto !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; text-align: left !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"&gt;&lt;tbody style="background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"&gt;
&lt;tr style="background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"&gt;&lt;td class="number" style="background-image: none !important; border: 0px !important; bottom: auto !important; color: rgb(175, 175, 175) !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: top !important; width: 3em !important;"&gt;&lt;code style="background-image: none !important; border: 0px !important; bottom: auto !important; display: block !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; padding: 0px 0.3em 0px 0px !important; position: static !important; right: auto !important; text-align: right !important; top: auto !important; vertical-align: baseline !important; width: 2.7em !important;"&gt;07&lt;/code&gt;&lt;/td&gt;&lt;td class="content" style="background-image: none !important; border-left-color: rgb(108, 226, 108) !important; border-left-style: solid !important; border-width: 0px 0px 0px 3px !important; bottom: auto !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; padding: 0px 0px 0px 0.5em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: top !important; width: auto !important; word-wrap: break-word;"&gt;&lt;code class="plain" style="background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"&gt;{&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;div class="line alt2" style="background-color: rgb(248, 248, 248) !important; background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"&gt;
&lt;table style="background-image: none !important; border-collapse: collapse !important; border: 0px !important; bottom: auto !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; text-align: left !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"&gt;&lt;tbody style="background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"&gt;
&lt;tr style="background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"&gt;&lt;td class="number" style="background-image: none !important; border: 0px !important; bottom: auto !important; color: rgb(175, 175, 175) !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: top !important; width: 3em !important;"&gt;&lt;code style="background-image: none !important; border: 0px !important; bottom: auto !important; display: block !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; padding: 0px 0.3em 0px 0px !important; position: static !important; right: auto !important; text-align: right !important; top: auto !important; vertical-align: baseline !important; width: 2.7em !important;"&gt;08&lt;/code&gt;&lt;/td&gt;&lt;td class="content" style="background-image: none !important; border-left-color: rgb(108, 226, 108) !important; border-left-style: solid !important; border-width: 0px 0px 0px 3px !important; bottom: auto !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; padding: 0px 0px 0px 0.5em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: top !important; width: auto !important; word-wrap: break-word;"&gt;&lt;code class="spaces" style="background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"&gt;&amp;nbsp;&lt;/code&gt;&lt;code class="keyword" style="background-image: none !important; border: 0px !important; bottom: auto !important; color: rgb(0, 102, 153) !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"&gt;var&lt;/code&gt;&amp;nbsp;&lt;code class="plain" style="background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"&gt;isOK = confirm(&lt;/code&gt;&lt;code class="string" style="background-image: none !important; border: 0px !important; bottom: auto !important; color: blue !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"&gt;"Are you sure to delete?"&lt;/code&gt;&lt;code class="plain" style="background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"&gt;);&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;div class="line alt1" style="background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"&gt;
&lt;table style="background-image: none !important; border-collapse: collapse !important; border: 0px !important; bottom: auto !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; text-align: left !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"&gt;&lt;tbody style="background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"&gt;
&lt;tr style="background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"&gt;&lt;td class="number" style="background-image: none !important; border: 0px !important; bottom: auto !important; color: rgb(175, 175, 175) !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: top !important; width: 3em !important;"&gt;&lt;code style="background-image: none !important; border: 0px !important; bottom: auto !important; display: block !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; padding: 0px 0.3em 0px 0px !important; position: static !important; right: auto !important; text-align: right !important; top: auto !important; vertical-align: baseline !important; width: 2.7em !important;"&gt;09&lt;/code&gt;&lt;/td&gt;&lt;td class="content" style="background-image: none !important; border-left-color: rgb(108, 226, 108) !important; border-left-style: solid !important; border-width: 0px 0px 0px 3px !important; bottom: auto !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; padding: 0px 0px 0px 0.5em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: top !important; width: auto !important; word-wrap: break-word;"&gt;&lt;code class="spaces" style="background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"&gt;&amp;nbsp;&lt;/code&gt;&lt;code class="keyword" style="background-image: none !important; border: 0px !important; bottom: auto !important; color: rgb(0, 102, 153) !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"&gt;if&lt;/code&gt;&lt;code class="plain" style="background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"&gt;(isOK)&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;div class="line alt2" style="background-color: rgb(248, 248, 248) !important; background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"&gt;
&lt;table style="background-image: none !important; border-collapse: collapse !important; border: 0px !important; bottom: auto !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; text-align: left !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"&gt;&lt;tbody style="background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"&gt;
&lt;tr style="background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"&gt;&lt;td class="number" style="background-image: none !important; border: 0px !important; bottom: auto !important; color: rgb(175, 175, 175) !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: top !important; width: 3em !important;"&gt;&lt;code style="background-image: none !important; border: 0px !important; bottom: auto !important; display: block !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; padding: 0px 0.3em 0px 0px !important; position: static !important; right: auto !important; text-align: right !important; top: auto !important; vertical-align: baseline !important; width: 2.7em !important;"&gt;10&lt;/code&gt;&lt;/td&gt;&lt;td class="content" style="background-image: none !important; border-left-color: rgb(108, 226, 108) !important; border-left-style: solid !important; border-width: 0px 0px 0px 3px !important; bottom: auto !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; padding: 0px 0px 0px 0.5em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: top !important; width: auto !important; word-wrap: break-word;"&gt;&lt;code class="spaces" style="background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"&gt;&amp;nbsp;&lt;/code&gt;&lt;code class="plain" style="background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"&gt;{&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;div class="line alt1" style="background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"&gt;
&lt;table style="background-image: none !important; border-collapse: collapse !important; border: 0px !important; bottom: auto !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; text-align: left !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"&gt;&lt;tbody style="background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"&gt;
&lt;tr style="background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"&gt;&lt;td class="number" style="background-image: none !important; border: 0px !important; bottom: auto !important; color: rgb(175, 175, 175) !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: top !important; width: 3em !important;"&gt;&lt;code style="background-image: none !important; border: 0px !important; bottom: auto !important; display: block !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; padding: 0px 0.3em 0px 0px !important; position: static !important; right: auto !important; text-align: right !important; top: auto !important; vertical-align: baseline !important; width: 2.7em !important;"&gt;11&lt;/code&gt;&lt;/td&gt;&lt;td class="content" style="background-image: none !important; border-left-color: rgb(108, 226, 108) !important; border-left-style: solid !important; border-width: 0px 0px 0px 3px !important; bottom: auto !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; padding: 0px 0px 0px 0.5em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: top !important; width: auto !important; word-wrap: break-word;"&gt;&lt;code class="spaces" style="background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"&gt;&amp;nbsp;&amp;nbsp;&lt;/code&gt;&lt;code class="plain" style="background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"&gt;go(url);&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;div class="line alt2" style="background-color: rgb(248, 248, 248) !important; background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"&gt;
&lt;table style="background-image: none !important; border-collapse: collapse !important; border: 0px !important; bottom: auto !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; text-align: left !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"&gt;&lt;tbody style="background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"&gt;
&lt;tr style="background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"&gt;&lt;td class="number" style="background-image: none !important; border: 0px !important; bottom: auto !important; color: rgb(175, 175, 175) !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: top !important; width: 3em !important;"&gt;&lt;code style="background-image: none !important; border: 0px !important; bottom: auto !important; display: block !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; padding: 0px 0.3em 0px 0px !important; position: static !important; right: auto !important; text-align: right !important; top: auto !important; vertical-align: baseline !important; width: 2.7em !important;"&gt;12&lt;/code&gt;&lt;/td&gt;&lt;td class="content" style="background-image: none !important; border-left-color: rgb(108, 226, 108) !important; border-left-style: solid !important; border-width: 0px 0px 0px 3px !important; bottom: auto !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; padding: 0px 0px 0px 0.5em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: top !important; width: auto !important; word-wrap: break-word;"&gt;&lt;code class="spaces" style="background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"&gt;&amp;nbsp;&lt;/code&gt;&lt;code class="plain" style="background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"&gt;}&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;div class="line alt1" style="background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"&gt;
&lt;table style="background-image: none !important; border-collapse: collapse !important; border: 0px !important; bottom: auto !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; text-align: left !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"&gt;&lt;tbody style="background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"&gt;
&lt;tr style="background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"&gt;&lt;td class="number" style="background-image: none !important; border: 0px !important; bottom: auto !important; color: rgb(175, 175, 175) !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: top !important; width: 3em !important;"&gt;&lt;code style="background-image: none !important; border: 0px !important; bottom: auto !important; display: block !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; padding: 0px 0.3em 0px 0px !important; position: static !important; right: auto !important; text-align: right !important; top: auto !important; vertical-align: baseline !important; width: 2.7em !important;"&gt;13&lt;/code&gt;&lt;/td&gt;&lt;td class="content" style="background-image: none !important; border-left-color: rgb(108, 226, 108) !important; border-left-style: solid !important; border-width: 0px 0px 0px 3px !important; bottom: auto !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; padding: 0px 0px 0px 0.5em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: top !important; width: auto !important; word-wrap: break-word;"&gt;&lt;code class="plain" style="background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"&gt;}&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><title>How to Upload and Take Backup of Large MySql Database File into Local Database Using Command Prompt</title><link>http://javaj2eetutorials.blogspot.com/2012/10/how-to-upload-and-take-backup-of-large.html</link><category>database back</category><author>noreply@blogger.com (Alex Rabe)</author><pubDate>Mon, 15 Oct 2012 21:52:00 -0700</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-2445219189346048747.post-5968554194230914391</guid><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
&lt;b&gt;How to upload and take backup of large MySql database file into local database using command prompt&lt;/b&gt;&lt;br /&gt;
&lt;ol style="text-align: left;"&gt;
&lt;li&gt;Craete data base in your local database&lt;/li&gt;
&lt;li&gt;Copy the path where MySql bin folder is available in command prompt for example C:\wamp\bin\mysql\mysql5.5.24\bin&lt;/li&gt;
&lt;li&gt;Write command to store database : mysql -u root -p&amp;nbsp;db_name.sql&amp;lt; C:\Users\Desktop\db_folder_name\db_name.sql&lt;/li&gt;
&lt;/ol&gt;
Where C:\Users\Desktop\db_folder_name\db_name.sql&amp;nbsp;is the path where dump database is available and&amp;nbsp;db_name.sql is the database name&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Note:&lt;/b&gt;&lt;br /&gt;
u = username&lt;br /&gt;
p = password (write password after p without space)&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;How to take database backup&lt;/b&gt;&lt;br /&gt;
&lt;ol style="text-align: left;"&gt;
&lt;li&gt;Write command to command prompt : mysqldump -u root -p&amp;nbsp;db_name&amp;nbsp;&amp;gt; d:\class_db.sql&lt;/li&gt;
&lt;/ol&gt;
Where d:\class_db.sql is the path where you want to save backup file and class_bd is the name you want to save file as.&lt;br /&gt;
&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><title>How to upload and take backup of large MySql database file into local database using command prompt</title><link>http://javaj2eetutorials.blogspot.com/2012/09/how-to-upload-and-take-backup-of-large.html</link><category>Database</category><author>noreply@blogger.com (Alex Rabe)</author><pubDate>Fri, 14 Sep 2012 23:44:00 -0700</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-2445219189346048747.post-237111932143044260</guid><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;How to upload and take backup of large MySql database file into local database using command prompt&lt;br /&gt;
&lt;br /&gt;
&lt;ol style="text-align: left;"&gt;&lt;li&gt;Create data base in your local database&lt;/li&gt;
&lt;li&gt;Copy the path where MySql bin folder is available in command prompt for example &lt;b&gt;D:\wamp\bin\mysql\mysql5.5.24\bin&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;Write command to store database : &lt;b&gt;mysql -u root -p &lt;/b&gt;&lt;b&gt;&lt;b&gt;db_name&lt;/b&gt; &amp;lt; D:\db_name.sql&lt;/b&gt;&lt;br /&gt;
where D:\db_name.sql is the path where dump database is available and db_name.sql is the database name &lt;/li&gt;
&lt;/ol&gt;&lt;div style="text-align: left;"&gt;&lt;br /&gt;
&lt;b&gt;Note:&amp;nbsp;&lt;/b&gt;&lt;/div&gt;&lt;b&gt;u&lt;/b&gt; = username&lt;br /&gt;
&lt;b&gt;p&lt;/b&gt; = password (write password after p without space)&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;How to take database backup&lt;/b&gt;&lt;br /&gt;
&lt;ul style="text-align: left;"&gt;&lt;li&gt;Write command to command prompt : &lt;b&gt;mysqldump -u root -p db_name &amp;gt; D:\class_db.sql&lt;/b&gt; &lt;br /&gt;
where D:\class_db.sql is the path where you want to save backup file and class_bd is the name you want to save file as.&lt;/li&gt;
&lt;/ul&gt;&lt;div style="text-align: left;"&gt;&lt;/div&gt;&lt;/div&gt;</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><title>Writing the first Struts Application</title><link>http://javaj2eetutorials.blogspot.com/2012/08/writing-first-struts-application.html</link><category>Struts Example</category><author>noreply@blogger.com (Alex Rabe)</author><pubDate>Fri, 31 Aug 2012 05:34:00 -0700</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-2445219189346048747.post-2388189991296043564</guid><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;Let's start with developing your first Struts application. Here are the steps involved in creating the Struts application.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Add relevant entries into the web.xml&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
a. Add ActionServlet Configuration with initialization parameters &lt;br /&gt;
b. Add ActionServlet Mapping &lt;br /&gt;
c. Add relevant taglib declaration&lt;br /&gt;
Start with a blank template for the struts-config.xml. In the struts-config.xml, add the following&lt;br /&gt;
&lt;br /&gt;
a. Declare the RequestProcessor &lt;br /&gt;
b. Create a properties file and declare it as Message Resource Bundle &lt;br /&gt;
c. Declare the Message Resource Bundle &lt;br /&gt;
d. Declare the Form-bean &lt;br /&gt;
e. Declare the ActionMapping for the Form-bean &lt;br /&gt;
f. Add the forwards in the ActionMapping&lt;br /&gt;
Create the Form-bean class&lt;br /&gt;
Create the JSP with Struts tags&lt;br /&gt;
Create the Action class&lt;br /&gt;
For every &amp;lt;bean:message&amp;gt; tag in the JSP, add key value pairs to the Message Resource Bundle (properties file) created in Step 2b&lt;br /&gt;
Add Validation in the Form-bean&lt;br /&gt;
Define the error messages in the Message Resource Bundle&lt;br /&gt;
Create the rest of the JSPs.&lt;br /&gt;
Next, you will find the steps to build the Struts application. You will find more explanation &amp;amp; rationale for the steps in the book Struts Survival Guide. &lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;1. Add relevant entries into the web.xml&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
web.xml for the Struts Application&lt;br /&gt;
&lt;br /&gt;
&amp;lt;?xml version="1.0" encoding="ISO-8859-1"?&amp;gt; &lt;br /&gt;
&amp;lt;!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd"&amp;gt; &lt;br /&gt;
&amp;lt;web-app&amp;gt; &lt;br /&gt;
&amp;lt;display-name&amp;gt;Hello World Struts Application&amp;lt;/display-name&amp;gt; &lt;br /&gt;
&amp;lt;servlet&amp;gt; &lt;br /&gt;
&amp;lt;servlet-name&amp;gt;action&amp;lt;/servlet-name&amp;gt; &lt;br /&gt;
&amp;lt;servlet-class&amp;gt;org.apache.struts.action.ActionServlet&amp;lt;/servlet-class&amp;gt; &lt;br /&gt;
&amp;lt;init-param&amp;gt; &lt;br /&gt;
&amp;lt;param-name&amp;gt;config&amp;lt;/param-name&amp;gt; &lt;br /&gt;
&amp;lt;param-value&amp;gt;/WEB-INF/struts-config.xml&amp;lt;/param-value&amp;gt; &lt;br /&gt;
&amp;lt;/init-param&amp;gt; &lt;br /&gt;
&amp;lt;init-param&amp;gt; &lt;br /&gt;
&amp;lt;param-name&amp;gt;debug&amp;lt;/param-name&amp;gt; &lt;br /&gt;
&amp;lt;param-value&amp;gt;3&amp;lt;/param-value&amp;gt; &lt;br /&gt;
&amp;lt;/init-param&amp;gt; &lt;br /&gt;
&amp;lt;init-param&amp;gt; &lt;br /&gt;
&amp;lt;param-name&amp;gt;detail&amp;lt;/param-name&amp;gt; &lt;br /&gt;
&amp;lt;param-value&amp;gt;3&amp;lt;/param-value&amp;gt; &lt;br /&gt;
&amp;lt;/init-param&amp;gt; &lt;br /&gt;
&amp;lt;load-on-startup&amp;gt;1&amp;lt;/load-on-startup&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;action&amp;lt;/servlet-name&amp;gt; &lt;br /&gt;
&amp;lt;url-pattern&amp;gt;*.do&amp;lt;/url-pattern&amp;gt; &lt;br /&gt;
&amp;lt;/servlet-mapping&amp;gt; &lt;br /&gt;
&amp;lt;welcome-file-list&amp;gt; &lt;br /&gt;
&amp;lt;welcome-file&amp;gt;index.jsp&amp;lt;/welcome-file&amp;gt; &lt;br /&gt;
&amp;lt;/welcome-file-list&amp;gt; &lt;br /&gt;
&amp;lt;taglib&amp;gt; &lt;br /&gt;
&amp;lt;taglib-uri&amp;gt;/WEB-INF/struts-html.tld&amp;lt;/taglib-uri&amp;gt; &lt;br /&gt;
&amp;lt;taglib-location&amp;gt;/WEB-INF/struts-html.tld&amp;lt;/taglib-location&amp;gt; &lt;br /&gt;
&amp;lt;/taglib&amp;gt; &lt;br /&gt;
&amp;lt;taglib&amp;gt; &lt;br /&gt;
&amp;lt;taglib-uri&amp;gt;/WEB-INF/struts-bean.tld&amp;lt;/taglib-uri&amp;gt; &lt;br /&gt;
&amp;lt;taglib-location&amp;gt;/WEB-INF/struts-bean.tld&amp;lt;/taglib-location&amp;gt; &lt;br /&gt;
&amp;lt;/taglib&amp;gt; &lt;br /&gt;
&amp;lt;/web-app&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;2) Create the struts-config.xml&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
struts-config.xml for the Struts Application&lt;br /&gt;
&lt;br /&gt;
&amp;lt;?xml version="1.0" encoding="ISO-8859-1" ?&amp;gt; &lt;br /&gt;
&amp;lt;!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.1//EN" "http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd"&amp;gt; &lt;br /&gt;
&amp;lt;struts-config&amp;gt; &lt;br /&gt;
&amp;lt;form-beans&amp;gt; &lt;br /&gt;
&amp;lt;form-bean name="CustomerForm" type="struts.example.CustomerForm"/&amp;gt; &lt;br /&gt;
&amp;lt;/form-beans&amp;gt; &lt;br /&gt;
&amp;lt;global-forwards&amp;gt; &lt;br /&gt;
&amp;lt;forward name="mainpage" path="index.jsp" /&amp;gt; &lt;br /&gt;
&amp;lt;/global-forwards&amp;gt; &lt;br /&gt;
&amp;lt;action-mappings&amp;gt; &lt;br /&gt;
&amp;lt;action path="/submitCustomerForm" &lt;br /&gt;
type="struts.example.CustomerAction" &lt;br /&gt;
name="CustomerForm" &lt;br /&gt;
scope="request" &lt;br /&gt;
validate="true" &lt;br /&gt;
input="CustomerForm.jsp"&amp;gt; &lt;br /&gt;
&amp;lt;forward name="success" path="Success.jsp" /&amp;gt; &lt;br /&gt;
&amp;lt;/action&amp;gt; &lt;br /&gt;
&amp;lt;/action-mappings&amp;gt; &lt;br /&gt;
&amp;lt;controller processorClass="org.apache.struts.action.RequestProcessor"/&amp;gt; &lt;br /&gt;
&amp;lt;message-resources parameter="struts.example.MessageResources"/&amp;gt;&lt;br /&gt;
&amp;lt;/struts-config&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;3) Create the ActionForm&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
CustomerForm&lt;br /&gt;
&lt;br /&gt;
public class CustomerForm extends ActionForm { &lt;br /&gt;
private String firstName; &lt;br /&gt;
private String lastName; &lt;br /&gt;
public CustomerForm() { &lt;br /&gt;
firstName = “”; &lt;br /&gt;
lastName = “”; &lt;br /&gt;
} &lt;br /&gt;
public String getFirstName() { &lt;br /&gt;
return firstName; &lt;br /&gt;
} &lt;br /&gt;
public void setFirstName(String s) { &lt;br /&gt;
this.firstName = s; &lt;br /&gt;
} &lt;br /&gt;
public String getLastName() { &lt;br /&gt;
return lastName; &lt;br /&gt;
} &lt;br /&gt;
public void setLastName(String s) { &lt;br /&gt;
this.lastName = s; &lt;br /&gt;
} &lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;4) Create the CustomerForm JSP using Struts Tags&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
CustomerForm.jsp&lt;br /&gt;
&lt;br /&gt;
&amp;lt;%@ page contentType="text/html;charset=UTF-8" language="java" %&amp;gt; &lt;br /&gt;
&amp;lt;%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %&amp;gt; &lt;br /&gt;
&amp;lt;%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %&amp;gt; &lt;br /&gt;
&amp;lt;html:html xhtml="true"&amp;gt; &lt;br /&gt;
&amp;lt;head&amp;gt; &lt;br /&gt;
&amp;lt;title&amp;gt;&amp;lt;bean:message key="exercise01.formpage.title"/&amp;gt;&amp;lt;/title&amp;gt; &lt;br /&gt;
&amp;lt;html:base/&amp;gt; &lt;br /&gt;
&amp;lt;/head&amp;gt; &lt;br /&gt;
&amp;lt;body background="images/blueAndWhiteBackground.gif"&amp;gt; &lt;br /&gt;
&amp;lt;h2&amp;gt;&amp;lt;bean:message key="exercise01.formpage.title"/&amp;gt;&amp;lt;/h2&amp;gt; &lt;br /&gt;
&amp;lt;html:errors/&amp;gt; &lt;br /&gt;
&amp;lt;html:form action="/submitCustomerForm"&amp;gt; &lt;br /&gt;
&amp;lt;bean:message key="prompt.customer.firstname"/&amp;gt;: &lt;br /&gt;
&amp;lt;html:text property="firstName" size="16" maxlength="16"/&amp;gt; &lt;br /&gt;
&amp;lt;BR&amp;gt; &lt;br /&gt;
&amp;lt;bean:message key="prompt.customer.lastname"/&amp;gt;: &lt;br /&gt;
&amp;lt;html:text property="lastName" size="16" maxlength="16"/&amp;gt; &lt;br /&gt;
&amp;lt;BR&amp;gt; &lt;br /&gt;
&amp;lt;html:submit property="step"&amp;gt; &lt;br /&gt;
&amp;lt;bean:message key="button.save"/&amp;gt; &lt;br /&gt;
&amp;lt;/html:submit&amp;gt; &lt;br /&gt;
&amp;nbsp; &lt;br /&gt;
&amp;lt;html:cancel&amp;gt; &lt;br /&gt;
&amp;lt;bean:message key="button.cancel"/&amp;gt; &lt;br /&gt;
&amp;lt;/html:cancel&amp;gt; &lt;br /&gt;
&amp;lt;/html:form&amp;gt; &lt;br /&gt;
&amp;lt;/body&amp;gt; &lt;br /&gt;
&amp;lt;/html:html&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;5) Create the Action class&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
CustomerAction class&lt;br /&gt;
&lt;br /&gt;
public class CustomerAction extends Action &lt;br /&gt;
{ &lt;br /&gt;
public ActionForward execute(ActionMapping mapping, ActionForm form, &lt;br /&gt;
HttpServletRequest request, HttpServletResponse response) throws Exception &lt;br /&gt;
{ &lt;br /&gt;
ActionForward nextPage = null; &lt;br /&gt;
if (isCancelled(request)) { &lt;br /&gt;
System.out.println("Cancel Operation Performed"); &lt;br /&gt;
return mapping.findForward("mainpage"); &lt;br /&gt;
} &lt;br /&gt;
CustomerForm custForm = (CustomerForm) form; &lt;br /&gt;
if ("Save".equals(custForm.getStep())) &lt;br /&gt;
{ &lt;br /&gt;
String firstName = custForm.getFirstName(); &lt;br /&gt;
String lastName = custForm.getLastName(); &lt;br /&gt;
System.out.println("Customer First name is " + firstName); &lt;br /&gt;
System.out.println("Customer Last name is " + lastName); &lt;br /&gt;
nextPage = mapping.findForward("success"); &lt;br /&gt;
} &lt;br /&gt;
return nextPage; &lt;br /&gt;
} &lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;6) Add properties to MessageResources.properties&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Message Resource Bundle&lt;br /&gt;
&lt;br /&gt;
######################################## &lt;br /&gt;
# Exercise01 index page strings &lt;br /&gt;
######################################## &lt;br /&gt;
exercise01.indexpage.title=Welcome to Exercise01&lt;br /&gt;
&lt;br /&gt;
######################################## &lt;br /&gt;
# Exercise01 CustomerForm strings &lt;br /&gt;
######################################## &lt;br /&gt;
exercise01.formpage.title=Please enter your details &lt;br /&gt;
prompt.customer.firstname=First Name &lt;br /&gt;
prompt.customer.lastname=Last Name &lt;br /&gt;
button.save=Save &lt;br /&gt;
button.cancel=Cancel &lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;7) Add validation to the Form bean&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
validate() method for CustomerForm&lt;br /&gt;
&lt;br /&gt;
public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) { &lt;br /&gt;
ActionErrors errors = new ActionErrors(); &lt;br /&gt;
// Firstname cannot be empty &lt;br /&gt;
if (firstName == null || firstName.trim().equals("")) { &lt;br /&gt;
errors.add("firstName", new ActionError("error.cust.firstname.empty")); &lt;br /&gt;
} &lt;br /&gt;
// Lastname cannot be empty &lt;br /&gt;
if (lastName == null || lastName.trim().equals("")) { &lt;br /&gt;
errors.add("lastName", new ActionError("error.cust.lastname.empty")); &lt;br /&gt;
} &lt;br /&gt;
return errors; &lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;8) Add ActionError keys to the Message Resources&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
ActionError keys to Message Resources&lt;br /&gt;
&lt;br /&gt;
######################################## &lt;br /&gt;
# Common &lt;br /&gt;
######################################## &lt;br /&gt;
errors.header=&amp;lt;h3&amp;gt;&amp;lt;font color="red"&amp;gt;Validation Error&amp;lt;/font&amp;gt;&amp;lt;/h3&amp;gt;You must&lt;br /&gt;
correct the following error(s) before proceeding:&amp;lt;ul&amp;gt; &lt;br /&gt;
errors.footer=&amp;lt;/ul&amp;gt;&amp;lt;hr&amp;gt; &lt;br /&gt;
errors.prefix=&amp;lt;li&amp;gt; &lt;br /&gt;
errors.suffix=&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
######################################## &lt;br /&gt;
# Exercise01 CustomerForm ActionErrors &lt;br /&gt;
######################################## &lt;br /&gt;
error.cust.firstname.empty=First Name is Required &lt;br /&gt;
error.cust.lastname.empty=Last Name is Required&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;9) Create the rest of the JSPs&lt;/b&gt; - index.jsp and Success.jsp. Notice that index.jsp uses the regular html:link tag that just forwards to another JSP. The Success.jsp uses the MVC compliant action mapping as the link. Define entries in MessageResource.properties for each of the bean:message keys in the JSPs.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;index.jsp&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;%@ page contentType="text/html;charset=UTF-8" language="java" %&amp;gt; &lt;br /&gt;
&amp;lt;%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %&amp;gt; &lt;br /&gt;
&amp;lt;%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %&amp;gt; &lt;br /&gt;
&amp;lt;html:html xhtml="true"&amp;gt; &lt;br /&gt;
&amp;lt;head&amp;gt; &lt;br /&gt;
&amp;lt;title&amp;gt;&amp;lt;bean:message key="exercise01.indexpage.title"/&amp;gt;&amp;lt;/title&amp;gt; &lt;br /&gt;
&amp;lt;html:base/&amp;gt; &lt;br /&gt;
&amp;lt;/head&amp;gt; &lt;br /&gt;
&amp;lt;body background="images/blueAndWhiteBackground.gif"&amp;gt; &lt;br /&gt;
&amp;lt;div align="center"&amp;gt; &lt;br /&gt;
&amp;lt;html:link page="/CustomerForm.jsp"&amp;gt;Go to Customer Form&amp;lt;/html:link&amp;gt; &lt;br /&gt;
&amp;lt;/div&amp;gt; &lt;br /&gt;
&amp;lt;/body&amp;gt; &lt;br /&gt;
&amp;lt;/html:html&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Notice the usage of bean:write tags in Success.jsp. They let you access certain beans in appropriate scope and write their properties to the Servlet/JSP OutputStream&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Success.jsp&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;%@ page contentType="text/html;charset=UTF-8" language="java" %&amp;gt; &lt;br /&gt;
&amp;lt;%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %&amp;gt; &lt;br /&gt;
&amp;lt;%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %&amp;gt; &lt;br /&gt;
&amp;lt;html:html xhtml="true"&amp;gt; &lt;br /&gt;
&amp;lt;head&amp;gt; &lt;br /&gt;
&amp;lt;title&amp;gt;&amp;lt;bean:message key="exercise01.successpage.title"/&amp;gt;&amp;lt;/title&amp;gt; &lt;br /&gt;
&amp;lt;html:base/&amp;gt; &lt;br /&gt;
&amp;lt;/head&amp;gt; &lt;br /&gt;
&amp;lt;body background="images/blueAndWhiteBackground.gif"&amp;gt; &lt;br /&gt;
&amp;lt;h2&amp;gt;&amp;lt;bean:message key="exercise01.successpage.title" /&amp;gt; &lt;br /&gt;
&amp;lt;bean:write name="CustomerForm" property="firstName" /&amp;gt; &lt;br /&gt;
&amp;lt;bean:write name="CustomerForm" property="lastName" /&amp;gt; &lt;br /&gt;
&amp;lt;/h2&amp;gt; &lt;br /&gt;
&amp;lt;h3&amp;gt;&amp;lt;bean:message key="exercise01.successpage.message" /&amp;gt;&amp;lt;/h3&amp;gt; &lt;br /&gt;
&amp;lt;html:img src="images/beerchug.gif"/&amp;gt; &lt;br /&gt;
&amp;lt;html:link page="/showCustomerForm.do"&amp;gt;Go Back&amp;lt;/html:link&amp;gt; &lt;br /&gt;
&amp;lt;/body&amp;gt; &lt;br /&gt;
&amp;lt;/html:html&amp;gt;&lt;/div&gt;</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><title>What Is the Struts Framework?</title><link>http://javaj2eetutorials.blogspot.com/2012/08/what-is-struts-framework.html</link><category>Struts</category><category>Struts Framework</category><author>noreply@blogger.com (Alex Rabe)</author><pubDate>Fri, 31 Aug 2012 04:25:00 -0700</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-2445219189346048747.post-8483979765459423272</guid><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;The Struts Framework is a standard for developing well-architected Web applications. It has the following features:&lt;br /&gt;
&lt;br /&gt;
&lt;ul style="text-align: left;"&gt;&lt;li&gt;Open source&lt;/li&gt;
&lt;li&gt;Based on the Model-View-Controller (MVC) design paradigm, distinctly separating all three levels:&lt;/li&gt;
&lt;li&gt;&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;Model: application state&lt;/li&gt;
&lt;li&gt;View: presentation of data (JSP, HTML)&lt;/li&gt;
&lt;li&gt;Controller: routing of the application flow&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;Implements the JSP Model 2 Architecture&lt;/li&gt;
&lt;li&gt;Stores application routing information and request mapping in a single core file, struts-config.xml&lt;/li&gt;
&lt;/ul&gt;&lt;br /&gt;
The Struts Framework, itself, only fills in the View and Controller layers. The Model layer is left to the developer.&lt;br /&gt;
&lt;br /&gt;
The diagram below describes the flow in more detail:&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://javaj2eetutorials.blogspot.in/2012/08/what-is-struts-framework.html" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="250" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhiBV3wEN-V7-wfHAxWgHC7ioprkDqwiTvnJgvhEnXFae0htTGZHqESJmxIfWNEO_ldhx6UgM0aSZ3wztkJmXBQ4NGd3qyZNuOROZn0fjhEd3uRX6tCDoa0fc7T_vWWNJ3Yg0tdxrkzi4NV/s320/sequence.jpg" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;ol style="text-align: left;"&gt;&lt;li&gt;&lt;b&gt;User&lt;/b&gt; clicks on a link in an HTML page.&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Servlet &lt;/b&gt;controller receives the request, looks up mapping information in struts-config.xml, and routes to an action.&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Action&lt;/b&gt; makes a call to a Model layer service.&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Service&lt;/b&gt; makes a call to the Data layer (database) and the requested data is returned.&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Service &lt;/b&gt;returns to the action.&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Action &lt;/b&gt;forwards to a View resource (JSP page)&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Servlet&lt;/b&gt; looks up the mapping for the requested resource and forwards to the appropriate JSP page.&lt;/li&gt;
&lt;li&gt;&lt;b&gt;JSP&lt;/b&gt; file is invoked and sent to the browser as HTML.&lt;/li&gt;
&lt;li&gt;&lt;b&gt;User&lt;/b&gt; is presented with a new HTML page in a web browser.&lt;/li&gt;
&lt;/ol&gt;&lt;/div&gt;</description><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" height="72" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhiBV3wEN-V7-wfHAxWgHC7ioprkDqwiTvnJgvhEnXFae0htTGZHqESJmxIfWNEO_ldhx6UgM0aSZ3wztkJmXBQ4NGd3qyZNuOROZn0fjhEd3uRX6tCDoa0fc7T_vWWNJ3Yg0tdxrkzi4NV/s72-c/sequence.jpg" width="72"/><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><title>Differences Between Struts1 and Struts2 </title><link>http://javaj2eetutorials.blogspot.com/2012/08/differences-between-struts1-and-struts2.html</link><category>Struts</category><category>Struts1</category><category>Struts2</category><author>noreply@blogger.com (Alex Rabe)</author><pubDate>Fri, 31 Aug 2012 03:30:00 -0700</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-2445219189346048747.post-2693479535069937246</guid><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;b&gt;The table given below describes some differences between struts1 and struts2 &lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;table bgcolor="#FFFFCC" border="1" cellpadding="0" style="width: 81%px;"&gt;&lt;tbody&gt;
&lt;tr&gt;     &lt;td&gt;&lt;div align="center"&gt;&lt;strong&gt;Feature &lt;/strong&gt;&lt;/div&gt;&lt;/td&gt;     &lt;td&gt;&lt;div align="center"&gt;&lt;strong&gt;Struts 1 &lt;/strong&gt;&lt;/div&gt;&lt;/td&gt;     &lt;td&gt;&lt;div align="center"&gt;&lt;strong&gt;Struts 2 &lt;/strong&gt;&lt;/div&gt;&lt;/td&gt;   &lt;/tr&gt;
&lt;tr&gt;     &lt;td&gt;&lt;div align="center"&gt;&lt;strong&gt;Action classes &lt;/strong&gt;&lt;/div&gt;&lt;/td&gt;     &lt;td&gt;Struts1 extends the abstract base class by its action class. The problem with struts1 is that it uses the abstract classes rather than interfaces. &lt;/td&gt;     &lt;td&gt;While in Struts 2, an Action class implements an Action interface, along with other interfaces use optional and custom services. Struts 2 provides a base ActionSupport class that implements commonly used interfaces. Although an Action interface is &lt;strong&gt;not &lt;/strong&gt; necessary, any POJO object along with an execute signature can be used as an Struts 2 Action object. &lt;/td&gt;   &lt;/tr&gt;
&lt;tr&gt;     &lt;td&gt;&lt;div align="center"&gt;&lt;strong&gt;Threading Model &lt;/strong&gt;&lt;/div&gt;&lt;/td&gt;     &lt;td&gt;Struts 1 Actions are singletons therefore they must be thread-safe because only one instance of a class handles all the requests for that Action. The singleton strategy restricts to Struts 1 Actions and requires extra care to make the action resources thread safe or synchronized while developing an application. &lt;/td&gt;     &lt;td&gt;Struts 2 doesn't have thread-safety issues as Action objects are instantiated for each request. A servlet container generates many throw-away objects per request, and one more object does not impose a performance penalty or impact garbage collection. &lt;/td&gt;   &lt;/tr&gt;
&lt;tr&gt;     &lt;td&gt;&lt;div align="center"&gt;&lt;strong&gt;Servlet Dependency &lt;/strong&gt;&lt;/div&gt;&lt;/td&gt;     &lt;td&gt;Actions are dependent on the servlet API because HttpServletRequest and HttpServletResponse is passed to the execute method when an Action is invoked therefore Struts1. &lt;/td&gt;     &lt;td&gt;Container does not treat the Struts 2 Actions as a couple. Servlet contexts are typically represented as simple Maps that allow Actions to be tested in isolation. Struts 2 Actions can still access the original request and response, if required. While other architectural elements directly reduce or eliminate the need to access the HttpServetRequest or HttpServletResponse. &lt;/td&gt;   &lt;/tr&gt;
&lt;tr&gt;     &lt;td&gt;&lt;div align="center"&gt;&lt;strong&gt;Testability &lt;/strong&gt;&lt;/div&gt;&lt;/td&gt;     &lt;td&gt;&lt;br /&gt;
&lt;br /&gt;
Struts1 application has a major problem while testing the application because the execute method exposes the Servlet API. Struts TestCase provides a set of mock object for Struts 1. &lt;/td&gt;     &lt;td&gt;To test the Struts 2 Actions instantiate the Action, set the properties, and invoking methods. Dependency Injection also makes testing easier. &lt;/td&gt;   &lt;/tr&gt;
&lt;tr&gt;     &lt;td&gt;&lt;div align="center"&gt;&lt;strong&gt;Harvesting Input &lt;/strong&gt;&lt;/div&gt;&lt;/td&gt;     &lt;td&gt;Struts 1 recieves an input by creating an ActionForm object. Like the action classes, all ActionForms class must extend a ActionForm base class. Other JavaBeans classes cannot be used as ActionForms, while developers create redundant classes to receive the input. DynaBeans is the best alternative to create the conventional ActionForm classes. &lt;/td&gt;     &lt;td&gt;Struts 2 requires Action properties as input properties that eliminates the need of a second input object. These Input properties may be rich object types, since they may have their own properties. Developer can access the Action properties from the web page using the taglibs. Struts 2 also supports the ActionForm pattern, POJO form objects and POJO Actions as well. &lt;/td&gt;   &lt;/tr&gt;
&lt;tr&gt;     &lt;td&gt;&lt;div align="center"&gt;&lt;strong&gt;Expression Language &lt;/strong&gt;&lt;/div&gt;&lt;/td&gt;     &lt;td&gt;Struts1 integrates with JSTL, so it uses the JSTL EL. The EL has basic object graph traversal, but relatively weak collection and indexed property support. &lt;/td&gt;     &lt;td&gt;Struts 2 can use JSTL, but the framework also supports a more powerful and flexible expression language called "Object Graph Notation Language" (OGNL). &lt;/td&gt;   &lt;/tr&gt;
&lt;tr&gt;     &lt;td&gt;&lt;div align="center"&gt;&lt;strong&gt;Binding values into views &lt;/strong&gt;&lt;/div&gt;&lt;/td&gt;     &lt;td&gt;Struts 1 binds objects into the page context by using the standard JSP mechanism. &lt;/td&gt;     &lt;td&gt;Struts 2 uses a ValueStack technology to make the values accessible to the taglibs without coupling the view to the object to which it is rendering. The ValueStack strategy enables us to reuse views across a range of types, having same property name but different property types. &lt;/td&gt;   &lt;/tr&gt;
&lt;tr&gt;     &lt;td&gt;&lt;div align="center"&gt;&lt;strong&gt;Type Conversion &lt;/strong&gt;&lt;/div&gt;&lt;/td&gt;     &lt;td&gt;Struts 1 ActionForm properties are almost in the form of Strings. Commons-Beanutils are used by used by Struts 1 for type conversion. Converters are per-class, which are not configurable per instance. &lt;/td&gt;     &lt;td&gt;Struts 2 uses OGNL for type conversion and converters to convert Basic and common object types and primitives as well. &lt;/td&gt;   &lt;/tr&gt;
&lt;tr&gt;     &lt;td&gt;&lt;div align="center"&gt;&lt;strong&gt;Validation &lt;/strong&gt;&lt;/div&gt;&lt;/td&gt;     &lt;td&gt;Struts 1 uses manual validation that is done via a validate method on the ActionForm, or by using an extension to the Commons Validator. Classes can have different validation contexts for the same class, while chaining to validations on sub-objects is not allowed. &lt;/td&gt;     &lt;td&gt;Struts 2 allows manual validation that is done by using the validate method and the XWork Validation framework. The Xwork Validation Framework allows chaining of validations into sub-properties using the validations defined for the properties class type and the validation context. &lt;/td&gt;   &lt;/tr&gt;
&lt;tr&gt;     &lt;td&gt;&lt;div align="center"&gt;&lt;strong&gt;Control of Action Execution &lt;/strong&gt;&lt;/div&gt;&lt;/td&gt;     &lt;td&gt;Each module in Struts 1 has a separate Request Processors (lifecycles), while all the Actions in the module must share the same lifecycle. &lt;/td&gt;     &lt;td&gt;In Struts 2 different lifecycles are created on a per Action basis via Interceptor Stacks. Custom stacks are created and used with different Actions, as required.s &lt;/td&gt;   &lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><title>Download and Install Hibernate</title><link>http://javaj2eetutorials.blogspot.com/2012/08/download-and-install-hibernate.html</link><category>Hibernate</category><author>noreply@blogger.com (Alex Rabe)</author><pubDate>Sat, 18 Aug 2012 05:51:00 -0700</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-2445219189346048747.post-4560690881704795860</guid><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;Let us see what are the jar files we need to download to work with hibernate framework, and how to install.&lt;br /&gt;
&lt;br /&gt;
Working with the framework software is nothing but, adding the .jar(s) files provided by that framework to our java application.  Each framework software is not an installable software, it means we do not contain any setup.exe&lt;br /&gt;
When we download any framework software, we will get a ‘&lt;b&gt;zip&lt;/b&gt;‘ file and we need to &lt;b&gt;unzip&lt;/b&gt; it, to get the jar files required, actually all framework softwares will follow same common principles like:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;ul style="text-align: left;"&gt;&lt;li&gt;Framework software will be in the form of a set of jar files, where one jar file acts as main (We can call this file as core) and remaining will  acts as dependent jar files.&lt;/li&gt;
&lt;li&gt;Each Framework software contain at least one configuration xml file, but multiple configuration files also allowed.&lt;/li&gt;
&lt;li&gt;In this case, in order to setup the Hibernate framework environment into a java application, the configuration file is the first one to be loaded into a java application, will see about this in later sessions.&lt;/li&gt;
&lt;/ul&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;u&gt;Download Hibernate .jar(s) files:&lt;/u&gt;&lt;/b&gt;&lt;br /&gt;
we can download jars related to hibernate at &lt;a href="http://sourceforge.net/projects/hibernate/files/hibernate3" rel="nofollow" target="_blank"&gt;http://sourceforge.net/projects/hibernate/files/hibernate3&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;ul style="text-align: left;"&gt;&lt;li&gt;From the above URL choose &lt;b&gt;hibernate 3.2.2-ga.zip&lt;/b&gt;,  as we are in initial stage this version will be better.&lt;/li&gt;
&lt;li&gt;Unzip it, and now you can find some jar files in the lib folder right.?, actually we doesn’t require all the jar files, out of them just select the following jar files :&lt;/li&gt;
&lt;/ul&gt;&lt;br /&gt;
&lt;b&gt;Anttr-2.7.6.jar&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;asm.jar&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;asm-attrs.jar&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;cglib-2.1.3.jar&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;commons-collections-2.1.1.jar&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;commons-logging-1.0.4.jar&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;ehcash.jar&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;dom4j-1.6.1.jar&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;hibernate3.jar&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;jta.jar&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;log4j-1.2.3.jar&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;ul style="text-align: left;"&gt;&lt;li&gt;These are the main jar files to run hibernate related programming and among all the jars hibernate3.jar is the main file, but for annotation we need to add 4 – 6 other jar files, i will let you when time comes.&lt;/li&gt;
&lt;li&gt;Remember: along with the hibernate jars we must include one more jar file, which is nothing but related to our database, this is depending on your database.&lt;/li&gt;
&lt;li&gt;So finally we need &lt;b&gt;total of 12 jar file&lt;/b&gt;s to run the hibernate related program.&lt;/li&gt;
&lt;/ul&gt;&lt;/div&gt;</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><title>EClipse Directory Structure</title><link>http://javaj2eetutorials.blogspot.com/2012/08/eclipse-directory-structure.html</link><category>eClipse</category><author>noreply@blogger.com (Alex Rabe)</author><pubDate>Sat, 18 Aug 2012 00:14:00 -0700</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-2445219189346048747.post-3673152549054725206</guid><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;br /&gt;
&lt;ul style="text-align: left;"&gt;&lt;a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi9IqEmwMhebQh8S_OxN9GqBYBPwFdlnjlTwlUNHhBcKIpIv9Pt4DCTi1CsVyUN6SNAOhQul0-clWMn0J7JMUetA7AhtGlSHqolYcQi3P2ljWTHDZicYOZt3-bepoLMektP7WxJpF0SO0yI/s1600/Eclipse-directory-structure.jpg" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"&gt;&lt;img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi9IqEmwMhebQh8S_OxN9GqBYBPwFdlnjlTwlUNHhBcKIpIv9Pt4DCTi1CsVyUN6SNAOhQul0-clWMn0J7JMUetA7AhtGlSHqolYcQi3P2ljWTHDZicYOZt3-bepoLMektP7WxJpF0SO0yI/s1600/Eclipse-directory-structure.jpg" /&gt;&lt;/a&gt;
&lt;li&gt;&lt;b&gt;WebContent:&amp;nbsp;&lt;/b&gt;Regular Web files (HTML, JavaScript, CSS, JSP, images, etc.)&lt;/li&gt;
&lt;li&gt;&lt;b&gt;WebContent/some-subdirectory:&amp;nbsp;&lt;/b&gt;Web files in subdirectory.&lt;/li&gt;
&lt;li&gt;&lt;b&gt;WebContent/WEB-INF:&lt;/b&gt;&amp;nbsp;web.xml (used for servlet mappings)&lt;/li&gt;
&lt;li&gt;&lt;b&gt;WebContent/WEB-INF/lib:&lt;/b&gt;&amp;nbsp;JAR files specific to application.&lt;/li&gt;
&lt;li&gt;&lt;b&gt;src/(default package):&amp;nbsp;&lt;/b&gt;Unpackaged (default package) Java code. Using the default package is generally a bad choice in Web apps.&lt;/li&gt;
&lt;li&gt;&lt;b&gt;src/somePackage:&lt;/b&gt;&amp;nbsp;Java code in somePackage package.&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Note:&amp;nbsp;&lt;/b&gt;You can cut/paste or drag/drop existing files into appropriate locations, but it is hard to drag files into a Java package until you create at least one class first.&lt;/li&gt;
&lt;/ul&gt;&lt;/div&gt;</description><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" height="72" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi9IqEmwMhebQh8S_OxN9GqBYBPwFdlnjlTwlUNHhBcKIpIv9Pt4DCTi1CsVyUN6SNAOhQul0-clWMn0J7JMUetA7AhtGlSHqolYcQi3P2ljWTHDZicYOZt3-bepoLMektP7WxJpF0SO0yI/s72-c/Eclipse-directory-structure.jpg" width="72"/><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><title>Java Questions</title><link>http://javaj2eetutorials.blogspot.com/2012/04/java-questions.html</link><category>forward methods</category><category>include methods</category><category>RequestDispatcher</category><category>ServletConfig</category><category>ServletContext</category><author>noreply@blogger.com (Alex Rabe)</author><pubDate>Sun, 22 Apr 2012 10:42:00 -0700</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-2445219189346048747.post-5365649438001928330</guid><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
&lt;br /&gt;
&lt;div class="MsoNormal"&gt;
&lt;b&gt;1. What is the
difference between ServletContext and ServletConfig? &lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
Both are interfaces. The servlet engine implements the
ServletConfig interface in order to pass configuration information to a
servlet. The server passes an object that implements the ServletConfig
interface to the servlet's init() method.&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
The ServletContext interface provides information to
servlets regarding the environment in which they are &lt;br /&gt;
&lt;a name='more'&gt;&lt;/a&gt;running. It also provides
standard way for servlets to write events to a log file.&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;b&gt;&lt;span class="tdvamseel"&gt;&lt;span style="font-size: 13pt;"&gt;2.What
are forward &amp;amp; include methods? Why these are used?&lt;/span&gt;&lt;/span&gt;&amp;nbsp;&lt;/b&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
Both forward() and include() are concrete methods of the
RequestDispatcher class in the Servlet context. forward() - this method is used
to show a different resource in place of the servlet originally requested.&lt;/div&gt;
&lt;/div&gt;</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><title>Hibernate's Main Feature</title><link>http://javaj2eetutorials.blogspot.com/2012/04/hibernates-main-feature.html</link><category>Hibernate Features</category><author>noreply@blogger.com (Alex Rabe)</author><pubDate>Mon, 16 Apr 2012 02:10:00 -0700</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-2445219189346048747.post-7666460624078005410</guid><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
The most important Hibernate's feature is mapping from Java classes to database tables (and from Java data types to SQL data types), but also to provides data query ( and retrieval facilities ).&lt;br /&gt;
It is important that Hibernate generates the SQL calls and relieves keeping the application portable to all SQL databases, with database portability delivered at very little performance overhead.This feature can significialy reduce development time that programmer would have to spent with manual data handling in SQL and JDBC.&lt;br /&gt;
&lt;a name='more'&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Reasuming Hibernate allows to create high-performance database applications with Java much faster and easier. Thanks to transparent persistence for Plain Old Java Objects (POJOs) all you need to do is build a simple POJO, next create XML mapping file that will describe relationship between the databse and the class attributes and at the end call Hibernate API's to specify the operations&lt;br /&gt;
&lt;br /&gt;
You can use Hibernate as in standalone Java applications or as in Java EE applications using servlets or EJB session beans.&lt;/div&gt;</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><title>What is a Hibernate?</title><link>http://javaj2eetutorials.blogspot.com/2012/04/what-is-hibernate.html</link><category>Hibernate</category><category>J2EE</category><author>noreply@blogger.com (Alex Rabe)</author><pubDate>Mon, 16 Apr 2012 01:58:00 -0700</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-2445219189346048747.post-8618457758025268827</guid><description>Hibernate is an open source object (relational) mapping library for the Java language,that provides persistent classes and logic without caring how to handle the data.&lt;br /&gt;&lt;br /&gt;Persistance in Java ( Hibernate ) is storing data in a relational databse using SQL.</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><title>How does hibernate generate beans and DAO(Data Access Object) from database?</title><link>http://javaj2eetutorials.blogspot.com/2012/04/how-does-hibernate-generate-beans-and.html</link><category>Beans</category><category>Hibernate</category><category>Java DAO</category><author>noreply@blogger.com (Alex Rabe)</author><pubDate>Sun, 15 Apr 2012 02:17:00 -0700</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-2445219189346048747.post-585244200853089884</guid><description>&lt;div style="text-align: left;"&gt;&lt;span style="font-size: 100%; "&gt;This movie shows some basics about generating beans and DAO (Data Access Object)* from database. To achieve this in this sample we are using JBoss Tools which have Hibernate reverse engineering. That's all for now. Enjoy the movie!&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;The Java Data Access Object (Java DAO) is an important component in business applications. Business applications almost always need access to data from relational or object databases and the Java platform offers many techniques for accessing this data. The oldest and most mature technique is to use the Java Database Connectivity (JDBC) API, which provides the capability to execute SQL queries against a database and then fetch the results, one column at a time. Although this API provides everything a developer needs to access data and to persist application state, it is a cumbersome API to develop against - which makes a Java DAO code generator particularly useful.&lt;br /&gt;&lt;iframe width="420" height="315" src="http://www.youtube.com/embed/zfQP2iO-fBw" frameborder="0" allowfullscreen=""&gt;&lt;/iframe&gt;</description><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" height="72" url="https://img.youtube.com/vi/zfQP2iO-fBw/default.jpg" width="72"/><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><title>Login Form Example With Struts</title><link>http://javaj2eetutorials.blogspot.com/2012/03/login-form-example-with-struts.html</link><category>Login Form Struts</category><author>noreply@blogger.com (Alex Rabe)</author><pubDate>Wed, 28 Mar 2012 01:16:00 -0700</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-2445219189346048747.post-614925696263051114</guid><description>&lt;b&gt;Login Form Example With Struts&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;This post will show you how a form process in struts 1 framework. We will create a login form and then using struts 1 we will verify the authentication of the user. This example will take following steps :&lt;br /&gt;&lt;ol&gt;&lt;li&gt;First of all we will create a form bean (LoginForm.java) that will hold the form values provided by the user.&lt;/li&gt;&lt;li&gt;Create a jsp page (Login.jsp) which will contain the form to be displayed to the user.&lt;/li&gt;&lt;li&gt;Create a success page (Success.jsp) and failure page (Failure.jsp) for providing feedback to the user on their form submission.&lt;/li&gt;&lt;li&gt;Create a controller helper class (LoginAction.java) that will check for the user input and decide which view to be respond to the users (Success.jsp or Failure.jsp).&lt;/li&gt;&lt;li&gt;And finally we will configure our form bean and action classes in struts-config.xml.&lt;/li&gt;&lt;/ol&gt;&lt;b&gt;LoginForm.java&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Following is the code in LoginForm.java file:&lt;/b&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;package com.demo.form;&lt;br /&gt;&lt;br /&gt;import javax.servlet.http.HttpServletRequest;&lt;br /&gt;&lt;br /&gt;import org.apache.struts.action.ActionForm;&lt;br /&gt;import org.apache.struts.action.ActionMapping;&lt;br /&gt;&lt;br /&gt;public class LoginForm extends ActionForm {&lt;br /&gt;&lt;br /&gt;private static final long serialVersionUID = -3491637470205228033L;&lt;br /&gt;&lt;br /&gt;private String userName = null;&lt;br /&gt;private String passWord = null;&lt;br /&gt;&lt;br /&gt;public String getUsername() {&lt;br /&gt;return username;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public void setUsername(String userName {&lt;br /&gt;this.userName = userName;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public String getPassword() {&lt;br /&gt;return passWord;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public void setPassword(String passWord) {&lt;br /&gt;this.passWord = passWord;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;@Override&lt;br /&gt;public void reset(ActionMapping mapping, HttpServletRequest request) {&lt;br /&gt;this.passWord = null;&lt;br /&gt;}&lt;br /&gt;}&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;There are two fields in this form bean “username” and “password”, that will hold the value of two fields in the login form. One new goods here is the method “reset” which is overwritten by our form bean. “reset” method is called at the end of the every request processed by the struts. In reset method we have set the value of password as null which means every time the user will open the login jsp in browser it will show the last username but will not show the value of password.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Login.jsp&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;Bellow are the content of Login.jsp:&lt;div&gt;&lt;br /&gt;&lt;a href="#"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 168px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiwia51WuZTiBTONPJ0PoygvS7PfxGYYfIEj3xvx8PV9oYCOEbGv05MJImF-iC2ziU7bsKInNcS0E64FiU514pNAs3KL7WL4SY07srIH-jClZNf0LUaO9Ytr4gl7xeBkGZA0uGzghiQaiWK/s400/Login.jsp.jpg" border="0" alt="" id="BLOGGER_PHOTO_ID_5724861364847627266" /&gt;&lt;/a&gt;&lt;br /&gt;This jsp will render a form with two fields, “userName” and “passWord”. Struts HTML taglib has been used to create the form. &lt;html:form action="”/Login”" focus="”username”"&gt; will render as a html form with submit url as “/Login.do”, so our action must use this path in configuration to be run. &lt;html:text property="”username”/"&gt; will be render as html input tag and it’s value will be put in the “username” field of the form bean LoginForm. Same with the property “password”.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;LoginAction.java&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Lets look inside the code in LoginAction.java:&lt;/b&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;public class LoginAction extends Action {&lt;br /&gt;@Override&lt;br /&gt;public ActionForward execute(ActionMapping mapping, ActionForm form,&lt;br /&gt;HttpServletRequest request, HttpServletResponse response)&lt;br /&gt;throws Exception {&lt;br /&gt;LoginForm loginForm = (LoginForm)form;&lt;br /&gt;if(loginForm.getUsername() == null || loginForm.getPassword() == null ||&lt;br /&gt;!loginForm.getUsername().equalsIgnoreCase("abc") || !loginForm.getPassword().equals("123")){&lt;br /&gt;    return mapping.findForward("failure");&lt;br /&gt;}&lt;br /&gt;else&lt;br /&gt;    return mapping.findForward("success");&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;As you can see first of all the ActionForm instance is typecast to LoginForm in the execute method of LoginAction and then logic to verify the username and password will decide which view to be send back to the user. In this case, username must be “rahul” ans password must be “abc” to go to the view associated with the “success”, otherwise view associated with “failure” will be returned. We can see the jsp files associated with “success” and “failure”.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;struts-config.xml&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;Entries of form beans and actions aer done in struts-config.xml as follows :&lt;br /&gt;&lt;br /&gt;&lt;a href="#"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 161px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi4nhk5F-OZz7Mhv6fqFWXTh39BPc4yXez12i7yUesYozng42dSdv5gWJnkvyeZqyD_ll4ZW1CiQ_LiE3BlszrEvFvZ9HJ_sDRUloMLvFtXu-BBXpLZz9IhOw6m2zLLN_9B99FwGHP0VwUE/s400/struts-config.jpg" border="0" alt="" id="BLOGGER_PHOTO_ID_5724861037199471522" /&gt;&lt;/a&gt;&lt;br /&gt;Our LoginForm class has been added as a form bean named “loginForm” and associated with the action class LoginAction. Attributes  associated with the action class are specified as with the following reason :&lt;br /&gt;&lt;br /&gt;name=”loginForm” : Struts will instantiate the LoginForm class will set the value of form properties.&lt;br /&gt;path=”/Login” : The action class will be associated with the request path “/Login.do”. Hence the Login.jsp contains “/Login” as action attribute value.&lt;br /&gt;input=”/Login.jsp” : Form inputs will be taken from Login.jsp.&lt;br /&gt;There are two action forwards also registered with our action which tells struts that if “failure” is return by action then the response view will be “/Failure.jsp” and if “success” is returned by action then the response view will be “/Success.jsp”.&lt;br /&gt;&lt;br /&gt;Deploy the war file in Tomcat 6 and hit the url in your browser you will get the following login form:&lt;/html:text&gt;&lt;/html:form&gt;&lt;/div&gt;</description><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" height="72" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiwia51WuZTiBTONPJ0PoygvS7PfxGYYfIEj3xvx8PV9oYCOEbGv05MJImF-iC2ziU7bsKInNcS0E64FiU514pNAs3KL7WL4SY07srIH-jClZNf0LUaO9Ytr4gl7xeBkGZA0uGzghiQaiWK/s72-c/Login.jsp.jpg" width="72"/><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><title>Struts 1 Taglib</title><link>http://javaj2eetutorials.blogspot.com/2012/03/struts-1-taglib.html</link><category>Struts Taglib</category><author>noreply@blogger.com (Alex Rabe)</author><pubDate>Sat, 24 Mar 2012 06:10:00 -0700</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-2445219189346048747.post-9194227938921330574</guid><description>The Struts Taglib component provides a set of JSP custom tag libraries that help developers create interactive form-based applications. There are tags to help with everything from displaying error messages to dealing with nested ActionForm beans.&lt;br /&gt;&lt;br /&gt;Struts Taglib is composed of four distinct tag libraries: Bean, HTML, Logic, and Nested.&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;b style="font-size: 100%; "&gt;Bean:&lt;/b&gt;&lt;span style="font-size: 100%; "&gt;  The bean tags are useful in defining new beans (in any scope) from a variety of possible sources, as well as a tag to render a particular bean (or bean property) to the output response.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;b style="font-size: 100%; "&gt;HTML:&lt;/b&gt;&lt;span style="font-size: 100%; "&gt;  The HTML tags are used to create input forms, as well as other tags generally useful in the creation of HTML-based user interfaces. The output is HTML 4.01 compliant or XHTML 1.0 when in XHTML mode.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;b style="font-size: 100%; "&gt;Logic:&lt;/b&gt;&lt;span style="font-size: 100%; "&gt;  The Logic tags that are useful in managing conditional generation of output text, looping over object collections for repetitive generation of output text, and application flow management&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;b style="font-size: 100%; "&gt;Nested:&lt;/b&gt;&lt;span style="font-size: 100%; "&gt;  The Nested tags extend the base Struts tags to allow them to relate to each other in a nested nature. The fundamental logic of the original tags doesn't change, except in that all references to beans and bean properties will be managed in a nested context.&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><title>Struts: Structuring a Web Application</title><link>http://javaj2eetutorials.blogspot.com/2012/03/struts-structuring-web-application.html</link><category>Struts</category><category>Struts Example</category><category>Web Application</category><category>Webb Application Structure</category><author>noreply@blogger.com (Alex Rabe)</author><pubDate>Sat, 24 Mar 2012 00:18:00 -0700</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-2445219189346048747.post-4349857255708369188</guid><description>&lt;div style="text-align: left;"&gt;&lt;span style="font-size: 100%; text-align: left; "&gt;Web application as a program that resides on a Web server and produces dynamically or static created pages in a hypertext markup language (most commonly HTML) in response to a user’s request. A user make request by clicking the link or button on the web page. To built the Web application, Java 2 Enterprise Edition (J2EE) must be used.&lt;/span&gt;&lt;/div&gt;&lt;b style="font-family: Georgia, serif; font-size: 100%; font-style: normal; font-variant: normal; line-height: normal; "&gt;&lt;div&gt;&lt;b style="font-family: Georgia, serif; font-size: 100%; font-style: normal; font-variant: normal; line-height: normal; "&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;Web Container :&lt;/b&gt;&lt;br /&gt;&lt;span&gt;&lt;span style="font-size: 100%;"&gt;A web container is a program that manages the components of a Web application, in particular JSP pages and Java Servlets. A Web container provides a number of services, such as&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;ul style="font-family: Georgia, serif; font-size: 100%; font-style: normal; font-variant: normal; line-height: normal; "&gt;&lt;li&gt;&lt;b style="font-size: 100%; "&gt;Life-Cycle management: &lt;/b&gt;&lt;span style="font-size: 100%; "&gt;Web container provide the process of starting up and shutting down a component.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;b style="font-size: 100%; "&gt;Concurrency:&lt;/b&gt;&lt;span style="font-size: 100%; "&gt;  Provide the capability to process more than one action at a time.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: 100%; "&gt;Security : Provide the restricted access to components, such as username &amp;amp; password protection.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;b style="font-size: 100%; "&gt;Portability:&lt;/b&gt;&lt;span style="font-size: 100%; "&gt; Access anywhere, taking very less resource.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: 100%; "&gt;Apache  Tomcat &amp;amp; GlassFish Server are the example of a Web container, — an open-source implementation of the J2EE Java Servlet and JavaServer Pages (JSP) specifications. A specification is a document that describes all the details of a technology. Typically, a Web container also functions as a Web server, providing basic HTTP (Hypertext Transfer Protocol) support for users who want to access information on the site.&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:left;cursor:pointer; cursor:hand;width: 337px; height: 231px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhS-bvtQXBuLvmTQOLmOWwGeHJc6bPG0-eSdzbivPrHRc43R99VZEB5NyqXyvpdeL72ocWMVvoVNrBd4bKrnYk1zIYtG42u82EdZC9f8x4hy70sNpoU7hH8kCDIzUQMNXf4HYveaAkhMPeF/s400/Structure-of-Web-Application.png" border="0" alt="Structuring a Web Application" id="BLOGGER_PHOTO_ID_5723360221483771570" /&gt;</description><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" height="72" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhS-bvtQXBuLvmTQOLmOWwGeHJc6bPG0-eSdzbivPrHRc43R99VZEB5NyqXyvpdeL72ocWMVvoVNrBd4bKrnYk1zIYtG42u82EdZC9f8x4hy70sNpoU7hH8kCDIzUQMNXf4HYveaAkhMPeF/s72-c/Structure-of-Web-Application.png" width="72"/><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><title>Struts Example</title><link>http://javaj2eetutorials.blogspot.com/2012/03/struts-example.html</link><category>Hybernate</category><category>Struts</category><category>Struts Example</category><author>noreply@blogger.com (Alex Rabe)</author><pubDate>Fri, 23 Mar 2012 04:42:00 -0700</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-2445219189346048747.post-3386201813804178088</guid><description>&lt;span &gt;&lt;span style="font-size: 100%;"&gt;Struts is modeled after the MVC design pattern, you can follow a standard development process for all of your Struts Web applications.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span &gt;&lt;span style="font-size: 100%;"&gt;Identificaty of the application Views, the Controller objects that will service those Views, and the Model components being operated on.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span &gt;&lt;span style="font-size: 100%;"&gt;1. Define and create all of the Views, in relation to their purpose, that will represent the user interface of our application. Add all ActionForms used by the created Views to the struts-config.xml file.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span &gt;&lt;span style="font-size: 100%;"&gt;2. Create the components of the application’s Controller.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span &gt;&lt;span style="font-size: 100%;"&gt;3. Define the relationships that exist between the Views and the Controllers (struts-config.xml).&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span &gt;&lt;span style="font-size: 100%;"&gt;4. Make the appropriate modifications to the web.xml file, describe the Struts components to the Web application.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span &gt;&lt;span style="font-size: 100%;"&gt;Lets Start with step one. we will create the view file named index.jsp&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;b style="font-family: Georgia, serif; font-size: 100%; font-style: normal; font-variant: normal; line-height: normal; "&gt;&lt;br /&gt;&lt;/b&gt;&lt;div style="font-family: Georgia, serif; font-size: 100%; font-style: normal; font-variant: normal; line-height: normal; "&gt;&lt;b&gt;index.jsp&lt;/b&gt;&lt;br /&gt;&lt;code&gt;&lt;/code&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;code&gt;&lt;span &gt;&lt;link rel="stylesheet" type="text/css" href="http://www.manoli.net/csharpformat/csharp.css"&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;div&gt;&lt;code&gt;&lt;span &gt;&lt;/span&gt;&lt;pre class="csharpcode" style="font-weight: normal; "&gt;&lt;span &gt;&lt;code&gt;&lt;/code&gt;&lt;/span&gt;&lt;/pre&gt;&lt;/code&gt;&lt;/div&gt;&lt;div&gt;&lt;code&gt;&lt;code&gt;&lt;span &gt;&amp;lt;%@ page language="java" %&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/code&gt;&lt;/div&gt;&lt;div&gt;&lt;code&gt;&lt;code&gt;&lt;span &gt;&amp;lt;%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/code&gt;&lt;/div&gt;&lt;div&gt;&lt;code&gt;&lt;code&gt;&lt;span style="font-family: Georgia, serif; "&gt;&lt;/span&gt;&lt;/code&gt;&lt;/code&gt;&lt;/div&gt;&lt;div&gt;&lt;code&gt;&lt;code&gt;&lt;span &gt;&lt;/span&gt;&lt;/code&gt;&lt;/code&gt;&lt;/div&gt;&lt;div&gt;&lt;code&gt;&lt;code&gt;&lt;span &gt;&lt;title&gt;Sample Struts Application&lt;/title&gt;&lt;/span&gt;&lt;/code&gt;&lt;/code&gt;&lt;/div&gt;&lt;div&gt;&lt;code&gt;&lt;code&gt;&lt;span &gt;&lt;/span&gt;&lt;/code&gt;&lt;/code&gt;&lt;/div&gt;&lt;div&gt;&lt;code&gt;&lt;code&gt;&lt;span &gt;&lt;/span&gt;&lt;/code&gt;&lt;/code&gt;&lt;/div&gt;&lt;div&gt;&lt;code&gt;&lt;code&gt;&lt;span &gt; &lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;html:form action="Name" name="nameForm" type="example.NameForm"&gt;&lt;/html:form&gt;&lt;/span&gt;&lt;/code&gt;&lt;/code&gt;&lt;/div&gt;&lt;div&gt;&lt;code&gt;&lt;code&gt;&lt;span &gt; &lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt; &lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;div&gt;&lt;span &gt; &lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt; &lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt; &lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span &gt; &lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt; &lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt; &lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt; &lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span &gt; &lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt; &lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt; &lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt; &lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span &gt; &lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt; &lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt; &lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span &gt; &lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt; &lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt; &lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span &gt; &lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt; &lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt; &lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt; &lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span &gt; &lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt; &lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt; &lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span &gt; &lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt; &lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;table width="80%" border="0"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;Name:&lt;/td&gt;&lt;td&gt;&lt;html:text property="name"&gt;&lt;/html:text&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;html:submit&gt;&lt;/html:submit&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/span&gt;&lt;/code&gt;&lt;/code&gt;&lt;/div&gt;&lt;div&gt;&lt;code&gt;&lt;code&gt;&lt;span &gt;&lt;span &gt; &lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/code&gt;&lt;/div&gt;&lt;div&gt;&lt;code&gt;&lt;code&gt;&lt;span &gt;&lt;span &gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/code&gt;&lt;/div&gt;&lt;div&gt;&lt;code&gt;&lt;code&gt;&lt;span &gt;&lt;span &gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/code&gt;&lt;/div&gt;&lt;div&gt;&lt;code&gt;&lt;code&gt;&lt;span &gt;&lt;span &gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/code&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;code&gt;&lt;span &gt;&lt;span &gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;div&gt;&lt;p style="text-align: -webkit-auto; "&gt;&lt;code&gt;&lt;span &gt;&lt;span  &gt;We have used some Struts-specific Form tag like &lt;html:form&gt; instead of HTML tags.&lt;br /&gt;&lt;br /&gt;In the Form tags the attributes you can find some attributes defined in we will go through it.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;action &lt;/strong&gt;: Represents the URL to which this form will be submitted. This attribute is also used to find the appropriate ActionMapping in the Struts configuration file, which we will describe later in this section. The value used in our example is Name, which will map to an ActionMapping with a path attribute equal to Name.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;name &lt;/strong&gt;:Identifies the key that the ActionForm will be referenced by. We use the value NameForm. An ActionForm is an object that is used by Struts to represent the form data as a JavaBean. It main purpose is to pass form data between View and Controller components. We will discuss NameForm later in this section.&lt;br /&gt;&lt;strong&gt;type &lt;/strong&gt;:Names the fully qualified class name of the form bean to use in this request. For this example, we use thevalue example.NameForm, which is an ActionForm object containing data members matching the inputs of this form.&lt;/html:form&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/p&gt;&lt;p style="text-align: -webkit-auto; "&gt;&lt;code&gt;&lt;span &gt;&lt;span  &gt;To use the HTML tags, you must first add a taglib entry in the application’s web.xml file that references the URI /WEB-INF/struts-html.tld. This TLD describes all of the tags in the HTML tag library. The following snippet shows the &lt;taglib&gt; element that must be added to the web.xml file:&lt;/taglib&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/p&gt;&lt;p style="text-align: -webkit-auto; "&gt;&lt;code&gt;&lt;span &gt;&lt;span  &gt;&lt;code&gt;&lt;/code&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/p&gt;&lt;p style="text-align: -webkit-auto; "&gt;&lt;/p&gt;&lt;table width="100%" border="0"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td colspan="2"&gt;&lt;strong&gt;&lt;span  &gt;&lt;taglib&gt;&lt;/taglib&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td width="4%"&gt; &lt;/td&gt;&lt;td width="96%"&gt;&lt;strong&gt;&lt;span  &gt;&lt;taglib-uri&gt;/WEB-INF/struts-html.tld&lt;/taglib-uri&gt;&lt;br /&gt;&lt;taglib-location&gt;/WEB-INF/struts-html.tld&lt;/taglib-location&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td colspan="2"&gt;&lt;strong&gt;&lt;span  &gt;&lt;/span&gt;&lt;/strong&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;p&gt;&lt;/p&gt;&lt;p style="text-align: -webkit-auto; "&gt;&lt;code&gt;&lt;span &gt;&lt;code&gt;&lt;span  &gt;&lt;/span&gt;&lt;/code&gt;&lt;/span&gt;&lt;/code&gt;&lt;/p&gt;&lt;p style="text-align: -webkit-auto; "&gt;&lt;code&gt;&lt;span &gt;&lt;span style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: small; "&gt;The struts-html.tld is placed in the /WEB_INF directory.&lt;/span&gt;&lt;br style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: small; "&gt;&lt;br style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: small; "&gt;&lt;span style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: small; "&gt;Next Step is to create the action form&lt;/span&gt;&lt;br style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: small; "&gt;&lt;br style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: small; "&gt;&lt;span style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: small; "&gt;The ActionForm used in this example contains a single data member that maps directly to the &lt;/span&gt;&lt;strong style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: small; "&gt;name&lt;/strong&gt;&lt;span style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: small; "&gt;input parameter of the form defined in the index.jsp View. When an &lt;html:form&gt; is submitted, the Struts framework populates the matching data members of the ActionForm with the values entered into the &lt;html:input&gt; tags. The Struts framework does this by using JavaBean reflection. The accessors of the ActionForm must follow the JavaBean standard naming convention for example&lt;/html:input&gt;&lt;/html:form&gt;&lt;/span&gt;&lt;br style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: small; "&gt;&lt;br style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: small; "&gt;&lt;span style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: small; "&gt;private String name;&lt;/span&gt;&lt;br style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: small; "&gt;&lt;span style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: small; "&gt;public void setName(String name);&lt;/span&gt;&lt;br style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: small; "&gt;&lt;span style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: small; "&gt;public String getName(); &lt;/span&gt;&lt;br style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: small; "&gt;&lt;br style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: small; "&gt;&lt;span style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: small; "&gt;The NameForm.java file is shown below&lt;/span&gt;&lt;br style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: small; "&gt;&lt;em style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: small; "&gt;&lt;strong&gt;NameForm.java &lt;/strong&gt;&lt;/em&gt;&lt;br style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: small; "&gt;&lt;/span&gt;&lt;/code&gt;&lt;/p&gt;&lt;p style="text-align: -webkit-auto; "&gt;&lt;code&gt;&lt;span &gt;&lt;em style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: small; "&gt;&lt;code&gt;&lt;/code&gt;&lt;/em&gt;&lt;/span&gt;&lt;/code&gt;&lt;/p&gt;&lt;p style="text-align: -webkit-auto; "&gt;&lt;/p&gt;&lt;p&gt;&lt;code&gt;&lt;span &gt;&lt;code&gt;&lt;span  &gt;&lt;strong&gt;package example;&lt;/strong&gt;&lt;br /&gt;&lt;span &gt;//import statements&lt;/span&gt;&lt;br /&gt;&lt;strong&gt;import javax.servlet.http.HttpServletRequest;&lt;br /&gt;import org.apache.struts.action.ActionForm;&lt;br /&gt;import org.apache.struts.action.ActionMapping;&lt;/strong&gt;&lt;/span&gt;&lt;/code&gt;&lt;/span&gt;&lt;/code&gt;&lt;/p&gt;&lt;table width="100%" border="0"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td colspan="3"&gt;&lt;strong&gt;&lt;span  &gt;public class NameForm extends ActionForm {&lt;/span&gt;&lt;/strong&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td width="4%"&gt; &lt;/td&gt;&lt;td colspan="2"&gt;&lt;strong&gt;&lt;span  &gt;private String name = null;&lt;br /&gt;public String getName() {&lt;/span&gt;&lt;/strong&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt; &lt;/td&gt;&lt;td width="4%"&gt; &lt;/td&gt;&lt;td width="92%"&gt;&lt;strong&gt;&lt;span  &gt;return (name);&lt;/span&gt;&lt;/strong&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt; &lt;/td&gt;&lt;td&gt;&lt;strong&gt;&lt;span  &gt;}&lt;/span&gt;&lt;/strong&gt;&lt;/td&gt;&lt;td&gt; &lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt; &lt;/td&gt;&lt;td colspan="2"&gt;&lt;strong&gt;&lt;span  &gt;public void setName(String name) {&lt;/span&gt;&lt;/strong&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt; &lt;/td&gt;&lt;td&gt; &lt;/td&gt;&lt;td&gt;&lt;strong&gt;&lt;span  &gt;this.name = name;&lt;/span&gt;&lt;/strong&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt; &lt;/td&gt;&lt;td&gt;&lt;strong&gt;&lt;span  &gt;}&lt;/span&gt;&lt;/strong&gt;&lt;/td&gt;&lt;td&gt; &lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt; &lt;/td&gt;&lt;td colspan="2"&gt;&lt;strong&gt;&lt;span  &gt;public void reset(ActionMapping mapping, HttpServletRequest request) {&lt;/span&gt;&lt;/strong&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt; &lt;/td&gt;&lt;td&gt; &lt;/td&gt;&lt;td&gt;&lt;strong&gt;&lt;span  &gt;this.name = null;&lt;/span&gt;&lt;/strong&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt; &lt;/td&gt;&lt;td&gt;&lt;strong&gt;&lt;span  &gt;}&lt;/span&gt;&lt;/strong&gt;&lt;/td&gt;&lt;td&gt; &lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td colspan="3"&gt;&lt;strong&gt;&lt;span  &gt;}&lt;/span&gt;&lt;/strong&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;p&gt;&lt;/p&gt;&lt;p style="text-align: -webkit-auto; "&gt;&lt;code&gt;&lt;span &gt;&lt;code&gt;&lt;em style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: small; "&gt;&lt;/em&gt;&lt;/code&gt;&lt;/span&gt;&lt;/code&gt;&lt;/p&gt;&lt;p style="text-align: -webkit-auto; "&gt;&lt;/p&gt;&lt;p&gt;&lt;code&gt;&lt;span &gt;&lt;span  &gt;To deploy the NameForm to our Struts application, you need to compile this class, move it to the /WEB-INF/classes/example directory, and add the following line to the &lt;form-beans&gt; section of the /WEB-INF/struts-config.xml file:&lt;/form-beans&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/p&gt;&lt;p&gt;&lt;code&gt;&lt;span &gt;&lt;span  &gt;&lt;form-bean name="nameForm" type="example.NameForm"&gt;&lt;br /&gt;&lt;br /&gt;This makes the Struts application aware of the NameForm and how it should be referenced.&lt;br /&gt;&lt;br /&gt;Now we create the out page for the sample application.&lt;br /&gt;Lets name it diplayname.jsp&lt;br /&gt;&lt;strong&gt;displayname.jsp&lt;/strong&gt;&lt;/form-bean&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/p&gt;&lt;p&gt;&lt;code&gt;&lt;span &gt;&lt;span  &gt;&lt;code&gt;&lt;/code&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;table width="100%" border="0"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td colspan="5"&gt;&lt;strong&gt;&lt;span  &gt;&lt;br /&gt;&lt;br /&gt;&lt;title&gt;Sample Struts Display Name&lt;/title&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td width="2%"&gt; &lt;/td&gt;&lt;td width="2%"&gt; &lt;/td&gt;&lt;td colspan="3"&gt;&lt;strong&gt;&lt;span  &gt;&lt;table width="80%" border="0"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt; &lt;/td&gt;&lt;td&gt; &lt;/td&gt;&lt;td width="2%"&gt; &lt;/td&gt;&lt;td colspan="2"&gt;&lt;strong&gt;&lt;span  &gt;&lt;/span&gt;&lt;/strong&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt; &lt;/td&gt;&lt;td&gt; &lt;/td&gt;&lt;td&gt; &lt;/td&gt;&lt;td width="2%"&gt; &lt;/td&gt;&lt;td width="92%"&gt;&lt;strong&gt;&lt;span  &gt;&lt;/span&gt;&lt;/strong&gt;&lt;/td&gt;&lt;td&gt;Hello &amp;lt;%= request.getAttribute("NAME") %&amp;gt; !!&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt; &lt;/td&gt;&lt;td&gt; &lt;/td&gt;&lt;td&gt; &lt;/td&gt;&lt;td colspan="2"&gt;&lt;strong&gt;&lt;span  &gt;&lt;/span&gt;&lt;/strong&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt; &lt;/td&gt;&lt;td&gt; &lt;/td&gt;&lt;td colspan="3"&gt;&lt;strong&gt;&lt;span  &gt;&lt;/span&gt;&lt;/strong&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td colspan="5"&gt;&lt;strong&gt;&lt;span  &gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;code&gt;&lt;span &gt;&lt;code&gt;&lt;span  &gt;&lt;/span&gt;&lt;/code&gt;&lt;/span&gt;&lt;/code&gt;&lt;/p&gt;&lt;p&gt;&lt;code&gt;&lt;span &gt;&lt;span style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: small; "&gt;Now we move to the step two of creating the application's controller&lt;/span&gt;&lt;br style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: small; "&gt;&lt;br style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: small; "&gt;&lt;span style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: small; "&gt;In a Struts application, two components make up the Controller. These two components are the&lt;/span&gt;&lt;strong style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: small; "&gt;org.apache.struts.action.ActionServlet &lt;/strong&gt;&lt;span style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: small; "&gt;and the &lt;/span&gt;&lt;strong style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: small; "&gt;org.apache. struts.action.Action&lt;/strong&gt;&lt;span style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: small; "&gt; classes. In most Struts applications, there is one org. &lt;/span&gt;&lt;strong style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: small; "&gt;apache.struts.action.ActionServlet&lt;/strong&gt;&lt;span style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: small; "&gt; implementation and can have many &lt;/span&gt;&lt;strong style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: small; "&gt;org.apache. struts.action.Action&lt;/strong&gt;&lt;span style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: small; "&gt; implementations.&lt;/span&gt;&lt;br style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: small; "&gt;&lt;br style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: small; "&gt;&lt;span style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: small; "&gt;The &lt;/span&gt;&lt;strong style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: small; "&gt;org.apache.struts.action.ActionServlet&lt;/strong&gt;&lt;span style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: small; "&gt; is the Controller component that handles client requests and determines which &lt;/span&gt;&lt;strong style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: small; "&gt;org.apache.struts.action.Action&lt;/strong&gt;&lt;span style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: small; "&gt; will process the received request. When assembling simple applications, such as the one we are building, the default ActionServlet will satisfy your application needs, and therefore, you do not need to create a specialized&lt;/span&gt;&lt;strong style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: small; "&gt;org.apache.struts.action.ActionServlet &lt;/strong&gt;&lt;span style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: small; "&gt;implementation. &lt;/span&gt;&lt;br style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: small; "&gt;&lt;br style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: small; "&gt;&lt;span style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: small; "&gt;The second component of a Struts Controller is the &lt;/span&gt;&lt;strong style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: small; "&gt;org.apache.struts. action.Action &lt;/strong&gt;&lt;span style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: small; "&gt;class. As opposed to the ActionServlet, the Action class must be extended for each specialized function in your application. This class is where your application’s specific logic begins.&lt;/span&gt;&lt;br style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: small; "&gt;&lt;em style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: small; "&gt;&lt;strong&gt;NameAction.java&lt;/strong&gt;&lt;/em&gt; &lt;/span&gt;&lt;/code&gt;&lt;/p&gt;&lt;p&gt;&lt;code&gt;&lt;span &gt;&lt;em style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: small; "&gt;&lt;code&gt;&lt;/code&gt;&lt;/em&gt;&lt;/span&gt;&lt;/code&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;code&gt;&lt;span &gt;&lt;code&gt;&lt;span  &gt;&lt;strong&gt;package example;&lt;br /&gt;&lt;br /&gt;import java.io.IOException;&lt;br /&gt;import javax.servlet.ServletException;&lt;br /&gt;import javax.servlet.http.HttpServletRequest;&lt;br /&gt;import javax.servlet.http.HttpServletResponse;&lt;br /&gt;import org.apache.struts.action.Action;&lt;br /&gt;import org.apache.struts.action.ActionForm;&lt;br /&gt;import org.apache.struts.action.ActionForward;&lt;br /&gt;import org.apache.struts.action.ActionMapping;&lt;/strong&gt;&lt;/span&gt;&lt;/code&gt;&lt;/span&gt;&lt;/code&gt;&lt;/p&gt;&lt;table width="100%" border="0"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td colspan="4"&gt;&lt;strong&gt;&lt;span  &gt;public class NameAction extends Action {&lt;/span&gt;&lt;/strong&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td width="3%"&gt; &lt;/td&gt;&lt;td colspan="3"&gt;&lt;strong&gt;&lt;span  &gt;public ActionForward execute(ActionMapping mapping, ActionForm form,&lt;br /&gt;HttpServletRequest request, HttpServletResponse response)&lt;br /&gt;throws IOException, ServletException {&lt;/span&gt;&lt;/strong&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt; &lt;/td&gt;&lt;td width="2%"&gt; &lt;/td&gt;&lt;td colspan="2"&gt;&lt;strong&gt;&lt;span  &gt;String target = new String("success");&lt;br /&gt;if ( form != null ) {&lt;/span&gt;&lt;/strong&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt; &lt;/td&gt;&lt;td&gt; &lt;/td&gt;&lt;td width="2%"&gt; &lt;/td&gt;&lt;td width="93%"&gt;&lt;strong&gt;&lt;span  &gt;// Use the NameForm to get the request parameters&lt;br /&gt;NameForm nameForm = (NameForm)form;&lt;br /&gt;String name = nameForm.getName();&lt;/span&gt;&lt;/strong&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt; &lt;/td&gt;&lt;td&gt; &lt;/td&gt;&lt;td&gt;&lt;strong&gt;&lt;span  &gt;}&lt;/span&gt;&lt;/strong&gt;&lt;/td&gt;&lt;td&gt; &lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt; &lt;/td&gt;&lt;td&gt; &lt;/td&gt;&lt;td colspan="2"&gt;&lt;strong&gt;&lt;span  &gt;// if no mane supplied Set the target to failure&lt;br /&gt;if ( name == null ) {&lt;/span&gt;&lt;/strong&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt; &lt;/td&gt;&lt;td&gt; &lt;/td&gt;&lt;td&gt; &lt;/td&gt;&lt;td&gt;&lt;strong&gt;&lt;span  &gt;target = new String("failure");&lt;/span&gt;&lt;/strong&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt; &lt;/td&gt;&lt;td&gt; &lt;/td&gt;&lt;td colspan="2"&gt;&lt;strong&gt;&lt;span  &gt;}&lt;/span&gt;&lt;/strong&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt; &lt;/td&gt;&lt;td&gt; &lt;/td&gt;&lt;td colspan="2"&gt;&lt;strong&gt;&lt;span  &gt;else {&lt;/span&gt;&lt;/strong&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt; &lt;/td&gt;&lt;td&gt; &lt;/td&gt;&lt;td&gt; &lt;/td&gt;&lt;td&gt;&lt;strong&gt;&lt;span  &gt;request.setAttribute("NAME", name);&lt;/span&gt;&lt;/strong&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt; &lt;/td&gt;&lt;td&gt; &lt;/td&gt;&lt;td colspan="2"&gt;&lt;strong&gt;&lt;span  &gt;}&lt;/span&gt;&lt;/strong&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt; &lt;/td&gt;&lt;td colspan="3"&gt;&lt;strong&gt;&lt;span  &gt;return (mapping.findForward(target));&lt;br /&gt;}&lt;/span&gt;&lt;/strong&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td colspan="4"&gt;&lt;strong&gt;&lt;span  &gt;}&lt;/span&gt;&lt;/strong&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;code&gt;&lt;span &gt;&lt;code&gt;&lt;em style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: small; "&gt;&lt;/em&gt;&lt;/code&gt;&lt;/span&gt;&lt;/code&gt;&lt;/p&gt;&lt;p&gt;&lt;code&gt;&lt;span &gt;&lt;em style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: small; "&gt;&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/code&gt;&lt;/p&gt;&lt;p&gt;&lt;code&gt;&lt;span &gt;&lt;span style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: small; "&gt;Moving to step three, to deploy the NameAction to our Struts application, we need to compile the NameAction class and move the class file to /WEB-INF/classes/example directory, and add the following entry to the &lt;action-mappings&gt; section of the /WEB-INF/struts-config.xml file:&lt;/action-mappings&gt;&lt;/span&gt; &lt;/span&gt;&lt;/code&gt;&lt;/p&gt;&lt;p&gt;&lt;code&gt;&lt;span &gt;&lt;span style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: small; "&gt;&lt;code&gt;&lt;/code&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;table width="100%" border="0"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td colspan="2"&gt;&lt;strong&gt;&lt;span  &gt;&lt;action path="/Name" type="example.NameAction" name="nameForm" input="/index.jsp"&gt;&lt;/action&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td width="4%"&gt; &lt;/td&gt;&lt;td width="96%"&gt;&lt;strong&gt;&lt;span  &gt;&lt;forward name="success" path="/displayname.jsp"&gt;&lt;br /&gt;&lt;forward name="failure" path="/index.jsp"&gt;&lt;/forward&gt;&lt;/forward&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td height="18" colspan="2"&gt;&lt;strong&gt;&lt;span  &gt;&lt;/span&gt;&lt;/strong&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;code&gt;&lt;span &gt;&lt;code&gt;&lt;span style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: small; "&gt;&lt;/span&gt;&lt;/code&gt;&lt;/span&gt;&lt;/code&gt;&lt;/p&gt;&lt;p&gt;&lt;code&gt;&lt;span &gt;&lt;span style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: small; "&gt;For step four we modify the web.xml file. We have to to tell the Web application about our ActionServlet. This is accomplished by adding the following servlet definition to the /WEB-INF/web.xml file:&lt;/span&gt; &lt;/span&gt;&lt;/code&gt;&lt;/p&gt;&lt;p&gt;&lt;code&gt;&lt;span &gt;&lt;span style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: small; "&gt;&lt;code&gt;&lt;/code&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;table width="100%" border="0"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td colspan="3"&gt;&lt;strong&gt;&lt;span  &gt;&lt;servlet&gt;&lt;/servlet&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td width="4%"&gt; &lt;/td&gt;&lt;td colspan="2"&gt;&lt;strong&gt;&lt;span  &gt;&lt;servlet-name&gt;action&lt;/servlet-name&gt;&lt;br /&gt;&lt;servlet-class&gt; org.apache.struts.action.ActionServlet &lt;/servlet-class&gt;&lt;br /&gt;&lt;init-param&gt;&lt;/init-param&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt; &lt;/td&gt;&lt;td width="4%"&gt; &lt;/td&gt;&lt;td width="92%"&gt;&lt;strong&gt;&lt;span  &gt;&lt;param-name&gt;config&lt;/param-name&gt;&lt;br /&gt;&lt;param-value&gt;/WEB-INF/struts-config.xml&lt;/param-value&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt; &lt;/td&gt;&lt;td colspan="2"&gt;&lt;strong&gt;&lt;span  &gt;&lt;/span&gt;&lt;/strong&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt; &lt;/td&gt;&lt;td colspan="2"&gt;&lt;strong&gt;&lt;span  &gt;&lt;load-on-startup&gt;1&lt;/load-on-startup&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td height="18" colspan="3"&gt;&lt;strong&gt;&lt;span  &gt;&lt;/span&gt;&lt;/strong&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;code&gt;&lt;span &gt;&lt;code&gt;&lt;span  &gt;&lt;/span&gt;&lt;/code&gt;&lt;/span&gt;&lt;/code&gt;&lt;/p&gt;&lt;p&gt;&lt;code&gt;&lt;span &gt;&lt;span style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: small; "&gt;Once we have told the container about the ActionServlet, we need to tell it when the action should be executed. To do this, we have to add a &lt;servlet-mapping&gt; element to the /WEB-INF/ web.xml file:&lt;/servlet-mapping&gt;&lt;/span&gt; &lt;/span&gt;&lt;/code&gt;&lt;/p&gt;&lt;p&gt;&lt;code&gt;&lt;span &gt;&lt;span  &gt;&lt;code&gt;&lt;/code&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/p&gt;&lt;table width="100%" border="0"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td colspan="3"&gt;&lt;strong&gt;&lt;span  &gt;&lt;servlet-mapping&gt;&lt;/servlet-mapping&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td width="4%"&gt; &lt;/td&gt;&lt;td width="96%" colspan="2"&gt;&lt;strong&gt;&lt;span  &gt;&lt;servlet-name&gt;action&lt;/servlet-name&gt;&lt;br /&gt;&lt;url-pattern&gt;*.do&lt;/url-pattern&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td height="18" colspan="3"&gt;&lt;strong&gt;&lt;span  &gt;&lt;/span&gt;&lt;/strong&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;p&gt;&lt;code&gt;&lt;span &gt;&lt;code&gt;&lt;span  &gt;&lt;/span&gt;&lt;/code&gt;&lt;/span&gt;&lt;/code&gt;&lt;/p&gt;&lt;p&gt;&lt;code&gt;&lt;span &gt;&lt;span style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: small; "&gt;You will notice in the previously listed index.jsp that our action does not include a .do at the end of the URL. We do not have to append the .do because it is automatically appended if we use the &lt;html:form&gt; tag. If you do not use the &lt;html:form&gt; tag, then you will need to append .do to the action's URL. This mapping tells the Web application that whenever a request is received with .do appended to the URL, the servlet named action should service the request.&lt;/html:form&gt;&lt;/html:form&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;/div&gt;</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">1</thr:total></item><item><title>Hibernate persist() vs. save()</title><link>http://javaj2eetutorials.blogspot.com/2012/03/hibernate-persist-vs-save.html</link><category>Create Table Java</category><category>Hibernate</category><category>persist</category><category>save</category><author>noreply@blogger.com (Alex Rabe)</author><pubDate>Fri, 23 Mar 2012 01:05:00 -0700</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-2445219189346048747.post-608897966750360431</guid><description>&lt;div&gt;&lt;span &gt;Hibernate persist() vs. save()&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span &gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span &gt;&lt;b&gt;For persist():&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span &gt;The semantics of this method are defined by JSR-220.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span &gt;persist() is well defined. It makes a transient instance persistent. However, it doesn’t guarantee that the identifier value will be assigned to the persistent instance immediately, the assignment might happen at flush time. The spec doesn’t say that, which is the problem I have with persist().&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span &gt;persist() also guarantees that it will not execute an INSERT statement if it is called outside of transaction boundaries. This is useful in long-running conversations with an extended Session/persistence context.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span &gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span &gt;&lt;b&gt;save():&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span &gt;For save() it says, it is the hibernate standard.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span &gt;first assigning a generated identifier.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span &gt;save() does not guarantee the same, it returns an identifier, and if an INSERT has to be executed to get the identifier (e.g. “identity” generator, not “sequence”), this INSERT happens immediately, no matter if you are inside or outside of a transaction. This is not good in a long-running conversation with an extended Session/persistence context.&lt;/span&gt;&lt;/div&gt;</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><title>DTO, VO, POJO</title><link>http://javaj2eetutorials.blogspot.com/2012/03/dto-vo-pojo.html</link><category>Data Transfer Object</category><category>DTO</category><category>JavaBeans</category><category>Plain Old Java Object</category><category>POJO</category><category>Value Object</category><category>VO</category><author>noreply@blogger.com (Alex Rabe)</author><pubDate>Fri, 23 Mar 2012 00:50:00 -0700</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-2445219189346048747.post-1827846695014822954</guid><description>&lt;div&gt;&lt;span &gt;&lt;b&gt;POJO:&lt;/b&gt; A Plain Old Java Object or POJO is a term initially introduced to designate a simple lightweight Java object, not implementing any javax.ejb interface. POJO is an acronym for Plain Old Java Object. The name is used to emphasize that the object in question is an ordinary Java Object, not a special object, and in particular not an Enterprise JavaBean.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span &gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span &gt;&lt;b&gt;Value Object (VO): &lt;/b&gt;A Value Object or VO is an object such as java.lang.Integer that hold values (hence value objects).&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span &gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;b style="font-family: Georgia, serif; "&gt;Data Transfer Object (DTO):&lt;/b&gt;&lt;span style="font-family: Georgia, serif; "&gt; Data transfer object (DTO), formerly known as value objects or VO, is a design pattern used to transfer data between software application subsystems. DTOs are often used in conjunction with data access objects to retrieve data from a database.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span &gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span &gt;The difference between data transfer objects and business objects or data access objects is that a DTO does not have any behaviour except for storage and retrieval of its own data (accessors and mutators).&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span &gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span &gt;&lt;b&gt;DTO vs VO&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-family: Georgia, serif; "&gt;DTO - Data transfer objects are just data containers which is used to transport data between layers and tiers .It mainly contains of attributes ,You can even use public attributes without getters and setters .Data transfer objects do not contain any bussiness logic.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-family: Georgia, serif; "&gt;Analogy: Simple Registration form where you have attributes usename,password and email id . when you sumbit this form . In your servlet RegistrationServlet.java file you will get all the attributes from view layer to business layer where you pass the attributes to java beans and then to the DAO or the persistence layer . DTO’s helps in transporting the attributes from view layer to bussiness layer and finally to the persistence layer .&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-family: Georgia, serif; "&gt;DTO was mainly used to get data transportd across the network efficiently , it may be even from JVM to another JVM .&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family: Georgia, serif; "&gt;DTOs are often java.io.Serializable – inorder to transfer data across JVM&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span &gt;VO - A Value Object [1,2] represents itself a fix set of data and is similar to a Java enum. A Value Object’s identity is based on their state rather than on their object identity and is immutable. A real world example would be Color.RED, Color.BLUE, SEX.FEMALE etc.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span &gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span &gt;&lt;b&gt;POJO V/S JavaBeans&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-family: Georgia, serif; "&gt;The Java-Beanness of a POJO is that it’s public attributes are all accessed via getters and setters that conform to the JavaBeans conventions. e.g. private String foo; public String getFoo(){…} public void setFoo(String foo){…};&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-family: Georgia, serif; "&gt;JavaBeans must implement Serializable and have a no-argument constructor. where as in POJO doesnot have these restrictions .&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><title>Simple ArrayList Example | ArrayList Sample</title><link>http://javaj2eetutorials.blogspot.com/2012/03/simple-arraylist-example-arraylist.html</link><category>ArrayList Sample</category><category>Java ArrayList</category><category>Simple ArrayList Example</category><author>noreply@blogger.com (Alex Rabe)</author><pubDate>Wed, 21 Mar 2012 00:58:00 -0700</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-2445219189346048747.post-3690718005612618967</guid><description>&lt;code&gt;&lt;/code&gt;&lt;div&gt;&lt;code&gt;&lt;li class="alt" style="font-weight: normal; background-color: rgb(255, 255, 255); background-image: none !important; margin-top: 0px !important; margin-right: 0px !important; margin-bottom: 0px !important; margin-left: 0px !important; padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-width: initial; border-color: initial; border-image: initial; list-style-type: decimal-leading-zero; list-style-image: initial; list-style-position: outside !important; border-left-width: 3px; border-left-color: rgb(108, 226, 108); color: rgb(92, 92, 92); line-height: 14px; font-family: Consolas, Monaco, 'Courier New', Courier, monospace; font-size: 12px; "&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; border-image: initial; color: black; background-color: inherit; "&gt;&lt;span class="keyword" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; border-image: initial; color: rgb(0, 102, 153); background-color: inherit; font-weight: bold; "&gt;package&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; border-image: initial; background-color: inherit; "&gt; arraylistexample;  &lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li class="" style="font-weight: normal; margin-top: 0px !important; margin-right: 0px !important; margin-bottom: 0px !important; margin-left: 0px !important; padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-width: initial; border-color: initial; border-image: initial; list-style-type: decimal-leading-zero; list-style-image: initial; list-style-position: outside !important; border-left-width: 3px; border-left-color: rgb(108, 226, 108); background-color: rgb(255, 255, 255); line-height: 14px; font-family: Consolas, Monaco, 'Courier New', Courier, monospace; font-size: 12px; "&gt;&lt;span class="keyword" style="background-color: inherit; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; border-image: initial; color: rgb(0, 102, 153); font-weight: bold; "&gt;
&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;li class="" style="font-weight: normal; margin-top: 0px !important; margin-right: 0px !important; margin-bottom: 0px !important; margin-left: 0px !important; padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-width: initial; border-color: initial; border-image: initial; list-style-type: decimal-leading-zero; list-style-image: initial; list-style-position: outside !important; border-left-width: 3px; border-left-color: rgb(108, 226, 108); background-color: rgb(255, 255, 255); line-height: 14px; font-family: Consolas, Monaco, 'Courier New', Courier, monospace; font-size: 12px; "&gt;&lt;span class="keyword" style="background-color: inherit; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; border-image: initial; color: rgb(0, 102, 153); font-weight: bold; "&gt;import&lt;/span&gt;&lt;span style="background-color: inherit; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; border-image: initial; "&gt; java.util.ArrayList;  &lt;/span&gt;&lt;/li&gt;&lt;li class="" style="font-weight: normal; margin-top: 0px !important; margin-right: 0px !important; margin-bottom: 0px !important; margin-left: 0px !important; padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-width: initial; border-color: initial; border-image: initial; list-style-type: decimal-leading-zero; list-style-image: initial; list-style-position: outside !important; border-left-width: 3px; border-left-color: rgb(108, 226, 108); background-color: rgb(255, 255, 255); color: rgb(92, 92, 92); line-height: 14px; font-family: Consolas, Monaco, 'Courier New', Courier, monospace; font-size: 12px; "&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; border-image: initial; color: black; background-color: inherit; "&gt;  &lt;/span&gt;&lt;/li&gt;&lt;li class="alt" style="font-weight: normal; background-color: rgb(255, 255, 255); background-image: none !important; margin-top: 0px !important; margin-right: 0px !important; margin-bottom: 0px !important; margin-left: 0px !important; padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-width: initial; border-color: initial; border-image: initial; list-style-type: decimal-leading-zero; list-style-image: initial; list-style-position: outside !important; border-left-width: 3px; border-left-color: rgb(108, 226, 108); color: rgb(92, 92, 92); line-height: 14px; font-family: Consolas, Monaco, 'Courier New', Courier, monospace; font-size: 12px; "&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; border-image: initial; color: black; background-color: inherit; "&gt;&lt;span class="comment" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; border-image: initial; color: rgb(0, 130, 0); background-color: inherit; "&gt;/**&lt;/span&gt; &lt;/span&gt;&lt;/li&gt;&lt;li class="" style="font-weight: normal; margin-top: 0px !important; margin-right: 0px !important; margin-bottom: 0px !important; margin-left: 0px !important; padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-width: initial; border-color: initial; border-image: initial; list-style-type: decimal-leading-zero; list-style-image: initial; list-style-position: outside !important; border-left-width: 3px; border-left-color: rgb(108, 226, 108); background-color: rgb(255, 255, 255); color: rgb(92, 92, 92); line-height: 14px; font-family: Consolas, Monaco, 'Courier New', Courier, monospace; font-size: 12px; "&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; border-image: initial; color: black; background-color: inherit; "&gt;&lt;span class="comment" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; border-image: initial; color: rgb(0, 130, 0); background-color: inherit; "&gt; * SimpleArrayListExample This is example for simple arraylist. It shows how &lt;/span&gt; &lt;/span&gt;&lt;/li&gt;&lt;li class="alt" style="font-weight: normal; background-color: rgb(255, 255, 255); background-image: none !important; margin-top: 0px !important; margin-right: 0px !important; margin-bottom: 0px !important; margin-left: 0px !important; padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-width: initial; border-color: initial; border-image: initial; list-style-type: decimal-leading-zero; list-style-image: initial; list-style-position: outside !important; border-left-width: 3px; border-left-color: rgb(108, 226, 108); color: rgb(92, 92, 92); line-height: 14px; font-family: Consolas, Monaco, 'Courier New', Courier, monospace; font-size: 12px; "&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; border-image: initial; color: black; background-color: inherit; "&gt;&lt;span class="comment" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; border-image: initial; color: rgb(0, 130, 0); background-color: inherit; "&gt; * to create an array list and also add the value into arraylist as well as&lt;/span&gt; &lt;/span&gt;&lt;/li&gt;&lt;li class="" style="font-weight: normal; margin-top: 0px !important; margin-right: 0px !important; margin-bottom: 0px !important; margin-left: 0px !important; padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-width: initial; border-color: initial; border-image: initial; list-style-type: decimal-leading-zero; list-style-image: initial; list-style-position: outside !important; border-left-width: 3px; border-left-color: rgb(108, 226, 108); background-color: rgb(255, 255, 255); color: rgb(92, 92, 92); line-height: 14px; font-family: Consolas, Monaco, 'Courier New', Courier, monospace; font-size: 12px; "&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; border-image: initial; color: black; background-color: inherit; "&gt;&lt;span class="comment" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; border-image: initial; color: rgb(0, 130, 0); background-color: inherit; "&gt; * reterive it&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li class="alt" style="font-weight: normal; background-color: rgb(255, 255, 255); background-image: none !important; margin-top: 0px !important; margin-right: 0px !important; margin-bottom: 0px !important; margin-left: 0px !important; padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-width: initial; border-color: initial; border-image: initial; list-style-type: decimal-leading-zero; list-style-image: initial; list-style-position: outside !important; border-left-width: 3px; border-left-color: rgb(108, 226, 108); color: rgb(92, 92, 92); line-height: 14px; font-family: Consolas, Monaco, 'Courier New', Courier, monospace; font-size: 12px; "&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; border-image: initial; color: black; background-color: inherit; "&gt;&lt;span class="comment" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; border-image: initial; color: rgb(0, 130, 0); background-color: inherit; "&gt; */&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; border-image: initial; background-color: inherit; "&gt;  &lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li class="" style="font-weight: normal; margin-top: 0px !important; margin-right: 0px !important; margin-bottom: 0px !important; margin-left: 0px !important; padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-width: initial; border-color: initial; border-image: initial; list-style-type: decimal-leading-zero; list-style-image: initial; list-style-position: outside !important; border-left-width: 3px; border-left-color: rgb(108, 226, 108); background-color: rgb(255, 255, 255); color: rgb(92, 92, 92); line-height: 14px; font-family: Consolas, Monaco, 'Courier New', Courier, monospace; font-size: 12px; "&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; border-image: initial; color: black; background-color: inherit; "&gt;&lt;span class="keyword" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; border-image: initial; color: rgb(0, 102, 153); background-color: inherit; font-weight: bold; "&gt;public&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; border-image: initial; background-color: inherit; "&gt; &lt;/span&gt;&lt;span class="keyword" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; border-image: initial; color: rgb(0, 102, 153); background-color: inherit; font-weight: bold; "&gt;class&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; border-image: initial; background-color: inherit; "&gt; SimpleArrayListExample {  &lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li class="alt" style="font-weight: normal; background-color: rgb(255, 255, 255); background-image: none !important; margin-top: 0px !important; margin-right: 0px !important; margin-bottom: 0px !important; margin-left: 0px !important; padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-width: initial; border-color: initial; border-image: initial; list-style-type: decimal-leading-zero; list-style-image: initial; list-style-position: outside !important; border-left-width: 3px; border-left-color: rgb(108, 226, 108); color: rgb(92, 92, 92); line-height: 14px; font-family: Consolas, Monaco, 'Courier New', Courier, monospace; font-size: 12px; "&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; border-image: initial; color: black; background-color: inherit; "&gt; &lt;span class="keyword" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; border-image: initial; color: rgb(0, 102, 153); background-color: inherit; font-weight: bold; "&gt;public&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; border-image: initial; background-color: inherit; "&gt; &lt;/span&gt;&lt;span class="keyword" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; border-image: initial; color: rgb(0, 102, 153); background-color: inherit; font-weight: bold; "&gt;static&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; border-image: initial; background-color: inherit; "&gt; &lt;/span&gt;&lt;span class="keyword" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; border-image: initial; color: rgb(0, 102, 153); background-color: inherit; font-weight: bold; "&gt;void&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; border-image: initial; background-color: inherit; "&gt; main(String[] args) {  &lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li class="" style="font-weight: normal; margin-top: 0px !important; margin-right: 0px !important; margin-bottom: 0px !important; margin-left: 0px !important; padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-width: initial; border-color: initial; border-image: initial; list-style-type: decimal-leading-zero; list-style-image: initial; list-style-position: outside !important; border-left-width: 3px; border-left-color: rgb(108, 226, 108); background-color: rgb(255, 255, 255); color: rgb(92, 92, 92); line-height: 14px; font-family: Consolas, Monaco, 'Courier New', Courier, monospace; font-size: 12px; "&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; border-image: initial; color: black; background-color: inherit; "&gt;  &lt;span class="comment" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; border-image: initial; color: rgb(0, 130, 0); background-color: inherit; "&gt;//creating arraylist&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; border-image: initial; background-color: inherit; "&gt;  &lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li class="alt" style="font-weight: normal; background-color: rgb(255, 255, 255); background-image: none !important; margin-top: 0px !important; margin-right: 0px !important; margin-bottom: 0px !important; margin-left: 0px !important; padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-width: initial; border-color: initial; border-image: initial; list-style-type: decimal-leading-zero; list-style-image: initial; list-style-position: outside !important; border-left-width: 3px; border-left-color: rgb(108, 226, 108); color: rgb(92, 92, 92); line-height: 14px; font-family: Consolas, Monaco, 'Courier New', Courier, monospace; font-size: 12px; "&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; border-image: initial; color: black; background-color: inherit; "&gt;  ArrayList al = &lt;span class="keyword" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; border-image: initial; color: rgb(0, 102, 153); background-color: inherit; font-weight: bold; "&gt;new&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; border-image: initial; background-color: inherit; "&gt; ArrayList();  &lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li class="" style="font-weight: normal; margin-top: 0px !important; margin-right: 0px !important; margin-bottom: 0px !important; margin-left: 0px !important; padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-width: initial; border-color: initial; border-image: initial; list-style-type: decimal-leading-zero; list-style-image: initial; list-style-position: outside !important; border-left-width: 3px; border-left-color: rgb(108, 226, 108); background-color: rgb(255, 255, 255); color: rgb(92, 92, 92); line-height: 14px; font-family: Consolas, Monaco, 'Courier New', Courier, monospace; font-size: 12px; "&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; border-image: initial; color: black; background-color: inherit; "&gt;    &lt;/span&gt;&lt;/li&gt;&lt;li class="alt" style="font-weight: normal; background-color: rgb(255, 255, 255); background-image: none !important; margin-top: 0px !important; margin-right: 0px !important; margin-bottom: 0px !important; margin-left: 0px !important; padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-width: initial; border-color: initial; border-image: initial; list-style-type: decimal-leading-zero; list-style-image: initial; list-style-position: outside !important; border-left-width: 3px; border-left-color: rgb(108, 226, 108); color: rgb(92, 92, 92); line-height: 14px; font-family: Consolas, Monaco, 'Courier New', Courier, monospace; font-size: 12px; "&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; border-image: initial; color: black; background-color: inherit; "&gt;  &lt;span class="comment" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; border-image: initial; color: rgb(0, 130, 0); background-color: inherit; "&gt;//adding values into arraylist&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; border-image: initial; background-color: inherit; "&gt;  &lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li class="" style="font-weight: normal; margin-top: 0px !important; margin-right: 0px !important; margin-bottom: 0px !important; margin-left: 0px !important; padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-width: initial; border-color: initial; border-image: initial; list-style-type: decimal-leading-zero; list-style-image: initial; list-style-position: outside !important; border-left-width: 3px; border-left-color: rgb(108, 226, 108); background-color: rgb(255, 255, 255); color: rgb(92, 92, 92); line-height: 14px; font-family: Consolas, Monaco, 'Courier New', Courier, monospace; font-size: 12px; "&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; border-image: initial; color: black; background-color: inherit; "&gt;  al.add(&lt;span class="number" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; border-image: initial; color: rgb(192, 0, 0); background-color: inherit; "&gt;1&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; border-image: initial; background-color: inherit; "&gt;);  &lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li class="alt" style="font-weight: normal; background-color: rgb(255, 255, 255); background-image: none !important; margin-top: 0px !important; margin-right: 0px !important; margin-bottom: 0px !important; margin-left: 0px !important; padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-width: initial; border-color: initial; border-image: initial; list-style-type: decimal-leading-zero; list-style-image: initial; list-style-position: outside !important; border-left-width: 3px; border-left-color: rgb(108, 226, 108); color: rgb(92, 92, 92); line-height: 14px; font-family: Consolas, Monaco, 'Courier New', Courier, monospace; font-size: 12px; "&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; border-image: initial; color: black; background-color: inherit; "&gt;  al.add(&lt;span class="number" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; border-image: initial; color: rgb(192, 0, 0); background-color: inherit; "&gt;2&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; border-image: initial; background-color: inherit; "&gt;);  &lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li class="" style="font-weight: normal; margin-top: 0px !important; margin-right: 0px !important; margin-bottom: 0px !important; margin-left: 0px !important; padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-width: initial; border-color: initial; border-image: initial; list-style-type: decimal-leading-zero; list-style-image: initial; list-style-position: outside !important; border-left-width: 3px; border-left-color: rgb(108, 226, 108); background-color: rgb(255, 255, 255); color: rgb(92, 92, 92); line-height: 14px; font-family: Consolas, Monaco, 'Courier New', Courier, monospace; font-size: 12px; "&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; border-image: initial; color: black; background-color: inherit; "&gt;  al.add(&lt;span class="number" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; border-image: initial; color: rgb(192, 0, 0); background-color: inherit; "&gt;3&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; border-image: initial; background-color: inherit; "&gt;);  &lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li class="alt" style="font-weight: normal; background-color: rgb(255, 255, 255); background-image: none !important; margin-top: 0px !important; margin-right: 0px !important; margin-bottom: 0px !important; margin-left: 0px !important; padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-width: initial; border-color: initial; border-image: initial; list-style-type: decimal-leading-zero; list-style-image: initial; list-style-position: outside !important; border-left-width: 3px; border-left-color: rgb(108, 226, 108); color: rgb(92, 92, 92); line-height: 14px; font-family: Consolas, Monaco, 'Courier New', Courier, monospace; font-size: 12px; "&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; border-image: initial; color: black; background-color: inherit; "&gt;    &lt;/span&gt;&lt;/li&gt;&lt;li class="" style="font-weight: normal; margin-top: 0px !important; margin-right: 0px !important; margin-bottom: 0px !important; margin-left: 0px !important; padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-width: initial; border-color: initial; border-image: initial; list-style-type: decimal-leading-zero; list-style-image: initial; list-style-position: outside !important; border-left-width: 3px; border-left-color: rgb(108, 226, 108); background-color: rgb(255, 255, 255); color: rgb(92, 92, 92); line-height: 14px; font-family: Consolas, Monaco, 'Courier New', Courier, monospace; font-size: 12px; "&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; border-image: initial; color: black; background-color: inherit; "&gt;  &lt;span class="comment" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; border-image: initial; color: rgb(0, 130, 0); background-color: inherit; "&gt;//Fetching the values from arraylist.&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; border-image: initial; background-color: inherit; "&gt;  &lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li class="alt" style="text-align: -webkit-auto; background-color: rgb(255, 255, 255); background-image: none !important; margin-top: 0px !important; margin-right: 0px !important; margin-bottom: 0px !important; margin-left: 0px !important; padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-width: initial; border-color: initial; border-image: initial; list-style-type: decimal-leading-zero; list-style-image: initial; list-style-position: outside !important; border-left-width: 3px; border-left-color: rgb(108, 226, 108); line-height: 14px; font-family: Consolas, Monaco, 'Courier New', Courier, monospace; font-size: 12px; "&gt;&lt;span class="keyword" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; border-image: initial; color: rgb(0, 102, 153); font-weight: bold; "&gt;for&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; border-image: initial; "&gt;(&lt;/span&gt;&lt;span class="keyword" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; border-image: initial; color: rgb(0, 102, 153); font-weight: bold; "&gt;int&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; border-image: initial; "&gt; i=&lt;/span&gt;&lt;span class="number" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; border-image: initial; color: rgb(192, 0, 0); "&gt;0&lt;/span&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; border-image: initial; "&gt;;i&lt;al.size();i++){&lt; span=""&gt;&lt;/al.size();i++){&lt;&gt;&lt;/span&gt;&lt;/li&gt;&lt;li class="" style="font-weight: normal; margin-top: 0px !important; margin-right: 0px !important; margin-bottom: 0px !important; margin-left: 0px !important; padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-width: initial; border-color: initial; border-image: initial; list-style-type: decimal-leading-zero; list-style-image: initial; list-style-position: outside !important; border-left-width: 3px; border-left-color: rgb(108, 226, 108); background-color: rgb(255, 255, 255); color: rgb(92, 92, 92); line-height: 14px; font-family: Consolas, Monaco, 'Courier New', Courier, monospace; font-size: 12px; "&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; border-image: initial; color: black; background-color: inherit; "&gt;   System.out.println(al.get(i));  &lt;/span&gt;&lt;/li&gt;&lt;li class="alt" style="font-weight: normal; background-color: rgb(255, 255, 255); background-image: none !important; margin-top: 0px !important; margin-right: 0px !important; margin-bottom: 0px !important; margin-left: 0px !important; padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-width: initial; border-color: initial; border-image: initial; list-style-type: decimal-leading-zero; list-style-image: initial; list-style-position: outside !important; border-left-width: 3px; border-left-color: rgb(108, 226, 108); color: rgb(92, 92, 92); line-height: 14px; font-family: Consolas, Monaco, 'Courier New', Courier, monospace; font-size: 12px; "&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; border-image: initial; color: black; background-color: inherit; "&gt;  }  &lt;/span&gt;&lt;/li&gt;&lt;li class="" style="font-weight: normal; margin-top: 0px !important; margin-right: 0px !important; margin-bottom: 0px !important; margin-left: 0px !important; padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-width: initial; border-color: initial; border-image: initial; list-style-type: decimal-leading-zero; list-style-image: initial; list-style-position: outside !important; border-left-width: 3px; border-left-color: rgb(108, 226, 108); background-color: rgb(255, 255, 255); color: rgb(92, 92, 92); line-height: 14px; font-family: Consolas, Monaco, 'Courier New', Courier, monospace; font-size: 12px; "&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; border-image: initial; color: black; background-color: inherit; "&gt; }  &lt;/span&gt;&lt;/li&gt;&lt;li class="alt" style="font-weight: normal; background-color: rgb(255, 255, 255); background-image: none !important; margin-top: 0px !important; margin-right: 0px !important; margin-bottom: 0px !important; margin-left: 0px !important; padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-width: initial; border-color: initial; border-image: initial; list-style-type: decimal-leading-zero; list-style-image: initial; list-style-position: outside !important; border-left-width: 3px; border-left-color: rgb(108, 226, 108); color: rgb(92, 92, 92); line-height: 14px; font-family: Consolas, Monaco, 'Courier New', Courier, monospace; font-size: 12px; "&gt;&lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; border-image: initial; color: black; background-color: inherit; "&gt;} &lt;/span&gt;&lt;/li&gt;&lt;/code&gt;&lt;div style="font-weight: normal; "&gt;&lt;code&gt;&lt;/code&gt;&lt;/div&gt;&lt;/div&gt;</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><title>Session Tracking Example JSP</title><link>http://javaj2eetutorials.blogspot.com/2012/03/session-tracking-example-jsp.html</link><category>Session Tracking</category><category>Session Tracking JSP</category><author>noreply@blogger.com (Alex Rabe)</author><pubDate>Thu, 1 Mar 2012 05:42:00 -0800</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-2445219189346048747.post-1594502124445281713</guid><description>&lt;div style="font-family: Georgia, serif; font-size: 100%; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal; text-align: center; "&gt;&lt;span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Georgia, serif; font-size: 100%; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal; "&gt;Session Tracking Example&lt;/div&gt;&lt;div style="font-family: Georgia, serif; font-size: 100%; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal; "&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Georgia, serif; font-size: 100%; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal; "&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Georgia, serif; font-size: 100%; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal; "&gt;Session tracking is maintain the state of a user through out the application.&lt;/div&gt;&lt;div style="font-family: Georgia, serif; font-size: 100%; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal; "&gt;&lt;span style="font-size: 100%; "&gt;There are four typical solutions to this problem. &lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Georgia, serif; font-size: 100%; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal; "&gt;&lt;ol&gt;&lt;li&gt;&lt;span style="font-size: 100%; "&gt;Session&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: 100%; "&gt;cookie&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: 100%; "&gt;Url-rewriting&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: 100%; "&gt;Hidden field &lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/div&gt;&lt;div style="font-family: Georgia, serif; font-size: 100%; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal; "&gt;&lt;span style="font-size: 100%; "&gt;==================&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Georgia, serif; font-size: 100%; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal; "&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Georgia, serif; font-size: 100%; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal; "&gt;1.Create a user login page "login-form.jsp"&lt;/div&gt;&lt;div style="font-family: Georgia, serif; font-size: 100%; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal; "&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-weight: normal; font-family: Georgia, serif; font-size: 100%; font-style: normal; font-variant: normal; line-height: normal; "&gt;&lt;b&gt;login-form.jsp&lt;/b&gt;&lt;/div&gt;&lt;div style="font-family: Georgia, serif; font-size: 100%; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal; "&gt;&lt;br /&gt;&lt;/div&gt;&lt;span style="font-family: Georgia, serif; font-size: 100%; "&gt;&lt;span style="font-size: 100%; margin-right: auto; margin-left: auto;"&gt;&lt;img src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjnTrhtK5SAhhPUX0pi3M5nqQ5AsAgxlJPAh1oMp5kMrMeMCnx_NkteDvSXnhuB_9BC2JkVIqZ4WuYsZgYyfdXXPXaQ3L95iy0PC7VWWpPhgR_ebL0NqbQXtLdM94nvLKLYXc47vrQRBq2q/s400/LoginWebContentwebcmstestlogin-form.jpg" border="0" alt="" id="BLOGGER_PHOTO_ID_5714925073568120466" style="text-align: left;display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; cursor: pointer; width: 400px; height: 194px; " /&gt;&lt;/span&gt;&lt;/span&gt;&lt;div&gt;&lt;div&gt;&lt;div style="font-family: Georgia, serif; font-size: 100%; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal; text-align: left; "&gt;&lt;/div&gt;&lt;div style="font-family: Georgia, serif; font-size: 100%; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal; "&gt;&lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td colspan="2"&gt;&lt;h1 style="text-align: left;"&gt;User Login&lt;/h1&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Login Name&lt;/td&gt;&lt;td&gt;&lt;input type="text" name="userName" value=""&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Password&lt;/td&gt;&lt;td&gt;&lt;input type="password" name="password" value=""&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;input type="submit" name="Submit" value="Submit"&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;div style="font-family: Georgia, serif; font-size: 100%; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal; "&gt;===============&lt;/div&gt;&lt;div style="font-family: Georgia, serif; font-size: 100%; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal; "&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Georgia, serif; font-size: 100%; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal; "&gt;2.create a page to check the valid user.if it exists then it stores in t&lt;span style="font-size: 100%; "&gt;he &lt;/span&gt;&lt;span style="font-size: 100%; "&gt;session forward to the "welcome-home.jsp" else it come back again "login-form.jsp".&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Georgia, serif; font-size: 100%; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal; "&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-weight: normal; font-family: Georgia, serif; font-size: 100%; font-style: normal; font-variant: normal; line-height: normal; "&gt;&lt;b&gt;login-form-action.jsp&lt;/b&gt;&lt;/div&gt;&lt;div style="font-family: Georgia, serif; font-size: 100%; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal; "&gt;&lt;code&gt;&lt;/code&gt;&lt;/div&gt;&lt;div&gt;&lt;span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Georgia, serif; font-size: 100%; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal; "&gt;&lt;/div&gt;&lt;div style="font-family: Georgia, serif; font-size: 100%; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal; "&gt;&amp;lt;%@ page language="java" import="java.sql.*;"%&amp;gt;&lt;/div&gt;&lt;div style="font-family: Georgia, serif; font-size: 100%; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal; "&gt;&lt;jsp:include page="../admin/config.jsp"&gt;&lt;/jsp:include&gt;&lt;/div&gt;&lt;div style="font-family: Georgia, serif; font-size: 100%; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal; "&gt;&amp;lt;%&lt;/div&gt;&lt;div style="font-family: Georgia, serif; font-size: 100%; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal; "&gt;String userName = request.getParameter("userName");&lt;/div&gt;&lt;div style="font-family: Georgia, serif; font-size: 100%; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal; "&gt;String password = request.getParameter("password");&lt;/div&gt;&lt;div style="font-family: Georgia, serif; font-size: 100%; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal; "&gt;System.out.println("MySQL Connect Example.");&lt;/div&gt;&lt;div style="font-family: Georgia, serif; font-size: 100%; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal; "&gt;Connection con = null;&lt;/div&gt;&lt;div style="font-family: Georgia, serif; font-size: 100%; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal; "&gt;System.out.println("MySQL Connect Example.");&lt;/div&gt;&lt;/div&gt;&lt;div style="font-family: Georgia, serif; font-size: 100%; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal; "&gt;&lt;div style="font-family: Georgia, serif; font-size: 100%; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal; "&gt;Connection conn = null;&lt;/div&gt;&lt;div style="font-family: Georgia, serif; font-size: 100%; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal; "&gt;String url = "jdbc:mysql://localhost:3306/cms";;&lt;/div&gt;&lt;div style="font-family: Georgia, serif; font-size: 100%; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal; "&gt;String driver = "com.mysql.jdbc.Driver";&lt;/div&gt;&lt;div style="font-family: Georgia, serif; font-size: 100%; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal; "&gt;String username = "root";&lt;/div&gt;&lt;div style="font-family: Georgia, serif; font-size: 100%; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal; "&gt;String userPassword = "";&lt;/div&gt;&lt;div style="font-family: Georgia, serif; font-size: 100%; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal; "&gt;try {&lt;/div&gt;&lt;div style="font-family: Georgia, serif; font-size: 100%; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal; "&gt;Class.forName(driver).newInstance();&lt;/div&gt;&lt;div style="font-family: Georgia, serif; font-size: 100%; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal; "&gt;conn = DriverManager.getConnection(url,username,userPassword);&lt;/div&gt;&lt;div style="font-family: Georgia, serif; font-size: 100%; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal; "&gt;Statement st = conn.createStatement();&lt;/div&gt;&lt;div style="font-family: Georgia, serif; font-size: 100%; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal; "&gt;String strQuery = "SELECT count(*) FROM user WHERE loginId='"+userName+"' AND empPassword='"+password+"'";&lt;/div&gt;&lt;div style="font-family: Georgia, serif; font-size: 100%; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal; "&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;out.println(strQuery);&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Georgia, serif; font-size: 100%; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal; "&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;ResultSet rs = st.executeQuery(strQuery);&lt;/div&gt;&lt;div style="font-family: Georgia, serif; font-size: 100%; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal; "&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Georgia, serif; font-size: 100%; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal; "&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;if(rs.next())&lt;/div&gt;&lt;div style="font-family: Georgia, serif; font-size: 100%; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal; "&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;{&lt;/div&gt;&lt;div style="font-family: Georgia, serif; font-size: 100%; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal; "&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt;if(rs.getInt(1)&amp;gt;0)&lt;/div&gt;&lt;div style="font-family: Georgia, serif; font-size: 100%; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal; "&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt;{&lt;/div&gt;&lt;div style="font-family: Georgia, serif; font-size: 100%; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal; "&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;   &lt;/span&gt;session.setAttribute("userid",userName);&lt;/div&gt;&lt;div style="font-family: Georgia, serif; font-size: 100%; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal; "&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;   &lt;/span&gt;response.sendRedirect("welcome-home.jsp");&lt;/div&gt;&lt;div style="font-family: Georgia, serif; font-size: 100%; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal; "&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt;}&lt;/div&gt;&lt;div style="font-family: Georgia, serif; font-size: 100%; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal; "&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt;else&lt;/div&gt;&lt;div style="font-family: Georgia, serif; font-size: 100%; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal; "&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;   &lt;/span&gt;{&lt;/div&gt;&lt;div style="font-family: Georgia, serif; font-size: 100%; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal; "&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;   &lt;/span&gt;response.sendRedirect("login-form.jsp");&lt;/div&gt;&lt;div style="font-family: Georgia, serif; font-size: 100%; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal; "&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt;}&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Georgia, serif; font-size: 100%; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal; "&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;}&lt;/div&gt;&lt;div style="font-family: Georgia, serif; font-size: 100%; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal; "&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;System.out.println("Connected to the database");&lt;/div&gt;&lt;div style="font-family: Georgia, serif; font-size: 100%; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal; "&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;conn.close();&lt;/div&gt;&lt;div style="font-family: Georgia, serif; font-size: 100%; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal; "&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;System.out.println("Disconnected from database");&lt;/div&gt;&lt;div style="font-family: Georgia, serif; font-size: 100%; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal; "&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;}&lt;/div&gt;&lt;div style="font-family: Georgia, serif; font-size: 100%; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal; "&gt;catch (Exception e) {&lt;/div&gt;&lt;div style="font-family: Georgia, serif; font-size: 100%; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal; "&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;e.printStackTrace();&lt;/div&gt;&lt;div style="font-family: Georgia, serif; font-size: 100%; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal; "&gt;}&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Georgia, serif; font-size: 100%; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal; "&gt;%&amp;gt; &lt;/div&gt;&lt;div style="font-family: Georgia, serif; font-size: 100%; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal; "&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Georgia, serif; font-size: 100%; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal; "&gt;===================&lt;/div&gt;&lt;div style="font-family: Georgia, serif; font-size: 100%; font-style: normal; font-variant: normal; line-height: normal; "&gt;&lt;b&gt;welcome-home.jsp&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;img src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjwsb6RpCKl28wTf_h55upLL4IXFdpIlddJMY6JZ3cHimiamFoDoT-IDFUynBHCXtdAKUZv4HKhCR6f4P5kWP2ow98BBn3C4GMIdQc2QMBj9feindKlKQ1rBXTqc9KlA3hvHpDkXbYZRb89/s400/LoginWebContentwebcmstestwelcome-home.jpg" border="0" alt="" id="BLOGGER_PHOTO_ID_5714925627825198130" style="float: right; margin-top: 0px; margin-right: 0px; margin-bottom: 10px; margin-left: 10px; cursor: pointer; width: 400px; height: 132px; " /&gt;&lt;/div&gt;&lt;div style="font-family: Georgia, serif; font-size: 100%; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal; "&gt;&lt;/div&gt;&lt;div style="font-family: Georgia, serif; font-size: 100%; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal; "&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;</description><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" height="72" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjnTrhtK5SAhhPUX0pi3M5nqQ5AsAgxlJPAh1oMp5kMrMeMCnx_NkteDvSXnhuB_9BC2JkVIqZ4WuYsZgYyfdXXPXaQ3L95iy0PC7VWWpPhgR_ebL0NqbQXtLdM94nvLKLYXc47vrQRBq2q/s72-c/LoginWebContentwebcmstestlogin-form.jpg" width="72"/><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><title>What is Difference Between Statement and PreparedStatement</title><link>http://javaj2eetutorials.blogspot.com/2012/02/what-is-difference-between-statement.html</link><category>PreparedStatement</category><category>Statement</category><author>noreply@blogger.com (Alex Rabe)</author><pubDate>Tue, 14 Feb 2012 00:52:00 -0800</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-2445219189346048747.post-7073022433982374131</guid><description>&lt;div&gt;&lt;span style="font-family: Georgia, serif; "&gt;There are four steps for the execution of query such as&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;ol&gt;&lt;li&gt;&lt;span style="font-family: Georgia, serif; "&gt;Query is parsed,&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-family: Georgia, serif; "&gt;Query is compile,&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-family: Georgia, serif; "&gt;Query is optimized&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-family: Georgia, serif; "&gt;Query is executed&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/div&gt;&lt;div&gt;&lt;span &gt;In case of statement interface these four steps are performed, each time when query is submitted for execution. But in case of prepared statement first three steps are performed only once, when the query in initially submitted. Only the last step is performed each time query is submitted (in subsequence submissions), i.e if same query is submitted to be execute with different values multiple times then prepared statement interface provides better perfromance as compared to statement interface.&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Georgia, serif; font-size: 100%; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal; "&gt;&lt;br /&gt;&lt;/div&gt;</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><title>mysql-connector.jar for Connecting Java to MySQL</title><link>http://javaj2eetutorials.blogspot.com/2012/02/mysql-connectorjar-for-connecting-java.html</link><category>Database Connection Example</category><category>Java Database Connectivity</category><category>Java MySQL Connection</category><author>noreply@blogger.com (Alex Rabe)</author><pubDate>Tue, 7 Feb 2012 04:46:00 -0800</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-2445219189346048747.post-570234530410015928</guid><description>&lt;div&gt;&lt;span  &gt;This blog helps one how to connect java to mysql database, there are some steps to follow at first check for the java if java is not installed download latest jdk from sun java, This is where you can get latest java development kit http://java.sun.com/javase/downloads/index.jsp be sure that you installed java, you can check that via command prompt or terminal use this command without quote “java -version” so you must see like this  java version “1.6.0_16″, Basically java has no jar file or pre built class for mysql connection which is called mysql-connector i mean driver class which supports for mysql connection so its better to download package called mysql connector so this plays a major role during connection so download that from a mysql web site http://www.mysql.com/products/connector/ they given more version look for latest version and download ans place it in a know place say(c:\mysql or /home/mysql) but don’t forget to unzip mysql-connector and i believe that mysql-server service already started in system.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span  &gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span  &gt;This is program check the connectivity of mysql-server through localhost&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span  &gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span  &gt;import java.sql.*;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span  &gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span  &gt;public class DatabaseConnectionExample {&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span  &gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;public static void main(String args[]) {&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span  &gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt;System.out.println("Database Connection Example");&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span  &gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt;Connection con = null;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span  &gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt;String url = "jdbc:mysql://localhost:3306/";&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span  &gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt;//String dbName = "test";&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span  &gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt;String driver = "com.mysql.jdbc.Driver";&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span  &gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt;String userName = "root";&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span  &gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt;String password = "";&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span  &gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt;try {&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span  &gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;   &lt;/span&gt;Class.forName(driver).newInstance();&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span  &gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;   &lt;/span&gt;//con = DriverManager.getConnection(url + dbName,userName,password);&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span  &gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;   &lt;/span&gt;con = DriverManager.getConnection(url,userName,password);&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span  &gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;   &lt;/span&gt;System.out.println("Database Connected");&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span  &gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;   &lt;/span&gt;con.close();&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span  &gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;   &lt;/span&gt;System.out.println("Connection Colsed.");&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span  &gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt;}&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span  &gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt;catch (Exception e){&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span  &gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;   &lt;/span&gt;System.out.println("Error: "+e);&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span  &gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt;}&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span  &gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;}&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span  &gt;}&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span  &gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span  &gt;Save as DatabaseConnectionExample.java, while compile it you have to include classpath of java to know more about classpath sun java is best guide http://java.sun.com/j2se/1.4.2/docs/tooldocs/solaris/classpath.html&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span  &gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span  &gt;Now it time to compile open command prompt go to the location of DatabaseConnectionExample.java if your your program is under c:\&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span  &gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span  &gt;use c: also may be at /home for tux users now compile it using javac -classpath /home/mysql/mysql-connector.bin.jar DatabaseConnectionExample.java so this command has three part javac, -calsspath, filepath, here javac is a compiler and we included a classpath of mysql-connector jar file locate that wherever it is for an example i given as /home/mysql/mysql-connector.bin.jar and next to that is java file. after compilation program needs to run so java interpreter shall do this job if this command is used java -classpath /home/mysql/mysql-connector.bin.jar: DatabaseConnectionExample. in my second I used colon so its specific for linux user unless windows use ;(semi-colon)&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span  &gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span  &gt;For Eclipse users, use can import mysql-connector.jar file to classpath before creating a class file, right click the project go to properties and choose java build path and then choose libraries tab and add external jar file.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span  &gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span  &gt;Program shows this output&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span  &gt;Database Connected.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span  &gt;Connection Closed.&lt;/span&gt;&lt;/div&gt;</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><title>Creating a Database Table</title><link>http://javaj2eetutorials.blogspot.com/2012/02/creating-database-table.html</link><category>Create Table Java</category><author>noreply@blogger.com (Alex Rabe)</author><pubDate>Mon, 6 Feb 2012 05:35:00 -0800</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-2445219189346048747.post-3509748845454482472</guid><description>&lt;div&gt;package com;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;import java.sql.*;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;public class CreateTableExample {&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;public static void main(String args[]){&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt;System.out.println("Creation Table Example");&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt;Connection con = null;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt;String url = "jdbc:mysql://localhost:3306/";&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt;String dbName = "test_db";&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt;String driver = "com.mysql.jdbc.Driver";&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt;String userName = "root";&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt;String password = "";&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt;try {&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;   &lt;/span&gt;Class.forName(driver).newInstance();&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;   &lt;/span&gt;con = DriverManager.getConnection(url + dbName, userName, password);&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;   &lt;/span&gt;System.out.println("Database Connected");&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;   &lt;/span&gt;try {&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;    &lt;/span&gt;Statement stmt = con.createStatement();&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;    &lt;/span&gt;String table = "CREATE TABLE EMPLOYEE(emp_id integer, emp_name varchar(50) )";&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;    &lt;/span&gt;stmt.executeUpdate(table);&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;    &lt;/span&gt;System.out.println("Table created successfully");&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;   &lt;/span&gt;}&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;   &lt;/span&gt;catch (Exception e){&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;    &lt;/span&gt;System.out.println("Sorry!! Table already exists.");&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;   &lt;/span&gt;}&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;   &lt;/span&gt;con.close();&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;   &lt;/span&gt;System.out.println("Connection Closed");&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt;}&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt;catch (Exception e){&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;   &lt;/span&gt;System.out.println("Error: " +e);&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;   &lt;/span&gt;e.printStackTrace();&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt;}&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;}&lt;/div&gt;&lt;div&gt;}&lt;/div&gt;&lt;div&gt;========&lt;/div&gt;&lt;div&gt;Out Put&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Creation Table Example&lt;/div&gt;&lt;div&gt;Database Connected&lt;/div&gt;&lt;div&gt;Table created successfully&lt;/div&gt;&lt;div&gt;Connection Closed&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><title>MySQL Database Connection in Java</title><link>http://javaj2eetutorials.blogspot.com/2012/01/mysql-database-connection-in-java.html</link><category>Java MySQL Connection</category><category>MySQL Connection</category><category>MySQL Database Connection</category><author>noreply@blogger.com (Alex Rabe)</author><pubDate>Mon, 23 Jan 2012 22:04:00 -0800</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-2445219189346048747.post-7556851049946934765</guid><description>&lt;div&gt;&lt;b&gt;Description of program:&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;This program establishes the connection between MySQL database and java files with the help of various types of APIs interfaces and methods. If connection is established then it shows "Connected to the database" otherwise it will displays a message "Disconnected from database".&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;Description of code:&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;Connection: &lt;/b&gt;This is an interface in  java.sql package that specifies connection with specific database like: MySQL, Ms-Access, Oracle etc and java files. The SQL statements are executed within the context of the Connection interface.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;Class.forName(String driver): &lt;/b&gt;This method is static. It attempts to load the class and returns class instance and takes string type value (driver) after that matches class with given string.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;DriverManager: &lt;/b&gt;It is a class of java.sql package that controls a set of JDBC drivers. Each driver has to be register with this class.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;getConnection(String url, String userName, String password):&lt;/div&gt;&lt;div&gt;This method establishes a connection to specified database url. It takes three string types of arguments like: &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;url: - Database url where stored or created your database&lt;/div&gt;&lt;div&gt;userName: - User name of MySQL&lt;/div&gt;&lt;div&gt;password: -Password of MySQL &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;con.close(): &lt;/b&gt;This method is used for disconnecting the connection. It frees all the resources occupied by the database.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;printStackTrace(): &lt;/b&gt;The method is used to show error messages. If the connection is not established then exception is thrown and print the message.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;Code of program:&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;import java.sql.*;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;public class MysqlConnect{&lt;/div&gt;&lt;div&gt;  public static void main(String[] args) {&lt;/div&gt;&lt;div&gt;  System.out.println("MySQL Connect Example.");&lt;/div&gt;&lt;div&gt;  Connection conn = null;&lt;/div&gt;&lt;div&gt;  String url = "jdbc:mysql://localhost:3306/";&lt;/div&gt;&lt;div&gt;  String dbName = "jdbctutorial";&lt;/div&gt;&lt;div&gt;  String driver = "com.mysql.jdbc.Driver";&lt;/div&gt;&lt;div&gt;  String userName = "root"; &lt;/div&gt;&lt;div&gt;  String password = "root";&lt;/div&gt;&lt;div&gt;  try {&lt;/div&gt;&lt;div&gt;  Class.forName(driver).newInstance();&lt;/div&gt;&lt;div&gt;  conn = DriverManager.getConnection(url+dbName,userName,password);&lt;/div&gt;&lt;div&gt;  System.out.println("Connected to the database");&lt;/div&gt;&lt;div&gt;  conn.close();&lt;/div&gt;&lt;div&gt;  System.out.println("Disconnected from database");&lt;/div&gt;&lt;div&gt;  } catch (Exception e) {&lt;/div&gt;&lt;div&gt;  e.printStackTrace();&lt;/div&gt;&lt;div&gt;  }&lt;/div&gt;&lt;div&gt;  }&lt;/div&gt;&lt;div&gt;}&lt;/div&gt;</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><title>Delete Data Records Using JSP, My Sql</title><link>http://javaj2eetutorials.blogspot.com/2012/01/delete-data-records-using-jsp-my-sql.html</link><category>Delete Data Records</category><category>JSP</category><category>MySQL</category><author>noreply@blogger.com (Alex Rabe)</author><pubDate>Sat, 14 Jan 2012 05:06:00 -0800</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-2445219189346048747.post-3133511987131139563</guid><description>&lt;div&gt;&lt;span &gt;&lt;b&gt;deleteRecords.jsp&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span &gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span &gt;&amp;lt;%@ page language = "java" contentType="text/html; charset=ISO-8859-1"&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span &gt;    pageEncoding="ISO-8859-1"%&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span &gt;    &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span &gt;&amp;lt;%@ page import = "java.sql.*"%&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span &gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span &gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span &gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span &gt;&lt;meta equiv="Content-Type" content="text/html; charset=ISO-8859-1"&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span &gt;&lt;title&gt;Delete Records&lt;/title&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span &gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span &gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span &gt;&amp;lt;%! boolean success = false; %&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span &gt;&amp;lt;%&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span &gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;int delID = Integer.parseInt(request.getParameter("deleteID"));&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span &gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;//String sql = "DELETE * FROM EMP_DETAIL WHERE ID = '"+delID+"'";&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span &gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;String sql = "DELETE FROM EMP_DETAIL WHERE ID = ?";&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span &gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span &gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;Connection con = null;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span &gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;PreparedStatement psmt = null;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span &gt; &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span &gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;String url = "jdbc:mysql://localhost:3306/test_db";&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span &gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;String driver = "com.mysql.jdbc.Driver";&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span &gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;String userName = "root";&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span &gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;String password = "";&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span &gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;Class.forName(driver).newInstance();&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span &gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;con = DriverManager.getConnection(url, userName, password);&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span &gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;psmt = con.prepareStatement(sql);&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span &gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;psmt.setInt(1, delID);&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span &gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;int nRows = psmt.executeUpdate();&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span &gt; &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span &gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;if(nRows == 0){&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span &gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt;success = false;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span &gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;}&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span &gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;else{&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span &gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt;success = true;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span &gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;}&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span &gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;psmt.close();&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span &gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;con.close();&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span &gt;%&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span &gt;&amp;lt;%&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span &gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;if(success == true){&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span &gt;%&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span &gt;&lt;div&gt;&lt;span &gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span &gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span &gt;&lt;/span&gt;&lt;/div&gt;&lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;One record deleted&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;a href="./viewRecords.jsp"&gt;View Records&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span &gt;&lt;span &gt;&amp;lt;%&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span &gt;&lt;span &gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span &gt;&lt;span &gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;else{&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span &gt;&lt;span &gt;%&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span &gt;&lt;span &gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span &gt;&lt;span &gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;Can not delete record now. Please try later...&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span &gt;&lt;span &gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&amp;lt;%&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span &gt;&lt;span &gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span &gt;&lt;span &gt;%&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span &gt;&lt;span &gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item></channel></rss>