<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress.com" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	>

<channel>
	<title>servlet &amp;laquo; WordPress.com Tag Feed</title>
	<link>http://wordpress.com/tag/servlet/</link>
	<description>Feed of posts on WordPress.com tagged "servlet"</description>
	<pubDate>Tue, 14 Oct 2008 09:01:35 +0000</pubDate>

	<generator>http://wordpress.com/tags/</generator>
	<language>en</language>

<item>
<title><![CDATA[Manejo de Sesiones con Servlets en NetBeans 6.1]]></title>
<link>http://nachxs.wordpress.com/?p=299</link>
<pubDate>Thu, 09 Oct 2008 22:23:31 +0000</pubDate>
<dc:creator>nachxs</dc:creator>
<guid>http://nachxs.fr.wordpress.com/2008/10/09/manejo-de-sesiones-con-servlets-en-netbeans-61/</guid>
<description><![CDATA[Regularmente cuando realizaba pequeños proyectos web y trabajaba con sesiones siempre todo lo manej]]></description>
<content:encoded><![CDATA[<p style="text-align:justify;">Regularmente cuando realizaba pequeños proyectos web y trabajaba con sesiones siempre todo lo manejaba en archivos JSP, pero esta vez decidi probar un servlet para el manejo de sesiones y mostrar lo facil que puede resultar. Lo que comunmente hacemos es trabajar con el famoso cuadro de logueo, en donde colocamos el usuario y el password para luego ser validado y crear la sesion. Bueno lo primero que tenemos hacer es crear el proyecto dentro de <a href="http://www.netbeans.org/">NetBeans</a> (ya saben como aplicativo web) y luego escribir algo de código basico HTML dentro del archivo "index.jsp" creando el cuadro de logueo mas o menos quedando asi:</p>
<p style="text-align:justify;"><a href="http://nachxs.files.wordpress.com/2008/10/sessiones_1.png"><img class="aligncenter size-medium wp-image-300" title="sessiones_1" src="http://nachxs.wordpress.com/files/2008/10/sessiones_1.png?w=300" alt="" width="300" height="163" /></a></p>
<p style="text-align:justify;"><a href="http://nachxs.files.wordpress.com/2008/10/sessiones_1.png"></a>El diseño queda a disposicion de ustedes, ahora hay un sin fin de herramientas que permiten realizar este tipo de trabajo, esto es solo para uso didactico. obviamente esta tabla de logueo lo mantendremos dentro de un "form" dado que utilizaremos el metodo POST y en el action colocaremos el Servlet al cual llamaremos "GeneraSession".</p>
<p style="text-align:justify;"><a href="http://nachxs.files.wordpress.com/2008/10/session_1.png"><img class="aligncenter size-medium wp-image-305" title="session_1" src="http://nachxs.wordpress.com/files/2008/10/session_1.png?w=300" alt="" width="300" height="248" /></a></p>
<p style="text-align:justify;">Una vez hecho esto, creamos el archivo "principal.jsp" el cual nos servira para mostrar el resultado luego de realizar el logueo.</p>
<p style="text-align:justify;">Luego creamos nuestra clase que actuara como servlet. Hacemos click derecho sobre nuestro proyecto y elejimos New --&#62; Servlet, le damos el nombre (GeneraSession.java) y se nos mostrara un cuadro en donde nos dice que este nombre del servlet sera añadido al archivo de configuración "web.xml" el cual servira para poder ubicarlo y luego le damos click en terminar</p>
<p style="text-align:justify;"><a href="http://nachxs.wordpress.com/files/2008/10/session_2.png"><img class="aligncenter size-medium wp-image-301" title="session_2" src="http://nachxs.wordpress.com/files/2008/10/session_2.png?w=300" alt="" width="300" height="206" /></a></p>
<p style="text-align:justify;">Una vez hecho esto solo quedaria agregar el codigo dentro del metodo "processRequest", quedando algo como esto:</p>
<p style="text-align:justify;"><a href="http://nachxs.files.wordpress.com/2008/10/session_3.png"><img class="aligncenter size-medium wp-image-302" title="session_3" src="http://nachxs.wordpress.com/files/2008/10/session_3.png?w=300" alt="" width="300" height="194" /></a></p>
<p style="text-align:justify;">Podemos observar que estamos obteniendo los datos del formulario mediante el request para ser validado y asi poder generar la sesion, para luego enviarnos a la pagina principal. Ahora esto no quedaria alli; en la pagina "principal.jsp" que ha sido creada tendriamos que realizar tambien la validacion de la sesion, dado que como sabemos las sesiones tienen un tiempo de vida, si sobrepasa este tiempo la sesion automaticamente se destruye (a no ser que personalize el tiempo de vida), entonces en la pagina "principal.jsp" tendriamos algo como esto:</p>
<p style="text-align:justify;"><a href="http://nachxs.files.wordpress.com/2008/10/session_4.png"><img class="aligncenter size-medium wp-image-303" title="session_4" src="http://nachxs.wordpress.com/files/2008/10/session_4.png?w=300" alt="" width="300" height="156" /></a></p>
<p style="text-align:justify;"><a href="http://nachxs.files.wordpress.com/2008/10/session_4.png"></a>De esta forma validamos si la sesion persite, en caso contrario te enviaria a la pagina de inicio para volver ha realizar el logueo.</p>
<p style="text-align:justify;">Como veran es una forma practica de trabajar con sesiones mediante un servlet; obviamente esto tendria que mejorarse, pero esto puede ser un punto de partida para muchos.</p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[goodbye 'struts-spring-hibernate' and welcome 'jsf-ejb-jpa']]></title>
<link>http://nohnit.wordpress.com/2008/10/08/goodbye-struts-spring-hibernate-and-welcome-jsf-ejb-jpa/</link>
<pubDate>Wed, 08 Oct 2008 20:01:15 +0000</pubDate>
<dc:creator>echo</dc:creator>
<guid>http://nohnit.fr.wordpress.com/2008/10/08/goodbye-struts-spring-hibernate-and-welcome-jsf-ejb-jpa/</guid>
<description><![CDATA[Walaupun kebanyakan sekarang orang menggunakan Struts1/2 untuk presentation layer, dan Spring untuk ]]></description>
<content:encoded><![CDATA[<p><img style="border-width:0;" height="128" alt="prefs" src="http://nohnit.files.wordpress.com/2008/10/prefs.png" width="128" align="left" border="0">Walaupun kebanyakan sekarang orang menggunakan Struts1/2 untuk presentation layer, dan <a title="Situs Spring" href="http://www.springframework.org/" target="_blank">Spring</a> untuk busines layer, dan <a title="Situs Hibernate" href="http://www.hibernate.org/" target="_blank">Hibernate</a> untuk persistence layer, tapi sekarang saya mau migrasi ke <a href="http://java.sun.com/javaee/javaserverfaces/" target="_blank">JSF</a> untuk presentation layer, dan <a href="http://java.sun.com/products/ejb/" target="_blank">EJB</a> untuk busines layer, dan JPA untuk persistence..</p>
<p>"<em>mengapa?"</em></p>
<p>tentunya saya punya alasan tersendiri :D</p>
<p>tapi alasan saya belum tentu bagus untuk anda, dan alasan anda belum tentu bagus juga untuk saya :D</p>
<p><!--more-->
<p>walaupun saya sudah migrasi dari <a href="http://struts.apache.org/" target="_blank">Struts1</a> ke <a href="http://struts.apache.org/2.x/" target="_blank">Struts2</a> trus akhirnya ke <a href="http://java.sun.com/javaee/javaserverfaces/" target="_blank">JSF</a> sudah lama, tapi pura-puranya saya baru migrasi sekarang :D , hehehe.</p>
<h2>JSF</h2>
<p>saya pindah dari <a href="http://struts.apache.org/" target="_blank">struts1</a>--&#62;<a href="http://struts.apache.org/2.x/" target="_blank">struts2</a> dan akhirnya ke <a href="http://java.sun.com/javaee/javaserverfaces/" target="_blank">JSF</a> karena ketika pertama kali saya belajar JSF disitu saya melihat ada kesamaan antara konsep <a href="http://java.sun.com/javaee/javaserverfaces/" target="_blank">JSF</a> dan Swing. yaitu berbasis komponen. sehingga hal ini membuat pembuatan halaman web sangat mudah karena berbasiskan komponen, artinya kita membuat halaman web seperti mendesain form dalam aplikasi desktop :D</p>
<p>dan selain itu <a href="http://java.sun.com/javaee/javaserverfaces/" target="_blank">JSF</a> juga mendukung <a href="http://en.wikipedia.org/wiki/Dependency_Injection_" target="_blank">Dependency Injection </a>yang mencakup scope untuk aplikasi website seperti request, session dan application :D , sehingga ini bisa digunakan sebagai pengganti DI-nya milik Spring :D</p>
<h2>EJB</h2>
<p>namun untuk total migrasi dari Spring ke <a href="http://java.sun.com/products/ejb/" target="_blank">EJB</a> secara total mungkin baru sekarang ini, walaupun pertamanya saya belajar <a href="http://java.sun.com/products/ejb/" target="_blank">EJB</a> lalu <a title="Situs Spring" href="http://www.springframework.org/" target="_blank">Spring</a> dan sekarang saya balik lagi ke <a href="http://java.sun.com/products/ejb/" target="_blank">EJB</a> :D</p>
<p>sebenarnya banyak orang enggan menggunakan <a href="http://java.sun.com/products/ejb/" target="_blank">EJB</a> karena dulu ketika <a href="http://java.sun.com/products/ejb/" target="_blank">EJB</a> masih versi 2.x, <a href="http://java.sun.com/products/ejb/" target="_blank">EJB</a> dikatakan sebagai nighmare (mimpi buruk) bagi pengembang, entah saya juga kurang tahu karena saya mempelajari EJB sejak versi 3, dan menurut cerita penggunaan <a href="http://java.sun.com/products/ejb/" target="_blank">EJB</a> 2.x sangat komplex dan memakan resource yang boros. :D</p>
<p>dan untungnya, pihak pengembang tidak putus asa dengan kegagalan <a href="http://java.sun.com/products/ejb/" target="_blank">EJB</a> 2.x, sehingga sekarang saya bisa menikmati kemudahan dan kehebatan <a href="http://java.sun.com/products/ejb/" target="_blank">EJB</a> 3.0 (yang katanya sebentar lagi mau keluar <a href="http://java.sun.com/products/ejb/" target="_blank">EJB</a> 3.1) :D</p>
<p>Sebenarnya, kemampuan <a href="http://java.sun.com/products/ejb/" target="_blank">EJB</a> tidak terlalu dapat dibanggakan dengan <a title="Situs Spring" href="http://www.springframework.org/" target="_blank">Spring</a> Framework yang udah begitu banyak, namun disini saya menitik beratkan <a href="http://java.sun.com/products/ejb/" target="_blank">EJB</a> dan Spring sebagai busines layer, bukan yang lainnya. </p>
<p>satu hal yang menjadi daya tarik <a href="http://java.sun.com/products/ejb/" target="_blank">EJB</a> adalah kemampuan Injectionnya yang hanya dengan menggunakan annotation @EJB, tanpa melakukan konfigurasi seperti di <a title="Situs Spring" href="http://www.springframework.org/" target="_blank">Spring</a>. hal ini memudahkan kita untuk memanggil komponen <a href="http://java.sun.com/products/ejb/" target="_blank">EJB</a> secara langsung tanpa harus menginjeknya lewat metode setter atau lewat konstruktor seperti yang dilakukan Spring.</p>
<p>Namun harus di perhatikan jika <a href="http://java.sun.com/products/ejb/" target="_blank">EJB</a> hanya dapat berjalan pada server yang mendukung JEE, sehingga jika kita menggunakan server seperti <a title="Situs Apache Tomcat" href="http://jakarta.apache.org/tomcat" target="_blank">Tomcat</a> dan <a title="Situs Glassfish" href="https://glassfish.dev.java.net/" target="_blank">GlassFish</a> v.3, maka <a href="http://java.sun.com/products/ejb/" target="_blank">EJB</a> tak akan berjalan karena server-server tersebut hanya digunakan untuk WebServer, so untuk menjalankan <a href="http://java.sun.com/products/ejb/" target="_blank">EJB</a> kita perlu menggunakan server seperti <a title="Situs JBoss" href="http://www.jboss.org/" target="_blank">JBoss</a> ato <a title="Situs Glassfish" href="https://glassfish.dev.java.net/" target="_blank">GlassFish</a> v.2</p>
<h2>JPA</h2>
<p>jpa sebenarnya merupakan spesifikasi yang tergabung dalam EJB yang dinamakan EJB-Entity. namun JPA tidak selalu harus berjalan bersama EJB, karena JPA juga dapat berjalan dalam aplikasi desktop ato web sama seperti Hibernate ato TopLink.</p>
<p>Sebenarnya JPA bukanlah sebuah framework untuk persistence, tapi merupakan spesifikasi seperti JDBC, sehingga untuk menjalankan JPA kita memerlukan implementasinya seperti menggunakan <a href="http://www.oracle.com/technology/products/ias/toplink/index.html" target="_blank">TopLink</a>, <a title="Situs Hibernate" href="http://www.hibernate.org/" target="_blank">Hibernate</a>, <a href="http://www.eclipse.org/eclipselink/" target="_blank">EclipseLink</a>, <a href="http://openjpa.apache.org/" target="_blank">OpenJPA</a>, KODO dan yang lainnya.</p>
<p>sehingga JPA bisa dikatakan sebagai JDBC tingkat tinggi :D (ngarang), karena emang penggunaannya sangat mudah dari pada JDBC dan hampir mirip seperti <a title="Situs Hibernate" href="http://www.hibernate.org/" target="_blank">Hibernate</a>.</p>
<p>hanya saja karena JPA merupakan spesifikasi yang bisa diimplementasi oleh berbagai framework, sehingga bisa dibilang JPA kurang komplete jika dibandingkan dengan Hibernate, terutama dalam hal Query.</p>
<p>namun alasan kenapa saya memilih JPA karena hal pertama adalah JPA merupakan kesatuan <a href="http://java.sun.com/products/ejb/" target="_blank">EJB</a>, sehingga penggunaannya sangat mudah dengan <a href="http://java.sun.com/products/ejb/" target="_blank">EJB</a>, dan selain itu dengan bantuan <a href="http://java.sun.com/products/ejb/" target="_blank">EJB</a> proses transaksi untuk JPA jadi mudah karena kita tak perlu memikirkan "TRANSACTION" untuk proses-proses persistence yang kita lakukan karena semuanya di handle langsung oleh <a href="http://java.sun.com/products/ejb/" target="_blank">EJB</a>.</p>
<p>Dan yang paling bermanfaat adalah JPA dapat diinjek hanya dengan menggunakan annotation @PersistenceContext atau @PersistenceUnit, sehingga penggunaannya semakin mudah, dan hal ini tanpa bantuan <a href="http://java.sun.com/products/ejb/" target="_blank">EJB</a> ato <a title="Situs Spring" href="http://www.springframework.org/" target="_blank">Spring</a>, sehingga andai kita tak menggunakan <a href="http://java.sun.com/products/ejb/" target="_blank">EJB</a>, kita tetap bisa melakukan injeksi ke JPA</p>
<h2>Facelets + SEAM</h2>
<p><a href="https://facelets.dev.java.net/" target="_blank">Facelets</a> dan <a href="http://www.seamframework.org/" target="_blank">SEAM</a> merupakan framework yang patut digunakan jika kita menggunakan <a href="http://java.sun.com/javaee/javaserverfaces/" target="_blank">JSF</a>+<a href="http://java.sun.com/products/ejb/" target="_blank">EJB</a>+JPA, karena : </p>
<p>dengan <a href="https://facelets.dev.java.net/" target="_blank">facelets</a> kita dapat dengan mudah menkoneksikan antara JSP dan JSF yang kadang ditemukan berbagai kendala seperti dalam "<em>ExpressionLanguage</em>" misalnya. dan selain itu dengan <a href="https://facelets.dev.java.net/" target="_blank">facelets</a>, pembuatan halaman web dapat berbasiskan template, sehingga mempermudah pembuatan halaman web ketika kita memerlukan halaman yang banyak namun memiliki kesamaan layout.</p>
<p>dengan <a href="http://www.seamframework.org/" target="_blank">SEAM</a>, kita dapat dengan mudah mengintregasikan antara <a href="http://java.sun.com/javaee/javaserverfaces/" target="_blank">JSF</a> dan <a href="http://java.sun.com/products/ejb/" target="_blank">EJB</a>, dan selain itu <a href="http://www.seamframework.org/" target="_blank">SEAM</a> mendukung facelets dan <a href="http://www.seamframework.org/" target="_blank">SEAM</a> juga memiliki kemampuan yang banyak seperti kemampuan untuk menampilkan Chart, kemampuan membangun RSS, integrasi untuk Email, dan lainnya. Dan semua itu berbasiskan JSF dan <a href="http://java.sun.com/products/ejb/" target="_blank">EJB</a>, sehingga <a href="http://www.seamframework.org/" target="_blank">SEAM</a> akan membuat pengguna JSF dan <a href="http://java.sun.com/products/ejb/" target="_blank">EJB</a> lebih termanjakan, hahahaha :D</p>
<p>&#160;</p>
<p><strong><em>tapi tidak selamanya pendapat saya sesuai dengan keinginan anda bukan?</em></strong></p>
<p><strong><em>itu tergantung selera :D</em></strong></p>
<p><strong><em>see you!!!</em></strong></p>
<hr>
<blockquote>
<p><a href="http://java.sun.com/products/ejb/" target="_blank">http://java.sun.com/products/ejb/</a></p>
<p><a href="https://facelets.dev.java.net/" target="_blank">https://facelets.dev.java.net/</a></p>
<p><a href="http://www.seamframework.org/" target="_blank">http://www.seamframework.org/</a></p>
<p><a title="Situs Hibernate" href="http://www.hibernate.org/" target="_blank">http://www.hibernate.org/</a></p>
<p><a title="Situs Spring" href="http://www.springframework.org/" target="_blank">http://www.springframework.org/</a></p>
<p><a href="http://struts.apache.org/" target="_blank">http://struts.apache.org/</a></p>
<p><a href="http://struts.apache.org/2.x/" target="_blank">http://struts.apache.org/2.x/</a></p>
</blockquote>
]]></content:encoded>
</item>
<item>
<title><![CDATA[Tuning Page Loading Time Using Servlet Filter]]></title>
<link>http://java4d.wordpress.com/?p=3</link>
<pubDate>Mon, 06 Oct 2008 17:21:15 +0000</pubDate>
<dc:creator>premnathcs</dc:creator>
<guid>http://java4d.fr.wordpress.com/2008/10/06/tunning-page-loading-time-using-servlet-filter/</guid>
<description><![CDATA[Most of the web application will be benefited from using this servlet filter to both compress conten]]></description>
<content:encoded><![CDATA[<p><span>Most of the web application will be benefited from using this servlet filter to both compress content and avoid the page loaded from the cache. </span><span>Compression filter optimizes the size of the content that you send from your web server to a user via the Internet. Since generating content and sending content over the World Wide Web are the bread and butter of web applications, it should be no surprise that simple components that aid in these processes are incredibly useful.</span></p>
<p><span>Servlet filters are powerful tools that are available to web application developers using the Servlet 2.3 specification or above. </span><span>Manipulate the <code>HttpServletRequest</code> and <code>HttpServletResponse</code> objects to provide above mentioned functionality in an optimized way. Compressing the response will</span><span> remove redundant information and to represent what you want in a little possible space. It is incredibly helpful for sending information across the World Wide Web, because the speed at which people get information from a web application is directly proprotional to amount of information you are trying to send. </span><span>GZIP compression can be used to compress the data before send it to client. </span><span>GZIP compression will usually get you around a 6:1 compression ratio; it depends on how much content you are sending and what the content is. In practice, this means you will send content to a user up to six times faster if you simply use GZIP compression whenever you can.</span></p>
<p>You can directly use this <a href="http://www.esnips.com/doc/fe8483fe-8a70-4ed8-8181-1b003f549f82/Gzip">Gzip.jar</a> in your web application to improve the page load time. And if you don't want the page to be fetched from the cache just add an initial parameter named "nocache" with parameter value "yes" to this filter.</p>
<ol>
<li>download <a href="http://www.esnips.com/doc/fe8483fe-8a70-4ed8-8181-1b003f549f82/Gzip">Gzip.jar</a> and save it in WEB-INF/lib</li>
<li>describe this filter in web.xm</li>
<p>&#60;filter&#62;<br />
&#60;filter-name&#62;cacheFilter&#60;/filter-name&#62;<br />
&#60;filter-class&#62;com.zip.GZIPFilter&#60;/filter-class&#62;<br />
&#60;/filter&#62;</p>
<li> to avoid page loaded from cache add the following initial parameter to the above filter</li>
<p>&#60;init-param&#62;<br />
&#60;param-name&#62;nocache&#60;/param-name&#62;<br />
&#60;param-value&#62;yes&#60;/param-value&#62;<br />
&#60;/init-param&#62;</ol>
<p>If "nocache" initial parameter is not provided the page will be loaded from web browser cache. To customize the servlet filter get the source code from <a href="http://www.esnips.com/doc/fd4c29d2-cae0-4183-a6f4-e07eb42a4567/filters">Gzip.zip</a></p>
<p><a href="http://www.esnips.com/doc/fe8483fe-8a70-4ed8-8181-1b003f549f82/Gzip">Gzip.jar</a>: Ready-to-use JAR with compiled version of Servlet Filter to compress and to avoid page load from cache<br />
<a href="http://www.esnips.com/doc/fd4c29d2-cae0-4183-a6f4-e07eb42a4567/filters">Gzip.zip</a>: All source code for this article in one ZIP</p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[Enhancing Reporting Consistency And Usability Using Tools in J2EE-based Web Applications]]></title>
<link>http://fluxt.wordpress.com/?p=31</link>
<pubDate>Mon, 06 Oct 2008 15:55:34 +0000</pubDate>
<dc:creator>Joel Barciauskas</dc:creator>
<guid>http://joel.barciausk.as/2008/10/06/enhancing-reporting-consistency-and-usability-using-tools-in-j2ee-based-web-applications/</guid>
<description><![CDATA[An article I wrote was just posted up on the Nexaweb Developer Center.  The article does not center]]></description>
<content:encoded><![CDATA[<p>An article I wrote was just posted up on the <a href="http://http://dev.nexaweb.com">Nexaweb Developer Center</a>.  The article does not center around Nexaweb platform technologies, but rather is a general How-To for J2EE servlets, guiding a user through the creation of a servlet that enables the creation and embedding of charts into user-created PowerPoint templates.</p>
<p>Why would you be interested in such a thing? From the article,</p>
<blockquote><p>Business users often request functionality in their web applications that connects them to the applications they know best – the Microsoft Office suite.  In particular, a significant portion of today’s workforce live and breathe PowerPoint and Excel daily.</p>
<p>However, silos of data embedded in Excel spreadsheets scattered across the company present real challenges for today’s CIOs and IT executives in charge of maintaining consistent and accurate reporting.  In this post, I am going to describe a solution for providing a consistent and easy to use method for enhancing reporting consistency across the enterprise by providing business users the ability to upload their presentation tool of choice – a PowerPoint presentation – and return the same presentation to them containing accurate and up-to-date data in the form of customizable charts and tables.</p></blockquote>
<p><a href="http://dev.nexaweb.com/home/us.dev/index.html@cid=2902.html">Read the whole article</a> to learn more.</p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[[ANN] Nuovi articoli su Java e J2EE]]></title>
<link>http://megadix.wordpress.com/?p=154</link>
<pubDate>Fri, 03 Oct 2008 08:15:14 +0000</pubDate>
<dc:creator>megadix</dc:creator>
<guid>http://blog.megadix.it/2008/10/03/ann-nuovi-articoli-su-java-e-j2ee/</guid>
<description><![CDATA[Schedulare i job con Quartz e Spring
La schedulazione di procedure ricorrenti è una cartatteristica]]></description>
<content:encoded><![CDATA[<p><a href="http://www.megadix.it/node/78" target="_blank">Schedulare i job con Quartz e Spring</a></p>
<p>La schedulazione di procedure ricorrenti è una cartatteristica di molte applicazioni, soprattutto quelle di una certa complessità. In questo articolo vediamo come sia semplice integrare Quartz in applicazioni esistenti e che facciano uso dello Spring framework.</p>
<p><a href="http://www.megadix.it/node/79" target="_blank">UrlRewriteFilter - un mod_rewrite per le servlet</a></p>
<p>In questo articolo spiego come utilizzare UrlRewriteFilter, un utilissimo filtro che emula il comportamento di mod_rewrite, permettendo magie altrimenti molto difficili da realizzare "a mano"</p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[Redirigir un servlet a un página JSP pasándole parámetros]]></title>
<link>http://localhost/tuto/?p=16</link>
<pubDate>Thu, 25 Sep 2008 18:52:31 +0000</pubDate>
<dc:creator>varetti</dc:creator>
<guid>http://varetti.fr.wordpress.com/2008/09/25/redirigir-un-servlet-a-un-pagina-jsp-pasandole-parametros/</guid>
<description><![CDATA[Para redirigir un servlet a una página JSP pasándole parámetros hay que poner lo siguiente en el ]]></description>
<content:encoded><![CDATA[<p>Para redirigir un servlet a una página JSP pasándole parámetros hay que poner lo siguiente en el código:</p>
<p><strong>En el servlet</strong></p>
<p>[sourcecode language="java"]request.getSession().setAttribute("nombre_param", "valor_param");<br />
response.sendRedirect("/ejemplo.jsp");[/sourcecode]</p>
<p><strong>En el 'ejemplo.jsp'</strong></p>
<p>[sourcecode language="java"]<%<br />
String nombre_variable = (String)session.getAttribute("nombre_param");<br />
%>[/sourcecode]</p>
<p><strong>Nota:</strong> <em>nombre_param</em> y <em>valor_param</em> son el nombre y el valor del parámetro que se quiere pasar. Se pueden pasar tantos parámetros como se quiera.</p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[download ebook pemrograman java game]]></title>
<link>http://nohnit.wordpress.com/2008/09/21/download-ebook-pemrograman-java-game/</link>
<pubDate>Sun, 21 Sep 2008 01:24:01 +0000</pubDate>
<dc:creator>echo</dc:creator>
<guid>http://nohnit.fr.wordpress.com/2008/09/21/download-ebook-pemrograman-java-game/</guid>
<description><![CDATA[ 
Pemrograman Java Game

Pengenalan Game
Collection dan Thread
Event Handling
Efek Suara
Grafik Vect]]></description>
<content:encoded><![CDATA[<p><strong><img src="http://nohnit.files.wordpress.com/2008/09/documents.png"> </strong>
<p><strong>Pemrograman Java Game</strong>
<ul>
<li>Pengenalan Game
<li>Collection dan Thread
<li>Event Handling
<li>Efek Suara
<li>Grafik Vector
<li>Grafik Bitmap
<li>Skala, Rotasi dan Translasi
<li>Sprite dan Collision Detection
<li>Pemrograman Socket</li>
</ul>
<p><!--more-->
<p><a href="http://www.box.net/shared/htvllkqavx">Download Here</a></p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[download ebook pemrograman java web]]></title>
<link>http://nohnit.wordpress.com/2008/09/21/download-ebook-pemrograman-java-web/</link>
<pubDate>Sun, 21 Sep 2008 01:16:13 +0000</pubDate>
<dc:creator>echo</dc:creator>
<guid>http://nohnit.fr.wordpress.com/2008/09/21/download-ebook-pemrograman-java-web/</guid>
<description><![CDATA[ 
Pemrograman Java Web

Pengenalan Pemrograman Web
Basic Servlet
Advanced Servlet
Dasar JSP
SQL dan ]]></description>
<content:encoded><![CDATA[<p><strong><img src="http://nohnit.files.wordpress.com/2008/09/documents.png"> </strong>
<p><strong>Pemrograman Java Web</strong>
<ul>
<li>Pengenalan Pemrograman Web
<li>Basic Servlet
<li>Advanced Servlet
<li>Dasar JSP
<li>SQL dan JDBC
<li>JSP Lanjutan
<li>MVC Intro
<li>Advanced MVC
<li>JSF
<li>Advanced JSF
<li>Web Security
<li>AJAX
<li>J2EE Design Pattern
<li>App Case Study</li>
</ul>
<p><!--more-->
<ul><a href="http://www.box.net/shared/2za1qzjijs">Download Here</a></ul>
]]></content:encoded>
</item>
<item>
<title><![CDATA[JAVA EBOOK FREE Download in PDF-CHM]]></title>
<link>http://itebookfile.wordpress.com/?p=5</link>
<pubDate>Sat, 13 Sep 2008 04:17:20 +0000</pubDate>
<dc:creator>Wordpress Ebook</dc:creator>
<guid>http://itebookfile.fr.wordpress.com/2008/09/13/java-ebook-free-download-in-pdf-chm/</guid>
<description><![CDATA[Download EBOOK Free at www.eBooks-Space.com

330 Java Tips
Advanced Java 2 Platform HOW TO PROGRAM
A]]></description>
<content:encoded><![CDATA[<p>Download EBOOK Free at <a href="http://www.ebooks-space.com/">www.eBooks-Space.com</a></p>
<ul>
<li><a class="link_text_underline" title="Ebooks 330 Java Tips" href="http://www.ebooks-space.com/ebook/68/330-Java-Tips.html" target="_blank">330 Java Tips</a></li>
<li><a class="link_text_underline" title="Ebooks Advanced Java 2 Platform HOW TO PROGRAM" href="http://www.ebooks-space.com/ebook/538/Advanced-Java-2-Platform-HOW-TO-PROGRAM.html" target="_blank">Advanced Java 2 Platform HOW TO PROGRAM</a></li>
<li><a class="link_text_underline" title="Ebooks Agile Java Crafting Code with Test-Driven Development" href="http://www.ebooks-space.com/ebook/842/Agile-Java-Crafting-Code-with-Test-Driven-Development.html" target="_blank">Agile Java Crafting Code with Test-Driven Development</a></li>
<li><a class="link_text_underline" title="Ebooks Agile Java Development with Spring Hibernate and Eclipse" href="http://www.ebooks-space.com/ebook/838/Agile-Java-Development-with-Spring-Hibernate-and-Eclipse.html" target="_blank">Agile Java Development with Spring Hibernate and Eclipse</a></li>
<li><a class="link_text_underline" title="Ebooks Algorithms in Java Part 5 Graph Algorithms" href="http://www.ebooks-space.com/ebook/526/Algorithms-in-Java-Part-5-Graph-Algorithms.html" target="_blank">Algorithms in Java Part 5 Graph Algorithms</a></li>
<li><a class="link_text_underline" title="Ebooks An Introduction to Network Programming with Java" href="http://www.ebooks-space.com/ebook/856/An-Introduction-to-Network-Programming-with-Java.html" target="_blank">An Introduction to Network Programming with Java</a></li>
<li><a class="link_text_underline" title="Ebooks Ant Developers Handbook" href="http://www.ebooks-space.com/ebook/841/Ant-Developers-Handbook.html" target="_blank">Ant Developers Handbook</a></li>
<li><a class="link_text_underline" title="Ebooks Beginning EJB 3 Application Development" href="http://www.ebooks-space.com/ebook/752/Beginning-EJB-3-Application-Development.html" target="_blank">Beginning EJB 3 Application Development</a></li>
<li><a class="link_text_underline" title="From Novice to Professional" href="http://www.ebooks-space.com/ebook/586/Beginning-J2ME%3A-From-Novice-to-Professional.html" target="_blank">Beginning J2ME: From Novice to Professional</a></li>
<li><a class="link_text_underline" title="EJB JDBC JSP and Servlets" href="http://www.ebooks-space.com/ebook/260/CodeNotes-for-J2EE%3A-EJB-JDBC-JSP-and-Servlets.html" target="_blank">CodeNotes for J2EE: EJB JDBC JSP and Servlets</a></li>
<li><a class="link_text_underline" title="Ebooks Computer Graphics for Java Programmers" href="http://www.ebooks-space.com/ebook/344/Computer-Graphics-for-Java-Programmers.html" target="_blank">Computer Graphics for Java Programmers</a></li>
<li><a class="link_text_underline" title="Ebooks Concurrent and Real-Time Programming in Java" href="http://www.ebooks-space.com/ebook/835/Concurrent-and-Real-Time-Programming-in-Java.html" target="_blank">Concurrent and Real-Time Programming in Java</a></li>
<li><a class="link_text_underline" title="Mastering the JSP Standard Tag Library" href="http://www.ebooks-space.com/ebook/316/Core-JSTL%3A-Mastering-the-JSP-Standard-Tag-Library.html" target="_blank">Core JSTL: Mastering the JSP Standard Tag Library</a></li>
<li><a class="link_text_underline" title="Advanced Technologies" href="http://www.ebooks-space.com/ebook/169/Core-Servlets-and-Javaserver-Pages%3A-Advanced-Technologies.html" target="_blank">Core Servlets and Javaserver Pages: Advanced Technologies</a></li>
<li><a class="link_text_underline" title="Using Java ME Platform to Put the Fun into Your Mobile Device and Cell Phone" href="http://www.ebooks-space.com/ebook/24/Creating-Mobile-Games%3A-Using-Java-ME-Platform-to-Put-the-Fun-into-Your-Mobile-Device-and-Cell-Phone.html" target="_blank">Creating Mobile Games: Using Java ME Platform to Put the Fun into Your Mobile Device and Cell Phone</a></li>
<li><a class="link_text_underline" title="Ebooks Data Structures and Algorithms in Java" href="http://www.ebooks-space.com/ebook/481/Data-Structures-and-Algorithms-in-Java.html" target="_blank">Data Structures and Algorithms in Java</a></li>
<li><a class="link_text_underline" title="Architecting and Developing Secure Web Services Using Java" href="http://www.ebooks-space.com/ebook/234/Developing-Java-Web-Services%3A-Architecting-and-Developing-Secure-Web-Services-Using-Java.html" target="_blank">Developing Java Web Services: Architecting and Developing Secure Web Services Using Java</a></li>
<li><a class="link_text_underline" title="A Guide for the Java Developer" href="http://www.ebooks-space.com/ebook/373/Eclipse-in-Action%3A-A-Guide-for-the-Java-Developer.html" target="_blank">Eclipse in Action: A Guide for the Java Developer</a></li>
<li><a class="link_text_underline" title="Ebooks Eclipse Modeling Framework" href="http://www.ebooks-space.com/ebook/819/Eclipse-Modeling-Framework.html" target="_blank">Eclipse Modeling Framework</a></li>
<li><a class="link_text_underline" title="Ebooks Effective Java 2nd Edition" href="http://www.ebooks-space.com/ebook/658/Effective-Java-2nd-Edition.html" target="_blank">Effective Java 2nd Edition</a></li>
<li><a class="link_text_underline" title="Ebooks EJB 3 in Action" href="http://www.ebooks-space.com/ebook/715/EJB-3-in-Action.html" target="_blank">EJB 3 in Action</a></li>
<li><a class="link_text_underline" title="Security for Mobile Devices" href="http://www.ebooks-space.com/ebook/673/Embedded-Java-Security%3A-Security-for-Mobile-Devices.html" target="_blank">Embedded Java Security: Security for Mobile Devices</a></li>
<li><a class="link_text_underline" title="Ebooks Enterprise JavaBeans Fourth Edition" href="http://www.ebooks-space.com/ebook/23/Enterprise-JavaBeans-Fourth-Edition.html" target="_blank">Enterprise JavaBeans Fourth Edition</a></li>
<li><a class="link_text_underline" title="Ebooks Groovy in Action" href="http://www.ebooks-space.com/ebook/884/Groovy-in-Action.html" target="_blank">Groovy in Action</a></li>
<li><a class="link_text_underline" title="Ebooks Head First Servlets and JSP 2nd Edition" href="http://www.ebooks-space.com/ebook/99/Head-First-Servlets-and-JSP-2nd-Edition.html" target="_blank">Head First Servlets and JSP 2nd Edition</a></li>
<li><a class="link_text_underline" title="Ebooks Ibatis in Action" href="http://www.ebooks-space.com/ebook/901/Ibatis-in-Action.html" target="_blank">Ibatis in Action</a></li>
<li><a class="link_text_underline" title="Architecture API Design and Implementation" href="http://www.ebooks-space.com/ebook/324/Inside-Java-2-Platform-Security%3A-Architecture-API-Design-and-Implementation.html" target="_blank">Inside Java 2 Platform Security: Architecture API Design and Implementation</a></li>
<li><a class="link_text_underline" title="Ebooks Interactive Web-Based Virtual Reality with Java 3D" href="http://www.ebooks-space.com/ebook/943/Interactive-Web-Based-Virtual-Reality-with-Java-3D.html" target="_blank">Interactive Web-Based Virtual Reality with Java 3D</a></li>
<li><a class="link_text_underline" title="Ebooks Introduction to Java Programming-Comprehensive Version" href="http://www.ebooks-space.com/ebook/698/Introduction-to-Java-Programming-Comprehensive-Version.html" target="_blank">Introduction to Java Programming-Comprehensive Version</a></li>
<li><a class="link_text_underline" title="Ebooks J2EE Developers Handbook" href="http://www.ebooks-space.com/ebook/925/J2EE-Developers-Handbook.html" target="_blank">J2EE Developers Handbook</a></li>
<li><a class="link_text_underline" title="Ebooks Java 2 Bible" href="http://www.ebooks-space.com/ebook/311/Java-2-Bible.html" target="_blank">Java 2 Bible</a></li>
<li><a class="link_text_underline" title="Ebooks Java 2 Micro Edition" href="http://www.ebooks-space.com/ebook/145/Java-2-Micro-Edition.html" target="_blank">Java 2 Micro Edition</a></li>
<li><a class="link_text_underline" title="10 Projects You will Never Do at Work" href="http://www.ebooks-space.com/ebook/574/Java-After-Hours%3A-10-Projects-You-will-Never-Do-at-Work.html" target="_blank">Java After Hours: 10 Projects You will Never Do at Work</a></li>
<li><a class="link_text_underline" title="Ebooks Java and XML" href="http://www.ebooks-space.com/ebook/897/Java-and-XML.html" target="_blank">Java and XML</a></li>
<li><a class="link_text_underline" title="Your visual blueprint for creating Java-enhanced Web programs" href="http://www.ebooks-space.com/ebook/283/Java-and-XML%3A-Your-visual-blueprint-for-creating-Java-enhanced-Web-programs.html" target="_blank">Java and XML: Your visual blueprint for creating Java-enhanced Web programs</a></li>
<li><a class="link_text_underline" title="Ebooks Java Database Programming Bible" href="http://www.ebooks-space.com/ebook/84/Java-Database-Programming-Bible.html" target="_blank">Java Database Programming Bible</a></li>
<li><a class="link_text_underline" title="A Tutorial" href="http://www.ebooks-space.com/ebook/490/Java-Drawing-with-Apache-Batik%3A-A-Tutorial.html" target="_blank">Java Drawing with Apache Batik: A Tutorial</a></li>
<li><a class="link_text_underline" title="Ebooks Java For Dummies" href="http://www.ebooks-space.com/ebook/706/Java-For-Dummies.html" target="_blank">Java For Dummies</a></li>
<li><a class="link_text_underline" title="Ebooks Java Generics and Collections" href="http://www.ebooks-space.com/ebook/6/Java-Generics-and-Collections.html" target="_blank">Java Generics and Collections</a></li>
<li><a class="link_text_underline" title="Ebooks Java in 60 Minutes A Day" href="http://www.ebooks-space.com/ebook/220/Java-in-60-Minutes-A-Day.html" target="_blank">Java in 60 Minutes A Day</a></li>
<li><a class="link_text_underline" title="The Java Programmers Guide to Numerical Computing" href="http://www.ebooks-space.com/ebook/801/Java-Number-Cruncher%3A-The-Java-Programmers-Guide-to-Numerical-Computing.html" target="_blank">Java Number Cruncher: The Java Programmers Guide to Numerical Computing</a></li>
<li><a class="link_text_underline" title="Ebooks Java Performance Tuning" href="http://www.ebooks-space.com/ebook/325/Java-Performance-Tuning.html" target="_blank">Java Performance Tuning</a></li>
<li><a class="link_text_underline" title="Ebooks Java Persistence with Hibernate" href="http://www.ebooks-space.com/ebook/930/Java-Persistence-with-Hibernate.html" target="_blank">Java Persistence with Hibernate</a></li>
<li><a class="link_text_underline" title="Ebooks Java Programming Cookbook" href="http://www.ebooks-space.com/ebook/210/Java-Programming-Cookbook.html" target="_blank">Java Programming Cookbook</a></li>
<li><a class="link_text_underline" title="Advanced Techniques for Building Distributed Applications" href="http://www.ebooks-space.com/ebook/230/Java-Programming-with-CORBATM%3A-Advanced-Techniques-for-Building-Distributed-Applications.html" target="_blank">Java Programming with CORBATM: Advanced Techniques for Building Distributed Applications</a></li>
<li><a class="link_text_underline" title="A Beginners Guide, Third Edition" href="http://www.ebooks-space.com/ebook/3/Java%3A-A-Beginners-Guide,-Third-Edition.html" target="_blank">Java: A Beginners Guide, Third Edition</a></li>
<li><a class="link_text_underline" title="Ebooks JavaServer Pages Second Edition" href="http://www.ebooks-space.com/ebook/810/JavaServer-Pages-Second-Edition.html" target="_blank">JavaServer Pages Second Edition</a></li>
<li><a class="link_text_underline" title="Ebooks JavaTech an Introduction to Scientific and Technical Computing with Java" href="http://www.ebooks-space.com/ebook/773/JavaTech-an-Introduction-to-Scientific-and-Technical-Computing-with-Java.html" target="_blank">JavaTech an Introduction to Scientific and Technical Computing with Java</a></li>
<li><a class="link_text_underline" title="Simplicity and Power Beyond Java EE" href="http://www.ebooks-space.com/ebook/458/JBoss-Seam%3A-Simplicity-and-Power-Beyond-Java-EE.html" target="_blank">JBoss Seam: Simplicity and Power Beyond Java EE</a></li>
<li><a class="link_text_underline" title="Ebooks JMX in Action" href="http://www.ebooks-space.com/ebook/368/JMX-in-Action.html" target="_blank">JMX in Action</a></li>
<li><a class="link_text_underline" title="Practical Guide for JSP Programmers" href="http://www.ebooks-space.com/ebook/778/JSTL%3A-Practical-Guide-for-JSP-Programmers.html" target="_blank">JSTL: Practical Guide for JSP Programmers</a></li>
<li><a class="link_text_underline" title="Ebooks NetBeans IDE Field Guide" href="http://www.ebooks-space.com/ebook/795/NetBeans-IDE-Field-Guide.html" target="_blank">NetBeans IDE Field Guide</a></li>
<li><a class="link_text_underline" title="Ebooks Object-Oriented Programming and Java" href="http://www.ebooks-space.com/ebook/7/Object-Oriented-Programming-and-Java.html" target="_blank">Object-Oriented Programming and Java</a></li>
<li><a class="link_text_underline" title="Ebooks Professional Java JDK 6 Edition" href="http://www.ebooks-space.com/ebook/745/Professional-Java-JDK-6-Edition.html" target="_blank">Professional Java JDK 6 Edition</a></li>
<li><a class="link_text_underline" title="Ebooks Professional Java tools for extreme programming" href="http://www.ebooks-space.com/ebook/978/Professional-Java-tools-for-extreme-programming.html" target="_blank">Professional Java tools for extreme programming</a></li>
<li><a class="link_text_underline" title="Ebooks Sams Teach Yourself EJB in 21 Days" href="http://www.ebooks-space.com/ebook/370/Sams-Teach-Yourself-EJB-in-21-Days.html" target="_blank">Sams Teach Yourself EJB in 21 Days</a></li>
<li><a class="link_text_underline" title="Ebooks Sams Teach Yourself Java 6 in 21 Days" href="http://www.ebooks-space.com/ebook/450/Sams-Teach-Yourself-Java-6-in-21-Days.html" target="_blank">Sams Teach Yourself Java 6 in 21 Days</a></li>
<li><a class="link_text_underline" title="Languages Frameworks and Patterns" href="http://www.ebooks-space.com/ebook/710/Scripting-in-Java%3A-Languages-Frameworks-and-Patterns-.html" target="_blank">Scripting in Java: Languages Frameworks and Patterns </a></li>
<li><a class="link_text_underline" title="Ebooks Service Oriented Architecture with Java " href="http://www.ebooks-space.com/ebook/850/Service-Oriented-Architecture-with-Java-.html" target="_blank">Service Oriented Architecture with Java </a></li>
<li><a class="link_text_underline" title="Ebooks SOA Using Java-TM Web Services " href="http://www.ebooks-space.com/ebook/712/SOA-Using-Java-TM-Web-Services-.html" target="_blank">SOA Using Java-TM Web Services </a></li>
<li><a class="link_text_underline" title="Ebooks Struts 2 in Action" href="http://www.ebooks-space.com/ebook/63/Struts-2-in-Action.html" target="_blank">Struts 2 in Action</a></li>
<li><a class="link_text_underline" title="Ebooks The Art of Java" href="http://www.ebooks-space.com/ebook/393/The-Art-of-Java.html" target="_blank">The Art of Java</a></li>
<li><a class="link_text_underline" title="Ebooks The JFC Swing Tutorial A Guide to Constructing GUIs Second Edition" href="http://www.ebooks-space.com/ebook/130/The-JFC-Swing-Tutorial-A-Guide-to-Constructing-GUIs-Second-Edition.html" target="_blank">The JFC Swing Tutorial A Guide to Constructing GUIs Second Edition</a></li>
<li><a class="link_text_underline" title="Using Hibernate, JSPs and Servlets" href="http://www.ebooks-space.com/ebook/41/Web-Development-with-Java%3A-Using-Hibernate,-JSPs-and-Servlets.html" target="_blank">Web Development with Java: Using Hibernate, JSPs and Servlets</a></li>
</ul>
]]></content:encoded>
</item>
<item>
<title><![CDATA[JAVA/J2EE ARCHITECTS  - 6 to 10 Years - for leading client at GURGAON]]></title>
<link>http://jobs4umate.wordpress.com/?p=1809</link>
<pubDate>Thu, 11 Sep 2008 05:30:46 +0000</pubDate>
<dc:creator>Talentty</dc:creator>
<guid>http://jobs4umate.fr.wordpress.com/2008/09/11/javaj2ee-architects-6-to-10-years-for-leading-client-at-gurgaon/</guid>
<description><![CDATA[Hi URGENTLY needed JAVA/J2EE ARCHITECTS for leading client at GURGAON
Position: Java Technical Desig]]></description>
<content:encoded><![CDATA[<p>Hi URGENTLY needed JAVA/J2EE ARCHITECTS for leading client at GURGAON</p>
<p>Position: Java Technical Designer<br />
No. of Resources req. - 15<br />
Location: Gurgaon (client site)</p>
<p>Job Description:</p>
<p>Skills &#38;amp; Experience.<br />
The candidate should have 6 - 10 yrs of experience in J2EE SDLC (Software Development Life Cycle)<br />
Strong working experience in Struts, EJB, JSP,JSF, Servlet, Any Application Server and Preferable Oracle.<br />
Hibernate Mapping tool Designing &#38;amp; Development Experience on Struts, EJB, JSP, Servlet,-<br />
Good knowledge on OOps, UML and hands on Experience in Rational Tools (Rational Rose, RSA etc.),<br />
Strong Experience in Object Oriented Concept &#38;amp;Design patterns Working familiarity with development tools .<br />
Participating in Knowledge acquisition process, Analysis and Design<br />
Should coordinate and manage the delivery of LLD and component design along with reviews<br />
Prior experience on Reverse Engineering Project would be an added advantage.<br />
Reviewer in all design deliverables<br />
Status reporting and Issues / knowledge sharing / resolution discussion within Designer Analysts and Architect.<br />
Understanding the existing code/applications<br />
Technical Analysis use cases.<br />
Provide estimation and planning for relevant work area<br />
Managing 2-3 designers during Design Phase<br />
Should be able to write technical documents<br />
Coordination with Technical Leads</p>
<p>Candidates who are interested kindly send me your updated resume to <a href="mailto:isshrd@airtelmail.in">isshrd@airtelmail.in</a> with the below deatils.</p>
<p>1.  Current ctc and expected ctc<br />
2.  Notice period<br />
3.  Are you interested to work at Gurgaon<br />
4.  Your current location and contact number</p>
<p>Regards,<br />
G.M. Vadivel<br />
IMPACT Soft Solutions<br />
Chennai, India<br />
Mobile: 9841738777<br />
<a href="mailto:isshrd@airtelmail.in">isshrd@airtelmail.in</a></p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[J2EE Developers - 3 Years - Zeki Solutions - Mumbai]]></title>
<link>http://jobs4umate.wordpress.com/?p=1805</link>
<pubDate>Tue, 09 Sep 2008 18:10:28 +0000</pubDate>
<dc:creator>Talentty</dc:creator>
<guid>http://jobs4umate.fr.wordpress.com/2008/09/09/j2ee-developers-3-years-zeki-solutions-mumbai/</guid>
<description><![CDATA[Zeki Solutions , Mumbai
Zeki Solutions is a vibrant IT Firm that specializes in delivering state of ]]></description>
<content:encoded><![CDATA[<p><span class="style7"><span class="style8"><span class="style7"><strong><span class="style7"><span class="style8"><span class="style7"><strong>Zeki Solutions , Mumbai</strong></span></span></span></strong></span></span></span></p>
<p><span class="style7"><span class="style8"><span class="style7"><strong>Zeki Solutions </strong>is a vibrant IT Firm that specializes in delivering state of the art IT Solutions. We use advanced techniques and innovative project delivery solutions to help our customers achieve true busines values. Being a growing IT company gives us the competitive edge to develop customized solutions that help our clients enhance their business while at the same time, being cost effective as well.</span></span></span></p>
<p><span class="style7"><span class="style8"><span class="style7"><strong>Job Description<br />
</strong>Looking for J2EE developer who will be responsible for development, support and maintenance of web applications and works under high supervision with frequent review of task accomplished. 3-5 year experience of Java and J2EE programming a must.</span></span></span></p>
<p><span class="style7"><span class="style8"><span class="style7"><strong>Desired Candidate Profile</strong><br />
J2EE developer with minimum 3 years of experience in development, maintenance and testing of web applications. Solid understanding of Object Oriented Design &#38;amp; Architecture<br />
<strong></strong></span></span></span></p>
<p><span class="style7"><span class="style8"><span class="style7"><strong>Skills</strong>:  Java, JSP, Servlet, Struts, JDBC, Oracle Preferable: AJAX<br />
Job Type:Fulltime/consulting</span></span></span></p>
<p><span class="style7"><span class="style8"><span class="style7"><br />
<strong>Company Profile<br />
</strong>Zeki Solutions a NAL Group company is a vibrant IT firm specializing in delivering state of the art IT Solutions by applying advanced techniques and innovative project delivery solutions to help it's customers achieve true business values.</p>
<p><strong>Contact Details</strong></p>
<p></span></span></span></p>
<p><span class="style7"><span class="style8"><span class="style7"><strong>Company Name:<br />
</strong>Zeki Solutions</span></span></span></p>
<p><strong>Executive Name:<br />
</strong>Nikhil Sanghavi</p>
<p><strong>Address:<br />
Zeki Solutions</strong><br />
39 Gundivali, 1st Floor<br />
Off Sir M.V. Road<br />
Andheri (E)<br />
Mumbai,Maharashtra,INDIA 400069</p>
<p><strong>Email Address:<br />
</strong><a href="mailto:career@zekisolutions.com">career@zekisolutions.com</a></p>
<p><strong>Telephone:<br />
</strong>91-22-26833655</p>
<p><strong>Website:</strong></p>
<p><a href="http://zekisolutions.com/">http://zekisolutions.com/</a></p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[Java Enterprise, mulai dari mana ? (part 3 - Eclipse &amp; JBoss)]]></title>
<link>http://suhearie.wordpress.com/?p=216</link>
<pubDate>Mon, 01 Sep 2008 16:34:36 +0000</pubDate>
<dc:creator>suhearie</dc:creator>
<guid>http://suhearie.fr.wordpress.com/2008/09/01/java-enterprise-mulai-dari-mana-part-3-eclipse-jboss/</guid>
<description><![CDATA[Ini sebenarnya hanya perbandingan saja, saya ingin mencoba membuat aplikasi yang persis sama dengan ]]></description>
<content:encoded><![CDATA[<p style="text-align:justify;">Ini sebenarnya hanya perbandingan saja, saya ingin mencoba membuat aplikasi yang persis sama dengan yang ada di artikel sebelumnya. Bedanya, di part 2, saya membuatnya dengan IDE Netbeans dan mendeploynya di Glassfish, sedangkan kali ini saya akan menggunakan IDE Eclipse 3.4 for Java EE developer dan mendeploynya di JBoss versi 4.2.2.</p>
<p style="text-align:justify;">Karena di Java kita punya banyak pilihan, semoga artikel ini bisa memberi gambaran tentang alternatif-alternatif yang bisa kita gunakan, sekaligus menunjukkan bahwa aplikasi yang sama bisa dideploy di atas 2 application server yang berbeda tanpa harus melakukan banyak perubahan.</p>
<p style="text-align:justify;">Di artikel ini saya tidak akan mengulang penjelasan tentang apa itu Java EE dan modul-modul yang terdapat di dalamnya. Silahkan lihat <a href="http://suhearie.wordpress.com/2008/08/26/java-enterprise-mulai-dari-mana/">artikel ini untuk overview Java EE</a>, dan <a href="http://suhearie.wordpress.com/2008/08/26/java-enterprise-mulai-dari-mana-part-2-netbeans-glassfish/">artikel itu untuk penjelasan komponen Java EE yang digunakan di dalam contoh aplikasi ini</a>.</p>
<p><strong>1. Download dan install</strong></p>
<p style="text-align:justify;">Eclipse 3.4 for Java EE developer bisa didownload dari http://www.eclipse.org/downloads/. JBoss bisa didownload di http://www.jboss.org/jbossas/downloads/, saya menggunakan versi 4.2.2 GA. Ekstrak file-file zip tersebut ke komputer Anda, selanjutnya saya akan menyebut direktori instalasi eclipse sebagai ECLIPSE_HOME dan direktori instalasi JBoss sebagai JBOSS_HOME.</p>
<p><strong>2. Register JBoss ke Eclipse</strong></p>
<p style="text-align:justify;">Klik menu Windows -&#62; Preferences. Pilih item Server -&#62; Runtime Environments di tree. Kemudian klik tombol Add untuk meregister application server baru ke dalam eclipse.</p>
<p><a href="http://suhearie.files.wordpress.com/2008/08/registerjboss1.jpg"><img class="alignnone size-full wp-image-222" src="http://suhearie.wordpress.com/files/2008/08/registerjboss1.jpg" alt="" width="569" height="285" /></a></p>
<p style="text-align:justify;">Di wizard New Server Environment, pilih JBoss -&#62; JBoss v4.2, klik next, browse JBOSS_HOME anda, kemudian klik finish. Hasilnya, kita bisa melihat server JBoss kita teregister di eclipse, dan kita bisa mengontrol server ini seperti halnya Netbeans mengontrol Glassfish.</p>
<p><a href="http://suhearie.files.wordpress.com/2008/08/registerjboss2.jpg"><img class="alignnone size-full wp-image-223" src="http://suhearie.wordpress.com/files/2008/08/registerjboss2.jpg" alt="" width="606" height="161" /></a></p>
<p><!--more--></p>
<p><strong>3. Setup Project</strong></p>
<p style="text-align:justify;">Di panel Project Explorer, klik kanan, pilih New -&#62; Project. Pilh Enterprise Application Project, klik next. Isi project name dengan TestEnterpriseProject, target envronment JBoss v4.2, EAR version 5.0 dan gunakan default configuration for JBoss v4.2. Klik next, akan ditampilkan module dependencies. Kita akan meng-create module baru, klik New Module. Pilih EJB module dan Web module saja.</p>
<p><a href="http://suhearie.files.wordpress.com/2008/08/setupproject1.jpg"><img class="alignleft size-full wp-image-224" src="http://suhearie.wordpress.com/files/2008/08/setupproject1.jpg" alt="" width="250" height="326" /></a></p>
<p style="text-align:center;"><a href="http://suhearie.files.wordpress.com/2008/08/setupproject2.jpg"><img class="aligncenter size-full wp-image-225" src="http://suhearie.wordpress.com/files/2008/08/setupproject2.jpg" alt="" width="294" height="332" /></a></p>
<p style="text-align:justify;">Kembali ke wizard sebelumnya, aktifkan option Generate Deployment Descriptor. Hasilnya seperti gambar sebelah kanan.</p>
<p><a href="http://suhearie.files.wordpress.com/2008/08/setupproject31.jpg"><img class="alignleft size-full wp-image-227" src="http://suhearie.wordpress.com/files/2008/08/setupproject31.jpg" alt="" width="253" height="319" /></a></p>
<p style="text-align:center;"><a href="http://suhearie.files.wordpress.com/2008/08/setupproject4.jpg"><img class="size-full wp-image-228 aligncenter" src="http://suhearie.wordpress.com/files/2008/08/setupproject4.jpg" alt="" width="359" height="328" /></a></p>
<p style="text-align:center;">
<p style="text-align:left;">
<p style="text-align:left;">
<p style="text-align:left;"><strong>4. EJB Module</strong></p>
<p style="text-align:justify;">Klik kanan di project TestEnterpriseProjectEJB, pilih New -&#62; Session Bean.</p>
<p style="text-align:justify;"><a href="http://suhearie.files.wordpress.com/2008/09/sessionbean1.jpg"><img class="alignnone size-full wp-image-254" src="http://suhearie.wordpress.com/files/2008/09/sessionbean1.jpg" alt="" width="495" height="453" /></a></p>
<p style="text-align:justify;"><a href="http://suhearie.files.wordpress.com/2008/09/sessionbean2.jpg"><img class="alignnone size-full wp-image-255" src="http://suhearie.wordpress.com/files/2008/09/sessionbean2.jpg" alt="" width="512" height="464" /></a></p>
<p style="text-align:justify;">Eclipse secara otomatis akan meng-create class CalculatorSession sebagai bean class dan CalculatorSessionLocal sebagai interface. Untuk membuat Session Bean, kita membutuhkan sebuah interface dan sebuah class. Interface digunakan untuk menentukan method apa yang bisa dipanggil oleh client, sedangkan bean class merupakan implementasi dari method tersebut.</p>
<p style="text-align:justify;"><strong>Business Logic Interface - Local</strong></p>
<p style="text-align:justify;">Interface CalculatorSessionLocal diberi annotation @Local, artinya interface ini bisa diakses oleh client yang "local" atau berada dalam JVM yang sama dengan EJB server. Client yang kita gunakan adalah web component (JSP dan Servlet) yang berjalan di application server yang sama, sehingga kita cukup menggunakan Local interface. Di interface ini, kita hanya mendefinisikan satu method saja yaitu calculate yang menerima parameter-parameter berupa OPERATION, operand1 dan operand2.</p>
<p>[sourcecode language='java']<br />
package suhearie.blog.enterprise.ejb;<br />
import javax.ejb.Local;</p>
<p>@Local<br />
public interface CalculatorSessionLocal {</p>
<p>    public enum OPERATION {ADD, SUBSTRACT, MULTIPLY, DIVIDE};</p>
<p>    public int calculate(OPERATION operation, int oper1, int oper2);	</p>
<p>}<br />
[/sourcecode]</p>
<p style="text-align:left;"><strong>Bean Class - Business Logic Implementation</strong></p>
<p style="text-align:justify;">Class CalculatorSession adalah implementasi dari interface CalculatorSessionLocal. Kita menandainya dengan annotation @Stateless yang berarti kita mendefinisikannya sebagai Stateless Session Bean. Pada implementasi method calculate, kita melakukan perhitungan matematika yang sebenarnya.</p>
<p>[sourcecode language='java']<br />
package suhearie.blog.enterprise.ejb;</p>
<p>import javax.ejb.Stateless;</p>
<p>/**<br />
 * Session Bean implementation class CalculatorSession<br />
 */<br />
@Stateless<br />
public class CalculatorSession implements CalculatorSessionLocal {</p>
<p>    /**<br />
     * Default constructor.<br />
     */<br />
    public CalculatorSession() {<br />
        // TODO Auto-generated constructor stub<br />
    }</p>
<p>    public int calculate(OPERATION operation, int oper1, int oper2) {<br />
        switch(operation) {<br />
            case ADD:<br />
                return oper1+oper2;<br />
            case SUBSTRACT:<br />
                return oper1-oper2;<br />
            case MULTIPLY:<br />
                return oper1*oper2;<br />
            case DIVIDE:<br />
                return oper1/oper2;<br />
            default:<br />
                throw new UnsupportedOperationException("Not supported yet.");<br />
        }<br />
    }<br />
}<br />
[/sourcecode]</p>
<p style="text-align:left;"><strong>5. Web Module</strong></p>
<p style="text-align:left;">Subproject TestEnterpriseProjectWeb harus mempunyai referensi ke subproject TestEnterpriseProjectEJB, agar servlet yang kita buat bisa memanggil komponen EJB. Klik kanan di project TestEnterpriseProjectWeb, pilih Build Path -&#62; Configure Build Path. Pilih tab Projects, jika belum ada, klik tombol Add, kemudian pilih project TestEnterpriseProjectEJB.</p>
<p style="text-align:left;"><a href="http://suhearie.files.wordpress.com/2008/09/setupproject5.jpg"><img class="alignnone size-full wp-image-261" src="http://suhearie.wordpress.com/files/2008/09/setupproject5.jpg" alt="" width="556" height="246" /></a></p>
<p style="text-align:justify;"><strong>File index.jsp</strong>, kita gunakan untuk membuat form html yang akan mensubmit parameter-parameter yang digunakan untuk melakukan perhitungan. Klikkanan di project TestEnterpriseProjectWeb, pilih New -&#62; JSP.</p>
<p style="text-align:left;"><a href="http://suhearie.files.wordpress.com/2008/09/jsp1.jpg"><img class="alignnone size-full wp-image-245" src="http://suhearie.wordpress.com/files/2008/09/jsp1.jpg" alt="" width="405" height="378" /></a></p>
<p style="text-align:left;"><a href="http://suhearie.files.wordpress.com/2008/09/jsp2.jpg"><img class="alignnone size-full wp-image-246" src="http://suhearie.wordpress.com/files/2008/09/jsp2.jpg" alt="" width="405" height="378" /></a></p>
<p style="text-align:left;">Modifikasi menjadi seperti berikut:</p>
<p>[sourcecode language='html']<br />
&#38;lt;%@ page language="java" contentType="text/html; charset=ISO-8859-1"<br />
    pageEncoding="ISO-8859-1"%&#38;gt;<br />
&#38;lt;!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"&#38;gt;<br />
&#38;lt;html&#38;gt;<br />
&#38;lt;head&#38;gt;<br />
&#38;lt;meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"&#38;gt;<br />
&#38;lt;title&#38;gt;Java EE Calculator&#38;lt;/title&#38;gt;<br />
&#38;lt;/head&#38;gt;<br />
&#38;lt;body&#38;gt;<br />
&#38;lt;h2&#38;gt;Welcome to Java EE Calculator Test Project !&#38;lt;/h2&#38;gt;<br />
&#38;lt;form action='&#38;lt;%=request.getContextPath()%&#38;gt;/CalculatorServlet' method='POST'&#38;gt;<br />
            Operation:<br />
            &#38;lt;select name="operation"&#38;gt;<br />
                &#38;lt;option selected value="ADD"&#38;gt;ADD&#38;lt;/option&#38;gt;<br />
                &#38;lt;option value="SUBSTRACT"&#38;gt;SUBSTRACT&#38;lt;/option&#38;gt;<br />
                &#38;lt;option value="MULTIPLY"&#38;gt;MULTIPLY&#38;lt;/option&#38;gt;<br />
                &#38;lt;option value="DIVIDE"&#38;gt;DIVIDE&#38;lt;/option&#38;gt;<br />
            &#38;lt;/select&#38;gt;</p>
<p>            Operand 1:&#38;lt;input type="text" name="oper1" value="0" /&#38;gt;</p>
<p>            Operand 2:&#38;lt;input type="text" name="oper2" value="0" /&#38;gt;</p>
<p>            &#38;lt;input type="submit" value="Calculate" name="Calculate" /&#38;gt;<br />
        &#38;lt;/form&#38;gt;<br />
&#38;lt;/body&#38;gt;<br />
&#38;lt;/html&#38;gt;<br />
[/sourcecode]</p>
<p style="text-align:left;">Form html disubmit ke servlet (CalculatorServlet), yang sesaat lagi akan kita buat.</p>
<p style="text-align:justify;"><strong>Create servlet</strong>, dengan cara klik kanan di module TestEnterpriseProjectWeb, pilih New -&#62; Servlet. Isikan class name CalculatorServlet, dan package suhearie.blog.enterprise.servlet.</p>
<p style="text-align:left;"><a href="http://suhearie.files.wordpress.com/2008/09/servlet1.jpg"><img class="alignnone size-full wp-image-247" src="http://suhearie.wordpress.com/files/2008/09/servlet1.jpg" alt="" width="446" height="374" /></a></p>
<p style="text-align:left;"><a href="http://suhearie.files.wordpress.com/2008/09/servlet2.jpg"><img class="alignnone size-full wp-image-248" src="http://suhearie.wordpress.com/files/2008/09/servlet2.jpg" alt="" width="446" height="435" /></a></p>
<p style="text-align:left;"><a href="http://suhearie.files.wordpress.com/2008/09/servlet3.jpg"><img class="alignnone size-full wp-image-249" src="http://suhearie.wordpress.com/files/2008/09/servlet3.jpg" alt="" width="446" height="456" /></a></p>
<p style="text-align:left;">
<p style="text-align:justify;">Fitur EJB injection masih belum disupport oleh JBoss v4.2. Jadi di servlet ini, kita harus melakukan JNDI lookup secara manual. Lookup kita lakukan di dalam constructor. Default JNDI name untuk local EJB3 di JBoss adalah <strong>[ear-filename]/[bean-name]/local</strong>. Selanjutnya, kita mengambil parameter-parameter yang dikirim melalui http request, kemudian menggunakan session bean untuk melakukan perhitungan berdasarkan parameter-parameter tersebut. Hasil perhitungan kita masukkan sebagai attribut di object request. Untuk menampilkannya, kita akan memforward request menuju ke halaman JSP CalculatorPage.jsp (kita buat sesaat lagi) menggunakan RequestDispatcher.</p>
<p style="text-align:left;">Modifikasi servlet tersebut menjadi seperti kode berikut.</p>
<p>[sourcecode language='java']<br />
package suhearie.blog.enterprise.servlet;</p>
<p>import java.io.IOException;</p>
<p>import javax.ejb.EJB;<br />
import javax.naming.InitialContext;<br />
import javax.naming.NamingException;<br />
import javax.servlet.ServletException;<br />
import javax.servlet.http.HttpServlet;<br />
import javax.servlet.http.HttpServletRequest;<br />
import javax.servlet.http.HttpServletResponse;</p>
<p>import suhearie.blog.enterprise.ejb.CalculatorSessionLocal;</p>
<p>/**<br />
 * Servlet implementation class CalculatorServlet<br />
 */<br />
public class CalculatorServlet extends HttpServlet {<br />
	private static final long serialVersionUID = 1L;</p>
<p>    CalculatorSessionLocal calculatorSession;</p>
<p>    /**<br />
     * @see HttpServlet#HttpServlet()<br />
     */<br />
    public CalculatorServlet() {<br />
        super();<br />
        InitialContext ctx;<br />
		try {<br />
			ctx = new InitialContext();<br />
	        calculatorSession = (CalculatorSessionLocal) ctx.lookup("TestEnterpriseProject/CalculatorSession/local");<br />
		} catch (NamingException e) {<br />
			e.printStackTrace();<br />
		}<br />
    }</p>
<p>	/**<br />
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)<br />
	 */<br />
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {<br />
		doPost(request, response);<br />
	}</p>
<p>	/**<br />
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)<br />
	 */<br />
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {<br />
		String operation = request.getParameter("operation");<br />
        int oper1 = Integer.parseInt(request.getParameter("oper1"));<br />
        int oper2 = Integer.parseInt(request.getParameter("oper2"));</p>
<p>        int result = calculatorSession.calculate(CalculatorSessionLocal.OPERATION.valueOf(operation), oper1, oper2);<br />
        request.setAttribute("result", result);<br />
        request.getRequestDispatcher("/CalculatorPage.jsp").forward(request, response);<br />
	}</p>
<p>}<br />
[/sourcecode]</p>
<p style="text-align:left;"><strong>File CalculatorPage.jsp</strong>, kita gunakan untuk menampilkan hasil perhitungan.</p>
<p>[sourcecode language='html']<br />
&#38;lt;html&#38;gt;<br />
    &#38;lt;head&#38;gt;<br />
        &#38;lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8"&#38;gt;<br />
        &#38;lt;title&#38;gt;Java EE Calculator&#38;lt;/title&#38;gt;<br />
    &#38;lt;/head&#38;gt;<br />
    &#38;lt;body&#38;gt;<br />
&#38;lt;h2&#38;gt;Java EE Calculator Result:&#38;lt;/h2&#38;gt;<br />
Operation: &#38;lt;%=request.getParameter("operation")%&#38;gt;<br />
        Operand 1: &#38;lt;%=request.getParameter("oper1")%&#38;gt;<br />
        Operand 2: &#38;lt;%=request.getParameter("oper2")%&#38;gt;<br />
        Result:&#38;lt;B&#38;gt; &#38;lt;%=  request.getAttribute("result")%&#38;gt;&#38;lt;/B&#38;gt;<br />
        &#38;lt;a href='&#38;lt;%=request.getContextPath()%&#38;gt;/'&#38;gt;BACK&#38;lt;/a&#38;gt;<br />
    &#38;lt;/body&#38;gt;<br />
&#38;lt;/html&#38;gt;<br />
[/sourcecode]</p>
<p style="text-align:justify;"><strong>6. Deployment.</strong></p>
<p style="text-align:justify;">Setelah selesai semua, buka tab Servers, klik kanan di JBoss v4.2, pilih Start untuk menjalankan JBoss application server.</p>
<p style="text-align:justify;"><a href="http://suhearie.files.wordpress.com/2008/09/deploy1.jpg"><img class="alignnone size-full wp-image-257" src="http://suhearie.wordpress.com/files/2008/09/deploy1.jpg" alt="" width="653" height="137" /></a></p>
<p style="text-align:justify;">Setelah status JBoss berubah menjadi started, klik kanan di JBoss, pilih Add and Remove Projects, masukkan project TestEnterpriseProject.</p>
<p style="text-align:justify;"><a href="http://suhearie.files.wordpress.com/2008/09/deploy2.jpg"><img class="alignnone size-full wp-image-258" src="http://suhearie.wordpress.com/files/2008/09/deploy2.jpg" alt="" width="465" height="377" /></a></p>
<p style="text-align:justify;">Jika status server sudah synchronized seperti ini, artinya project kita sudah berhasil dideploy pada JBoss.</p>
<p style="text-align:justify;"><a href="http://suhearie.files.wordpress.com/2008/09/deploy3.jpg"><img class="alignnone size-full wp-image-259" src="http://suhearie.wordpress.com/files/2008/09/deploy3.jpg" alt="" width="653" height="135" /></a></p>
<p style="text-align:justify;">Buka web browser anda dan masukkan alamat <strong>http://localhost:8080/TestEnterpriseProjectWeb</strong>, dan Anda akan melihat halaman seperti berikut:</p>
<p style="text-align:left;"><a href="http://suhearie.files.wordpress.com/2008/09/result1.jpg"><img class="alignnone size-full wp-image-243" src="http://suhearie.wordpress.com/files/2008/09/result1.jpg" alt="" width="652" height="258" /></a></p>
<p style="text-align:left;">Pilih operasi, masukkan operand 1 dan 2, kemudia tekan tombol calculate, maka hasil perhitungan akan ditampilkan pada halaman berikut.</p>
<p style="text-align:left;"><a href="http://suhearie.files.wordpress.com/2008/09/result2.jpg"><img class="alignnone size-full wp-image-250" src="http://suhearie.wordpress.com/files/2008/09/result2.jpg" alt="" width="648" height="236" /></a></p>
<p style="text-align:left;">
]]></content:encoded>
</item>
<item>
<title><![CDATA[The most basic securing web application with Servlet Filter]]></title>
<link>http://gardiary.wordpress.com/?p=58</link>
<pubDate>Thu, 28 Aug 2008 03:10:49 +0000</pubDate>
<dc:creator>gardiary</dc:creator>
<guid>http://gardiary.fr.wordpress.com/2008/08/28/the-most-basic-securing-web-application-with-servlet-filter/</guid>
<description><![CDATA[Servlet Filter can be used to preprocess Web application requests, therefore we can used it to secur]]></description>
<content:encoded><![CDATA[<p><a href="http://java.sun.com/products/servlet/Filters.html" target="_blank">Servlet Filter</a> can be used to preprocess Web application requests, therefore we can used it to secure our websites. If your web application need someone to login first before he/she can browse to another page, servlet filter can be used in such cases. Below will show how to use servlet filter to secure a web application.</p>
<p>Servlet filter is an interface on package javax.servlet.Filter that have three methods: init, doFilter, and destroy. We have to make our own filter class and implements Filter interface. This is the filter class called HelloFilter:</p>
<p><strong>(com.halimun.filter.HelloFilter.java)</strong></p>
<pre>[sourcecode language='java']
package com.halimun.filter;

import java.io.IOException;

import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

public class HelloFilter implements Filter {
	private FilterConfig filterConfig;
	private String loginForm;

	// init
	public void init(FilterConfig filterConfig) throws ServletException {
		this.filterConfig = filterConfig;
		loginForm = this.filterConfig.getInitParameter("login_form");
	}

	// doFilter
	public void doFilter(ServletRequest request, ServletResponse response,
			FilterChain chain) throws IOException, ServletException {
		HttpServletRequest httpRequest = (HttpServletRequest) request;
		HttpSession session = httpRequest.getSession(false);

		if( session != null ) {
			String currentUser = (String)session.getAttribute("user");
			if (currentUser == null) {
				System.out.println("currentUser null");
				filterConfig.getServletContext().getRequestDispatcher(loginForm).forward(request, response);
			}

		}
		else{
			filterConfig.getServletContext().getRequestDispatcher(loginForm).forward(request, response);
		}

		chain.doFilter(request,response);

	}

	// destroy
	public void destroy() {}

}
[/sourcecode]</pre>
<p>The UserLogin action servlet is invoke when user press submit button at login form. It's check wether user is exist in databases and match the password. Acctually it's only dummy database, I use HashMap to store username (as the key) and password.</p>
<p><strong>(com.halimun.servlet.UserLogin)</strong></p>
<pre>[sourcecode language='java']
package com.halimun.servlet;

import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class UserLogin extends HttpServlet {
	private static final long serialVersionUID = -3955012280873977969L;
	private static final Map<String, String> users = new HashMap<String, String>();

	public void init() throws ServletException {
		users.put("admin", "secret");
		users.put("david", "password");
		users.put("gardiary", "gardiary");
	}

	protected void doGet(HttpServletRequest request, HttpServletResponse response)
		throws ServletException, IOException
	{
		execute(request, response);
	}

	protected void doPost(HttpServletRequest request, HttpServletResponse response)
		throws ServletException, IOException
	{
		execute(request, response);
	}

	private void execute(HttpServletRequest request, HttpServletResponse response)
		throws ServletException, IOException
	{
		String username = request.getParameter("username");
		String password = request.getParameter("password");

		String userPassword = users.get(username);

		if(userPassword!=null && userPassword.equals(password)) {
			request.getSession().setAttribute("user", username);
			response.sendRedirect( request.getContextPath() );
		}
		else {
			request.setAttribute("message", "Invalid username or password");
			getServletContext().getRequestDispatcher("/loginForm.jsp")
				.forward(request, response);
		}
	}
}
[/sourcecode]</pre>
<p>UserLogout action servlet is for logout from the application, it's remove the session and redirect to login form.</p>
<p><strong>(com.halimun.servlet.UserLogout.java)</strong></p>
<pre>[sourcecode language='java']
package com.halimun.servlet;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class UserLogout extends HttpServlet {
	private static final long serialVersionUID = 5073946739765619794L;

	protected void doGet(HttpServletRequest request, HttpServletResponse response)
	throws ServletException, IOException
	{
		execute(request, response);
	}

	protected void doPost(HttpServletRequest request, HttpServletResponse response)
	throws ServletException, IOException
	{
		execute(request, response);
	}

	private void execute(HttpServletRequest request, HttpServletResponse response)
	throws ServletException, IOException
	{
		request.getSession().invalidate();
		response.sendRedirect( request.getContextPath() );
	}
}
[/sourcecode]</pre>
<p>Here is login form using JSP. We can see that the form action is "<span style="color:#ff0000;">userlogin.action</span>" which is a UserLogin action servlet.</p>
<p><strong>(loginForm.jsp)</strong></p>
<pre>[sourcecode language='html']
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link href="css/format.css" rel=stylesheet type="text/css">
<title>Login Form</title>
</head>
<body>
<form method="POST" action="userlogin.action">
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse">
<tr>
<td>Username :</td>
<td>
<input type="text" name="username"></td>
</tr>
<tr>
<td>Password :</td>
<td>
<input type="password" name="password"></td>
</tr>
<tr>
<td>&nbsp</td>
<td><b>
				<%= (request.getAttribute("message")==null ? "&nbsp" : request.getAttribute("message")) %>
			</b></td>
</tr>
<tr>
<td colspan="2" align="center">
<input type="submit" value="Login">
<input type="reset" value="Cancel">
			</td>
</tr>
</table>
</form>

<br>
<a href="index.jsp">index page</a> - <a href="error.jsp">error page</a> -
<a href="dummy.jsp">dummy page</a>
</body>
</html>
[/sourcecode]</pre>
<p>Index.jsp is default page after user has succeed login. You can make another pages to check if the security is working.</p>
<p><strong>(index.jsp)</strong></p>
<pre>[sourcecode language='html']
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link href="css/format.css" rel=stylesheet type="text/css">
<title>Index Page</title>
</head>
<body>
<h2>Heloooo <%= session.getAttribute("user") %>...</h2>

	<br>
	<a href="error.jsp">error page</a> - <a href="dummy.jsp">dummy page</a> -
	<a href="loginForm.jsp">login form</a>- <a href="userlogout.action">logout</a>
</body>
</html>
[/sourcecode]</pre>
<p>And here is the <strong>web.xml</strong>:</p>
<pre>[sourcecode language='xml']
<?xml version="1.0" encoding="UTF-8"?>

<web-app>
	<description>Web Application Security</description>
	<display-name>Web Application Security</display-name>

	<filter>
		<filter-name>HelloFilter</filter-name>
		<filter-class>com.halimun.filter.HelloFilter</filter-class>
		<description>
			This Is Hello Filter
		</description>
		<init-param>
<param-name>login_form</param-name>
<param-value>/loginForm.jsp</param-value>
		</init-param>
	</filter>
	<filter-mapping>
		<filter-name>HelloFilter</filter-name>
		<url-pattern>*.jsp</url-pattern>
	</filter-mapping>

	<servlet>
		<servlet-name>userlogin</servlet-name>
		<description>User Login Controller</description>
		<servlet-class>com.halimun.servlet.UserLogin</servlet-class>
	</servlet>
	<servlet>
		<servlet-name>userlogout</servlet-name>
		<description>User Logout Controller</description>
		<servlet-class>com.halimun.servlet.UserLogout</servlet-class>
	</servlet>

	<servlet-mapping>
		<servlet-name>userlogin</servlet-name>
		<url-pattern>/userlogin.action</url-pattern>
	</servlet-mapping>
	<servlet-mapping>
		<servlet-name>userlogout</servlet-name>
		<url-pattern>/userlogout.action</url-pattern>
	</servlet-mapping>

	<welcome-file-list>
		<welcome-file>index.jsp</welcome-file>
	</welcome-file-list>
</web-app>
[/sourcecode]</pre>
<p><strong><code>&#60;filter-mapping&#62;<br />
&#160;&#160;&#160;&#60;filter-name&#62;HelloFilter&#60;/filter-name&#62;<br />
&#160;&#160;&#160;&#60;url-pattern&#62;*.jsp&#60;/url-pattern&#62;<br />
&#60;/filter-mapping&#62;</code></strong><br />
This mapping means that request to every JSP file will be filtered first, in this case will invoke HelloFilter filter. HelloFilter filter will be processes before and after run the JSP's files.<br />
Acctually we can mapped filter to every requests by specifying "<span style="color:#ff0000;">/*</span>" in url-pattern of filter-mapping. In that case, every request to every resources (such as *.action, *,css, *.js, etc) will also invoke the filter.</p>
<p><strong><code>&#60;servlet-mapping&#62;<br />
&#160;&#160;&#160;&#60;servlet-name&#62;userlogin&#60;/servlet-name&#62;<br />
&#160;&#160;&#160;&#60;url-pattern&#62;/userlogin.action&#60;/url-pattern&#62;<br />
&#60;/servlet-mapping&#62;<br />
&#60;servlet-mapping&#62;<br />
&#160;&#160;&#160;&#60;servlet-name&#62;userlogout&#60;/servlet-name&#62;<br />
&#160;&#160;&#160;&#60;url-pattern&#62;/userlogout.action&#60;/url-pattern&#62;<br />
&#60;/servlet-mapping&#62;</code></strong><br />
In this servlet mappings, we mapped UserLogin action servlet with url-pattern "<span style="color:#ff0000;">/userlogin.action</span>" and UserLogout action servlet with url-pattern "<span style="color:#ff0000;">/userlogout.action</span>".</p>
<h2><strong>Summary</strong></h2>
<p>So the web application structure will look like this:<br />
<strong><code><br />
[ContextRoot]\index.jsp<br />
[ContextRoot]\loginForm.jsp<br />
[ContextRoot]\error.jsp<br />
[ContextRoot]\dummy.jsp<br />
[ContextRoot]\css\format.css<br />
[ContextRoot]\WEB-INF<br />
[ContextRoot]\WEB-INF\classes\com\halimun\filter\HelloFilter.class<br />
[ContextRoot]\WEB-INF\classes\com\halimun\servlet\UserLogin.class<br />
[ContextRoot]\WEB-INF\classes\com\halimun\servlet\UserLogout.class<br />
</code></strong><br />
Complete source code is <a href="http://gardiary.wordpress.com/files/2008/08/servletfilter-latwar.odt">this</a>, change the extention to .war (coz free wordpress doesnt support WAR files :( ), then deploy in your favorite application server. Try to access <a href="http://localhost:8080/servletfilter-lat/error.jsp" target="_blank">error page</a> or <a href="http://localhost:8080/servletfilter-lat/dummy.jsp" target="_blank">dummy page</a> without entering username/password in <a href="http://localhost:8080/servletfilter-lat/loginForm.jsp" target="_blank">login form</a>. For login account, you can use <strong>admin</strong>/<strong>secret</strong>, <strong>david</strong>/<strong>password</strong>, or <strong>gardiary</strong>/<strong>gardiary</strong>.</p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[servlet....oh servlettt......]]></title>
<link>http://ranovria.wordpress.com/?p=10</link>
<pubDate>Tue, 26 Aug 2008 11:03:54 +0000</pubDate>
<dc:creator>ranovria</dc:creator>
<guid>http://ranovria.fr.wordpress.com/2008/08/26/servletoh-servlettt/</guid>
<description><![CDATA[sudah hampir dua pekan aku bermain - main dengan dengan java document ini, dan selalu dengan masalah]]></description>
<content:encoded><![CDATA[<p>sudah hampir dua pekan aku bermain - main dengan dengan java document ini, dan selalu dengan masalah yang sama.Duplicate null.....setiap ingin mencoba memasukkan data menggunakan servlet hasilnya selalu sama.</p>
<p>Padahal ketika belajar dengan teman, tidak menemukan masalah seperti itu. tapi ketika ingin dicoba kembali selalu hasil yang ditampilkan adalah duplicate null....</p>
<p>Uuugghh kenapa seh tidak ketemu juga dengan jawabannya. Rasanya senang sekali jika bisa ketemu dengan jawabannya pasti ke depannya semuanya akan mudah dikerjakan.</p>
<p>Aku sudah mencoba mencari jawabannya melalui om google, tapi hasilnya nihil. Nihil karna memang aku tidak mengerti apa yang mesti ku kerjakan. Coding yang aku cari tidak sesuai dengan yang aku buat selama ini. Giliran aku menemukan yang sesuai ternyata tetap saja ada masalah saat aku memasukan data melalui form.</p>
<p>Kenapa sih tidak mau? apa yang salah? Kayaknya aku yang eror nih dan memang tidak mengerti dengan Java. Padahal proyek ini harus selesai pada akhir bulan September. Sementara akhir bulan Agustus aku belum menemukan jawabannya, bagaimana ini.</p>
<p>Ya 4WI aku selalu yakin akan menemukan jawabannya, Tapi tidak hari , aku selalu berharap juga bahwa aku akan menemukan jawabanku esok hari.</p>
<p>Sebelumnya aku tidak pernah coding dengan Java, makanya aku benar-benar bingung apa yang ingin aku kerjakan. Tapi aku slalu yakin kalau aku itu bisa. Dan Aku pasti menemukan jawaban dari kesusahanku ini.</p>
<p>Semoga Esok Lebih Baik Dari Hari ini</p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[Java Enterprise, mulai dari mana ? (part 2 - Netbeans &amp; Glassfish)]]></title>
<link>http://suhearie.wordpress.com/?p=189</link>
<pubDate>Tue, 26 Aug 2008 08:33:03 +0000</pubDate>
<dc:creator>suhearie</dc:creator>
<guid>http://suhearie.fr.wordpress.com/2008/08/26/java-enterprise-mulai-dari-mana-part-2-netbeans-glassfish/</guid>
<description><![CDATA[Artikel ini merupakan tutorial yang berisi aplikasi kalkulator sederhana dengan menggunakan arsitekt]]></description>
<content:encoded><![CDATA[<p style="text-align:justify;">Artikel ini merupakan tutorial yang berisi aplikasi kalkulator sederhana dengan menggunakan arsitektur Java EE. Jika Anda belum tahu tentang apa itu Java EE, silahkan baca <a href="http://suhearie.wordpress.com/2008/08/26/java-enterprise-mulai-dari-mana/">artikel ini terlebih dahulu</a>. Kali ini kita akan menggunakan Netbeans 6.1 sebagai IDE dan Glasshfish v2 sebagai application servernya.</p>
<p><strong>1. Download &#38; install</strong></p>
<p style="text-align:justify;">Kedua software tersebut bisa didownload sekaligus di http://download.netbeans.org/netbeans/6.1/final/. Install netbeans dan glassfish di komputer Anda dengan mengikuti wizard.</p>
<p><strong>2. Setup Project</strong></p>
<p style="text-align:justify;">Start Netbeans, pilih menu File -&#62; New Project.<br />
Pada dialog New Project, pilih categori Enterprise -&#62; Enterprise Application, klik Next.</p>
<p style="text-align:justify;"><a href="http://suhearie.files.wordpress.com/2008/08/setupproject11.jpg"><img class="alignnone size-full wp-image-234" src="http://suhearie.wordpress.com/files/2008/08/setupproject11.jpg" alt="" width="601" height="279" /></a></p>
<p style="text-align:justify;">
<p style="text-align:justify;">Masukkan nama project TestEnterpriseProject.</p>
<p style="text-align:justify;"><a href="http://suhearie.files.wordpress.com/2008/08/setupproject21.jpg"><img class="alignnone size-full wp-image-235" src="http://suhearie.wordpress.com/files/2008/08/setupproject21.jpg" alt="" width="598" height="255" /></a></p>
<p style="text-align:justify;">
<p style="text-align:justify;">Pilih Server Glassfish V2, Java EE Version 5, dan pastikan Anda mengaktifkan pilihan Create EJB Module dan Create Web Application Module, kemudian klik Finish.</p>
<p style="text-align:justify;"><a href="http://suhearie.files.wordpress.com/2008/08/setupproject32.jpg"><img class="alignnone size-full wp-image-236" src="http://suhearie.wordpress.com/files/2008/08/setupproject32.jpg" alt="" width="597" height="267" /></a></p>
<p style="text-align:justify;">Maka Netbeans akan mengcreate project TestEnterpriseProject sebagai project utama, project TestEnterpriseProject-ejb sebagai sub-project untuk modul EJB, dan TestEnterpriseProject-war sebagai sub-project untuk modul web.</p>
<p style="text-align:justify;"><!--more--></p>
<p style="text-align:justify;">Struktur project seperti tampak pada gambar berikut:</p>
<p style="text-align:justify;"><a href="http://suhearie.wordpress.com/files/2008/08/setupproject.jpg"><img class="alignnone size-full wp-image-190" src="http://suhearie.wordpress.com/files/2008/08/setupproject.jpg" alt="" width="235" height="360" /></a></p>
<p><strong>3. EJB module</strong></p>
<p>Ada 3 macam EJB dalam spesifikasi EJB versi 3.0 (EJB3) :</p>
<p style="text-align:justify;"><strong>a. Session Bean</strong><br />
Session bean adalah EJB yang digunakan untuk mengeksekusi proses. Isi dari Session Bean ini biassanya berupa kata kerja (transfer, pay, calculate, updateData, dll). Stateless Session Bean (SLSB) adalah Session Bean yang tidak menyimpan state (keadaan) pada setiap kali eksekusi. Berbeda dengan Statefull Session Bean (SFSB) yang dapat menyimpan state. State ini dapat kita gunakan misalnya untuk menyimpan informasi user atau barang-barang yang sudah dibeli (pada kasus online shop).</p>
<p style="text-align:justify;"><strong>b. Entity Bean</strong><br />
Entity Bean adalah EJB yang digunakan untuk mempermudah manipulasi database. Konsepnya adalah Object - Relational Mapping (ORM) yang berarti memetakan object dengan data di dalam database. Entity Bean sebenarnya adalah spesifikasi "bawaan" dari versi EJB sebelumnya yaitu EJB 2.1. Dalam EJB3, ada API lain yang lebih sederhana yaitu Java Persistence API (JPA). Sekarang orang lebih banyak menggunakan JPA dibandingkan Entity Bean.</p>
<p style="text-align:justify;"><strong>c. Message Driven Bean</strong><br />
Message Driven Bean (MDB) adalah EJB yang digunakan untuk keperluan messaging menggunakan Java Messaging Service (JMS).</p>
<p style="text-align:justify;">Kali ini kita akan menggunakan Stateless Session Bean. Session Bean karena kita akan melakukan pertihutang matematik, Stateless karena kita tidak perlu menyimpan informasi apapun.</p>
<p style="text-align:justify;">Klik kanan di sub-project EJB, pilih New -&#62; Session Bean. Masukkan properties berikut:<br />
EJB Name: CalculatorSession<br />
Package: suhearie.blog.enterprise.ejb<br />
Session Type: Stateless<br />
Create Interface: Local</p>
<p style="text-align:justify;"><a href="http://suhearie.files.wordpress.com/2008/08/calculatorsession1.jpg"><img class="alignnone size-full wp-image-238" src="http://suhearie.wordpress.com/files/2008/08/calculatorsession1.jpg" alt="" width="512" height="316" /></a></p>
<p style="text-align:justify;">Netbeans secara otomatis akan meng-create class CalculatorSessionBean sebagai bean class dan CalculatorSessionLocal sebagai interface. Untuk membuat Session Bean, kita membutuhkan sebuah interface dan sebuah class. Interface digunakan untuk menentukan method apa yang bisa dipanggil oleh client, sedangkan bean class merupakan implementasi dari method tersebut.</p>
<p style="text-align:justify;"><strong>Business Logic Interface - Local</strong><br />
Interface CalculatorSessionLocal diberi annotation @Local, artinya interface ini bisa diakses oleh client yang "local" atau berada dalam JVM yang sama dengan EJB server. Client yang kita gunakan adalah web component (JSP dan Servlet) yang berjalan di application server yang sama, sehingga kita cukup menggunakan Local interface. Di interface ini, kita hanya mendefinisikan satu method saja yaitu calculate yang menerima parameter-parameter berupa OPERATION, operand1 dan operand2.</p>
<p>[sourcecode language='java']<br />
package suhearie.blog.enterprise.ejb;</p>
<p>import javax.ejb.Local;</p>
<p>/**<br />
 *<br />
 * @author sarianto<br />
 */<br />
@Local<br />
public interface CalculatorSessionLocal {</p>
<p>    public enum OPERATION {ADD, SUBSTRACT, MULTIPLY, DIVIDE};</p>
<p>    public int calculate(OPERATION operation, int oper1, int oper2);</p>
<p>}<br />
[/sourcecode]</p>
<p style="text-align:justify;"><strong>Bean Class - Business Logic Implementation</strong><br />
Class CalculatorSessionBean adalah implementasi dari interface CalculatorSessionLocal. Kita menandainya dengan annotation @Stateless yang berarti kita mendefinisikannya sebagai Stateless Session Bean. Pada implementasi method calculate, kita melakukan perhitungan matematika yang sebenarnya.</p>
<p>[sourcecode language='java']<br />
package suhearie.blog.enterprise.ejb;</p>
<p>import javax.ejb.Stateless;</p>
<p>/**<br />
 *<br />
 * @author sarianto<br />
 */<br />
@Stateless<br />
public class CalculatorSessionBean implements CalculatorSessionLocal {</p>
<p>    public int calculate(OPERATION operation, int oper1, int oper2) {<br />
        switch(operation) {<br />
            case ADD:<br />
                return oper1+oper2;<br />
            case SUBSTRACT:<br />
                return oper1-oper2;<br />
            case MULTIPLY:<br />
                return oper1*oper2;<br />
            case DIVIDE:<br />
                return oper1/oper2;<br />
            default:<br />
                throw new UnsupportedOperationException("Not supported yet.");<br />
        }<br />
    }<br />
}<br />
[/sourcecode]</p>
<p><strong>4. Web Module</strong></p>
<p style="text-align:justify;">Kita akan menggunakan web sebagai user inteerface. Komponen yang akan digunakan adalah Servlet dan JSP.</p>
<p style="text-align:justify;"><strong>a. Servlet</strong><br />
Servlet adalah komponen web yang berupa java class yang mengextends javax.servlet.http.HttpServlet. Class ini biasanya digunakan untuk menangani http request, melakukan processing, kemudian memberikan hasil processing tersebut ke halaman JSP untuk ditampilkan di browser. Konsep ini disebut Model-View-Controller (MVC).</p>
<p style="text-align:justify;"><strong>b. Java Server Page (JSP)</strong><br />
JSP mirip dengan PHP atau ASP yang merupakan halaman HTML yang dapat disisipi dengan kode java (scriplet). Tujuannya untuk memudahkan developer dalam merancang user interface.</p>
<p style="text-align:justify;"><strong>File index.jsp</strong>, kita gunakan untuk membuat form html yang akan mensubmit parameter-parameter yang digunakan untuk melakukan perhitungan. Netbeans sudah menyediakan file index.jsp ini di dalam folder TestEnterpriseProject-war -&#62; Web Pages. Edit file tersebut sehingga menjadi seperti berikut. Form html disubmit ke servlet (CalculatorServlet), yang sesaat lagi akan kita buat.</p>
<p>[sourcecode language='html']<br />
<html><br />
    <head><br />
        <title>Java EE Calculator</title><br />
    </head><br />
    <body></p>
<h2>Welcome to Java EE Calculator Test Project !</h2>
<form action='<%=request.getContextPath()%>/CalculatorServlet' method='POST'><br />
            Operation:</p>
<select name="operation">
                <option selected value="ADD">ADD</option><br />
                <option value="SUBSTRACT">SUBSTRACT</option><br />
                <option value="MULTIPLY">MULTIPLY</option><br />
                <option value="DIVIDE">DIVIDE</option><br />
            </select>
<p>            Operand 1:<br />
<input type="text" name="oper1" value="0" />
<p>            Operand 2:<br />
<input type="text" name="oper2" value="0" />
<input type="submit" value="Calculate" name="Calculate" />
        </form>
<p>    </body><br />
</html><br />
[/sourcecode]</p>
<p style="text-align:justify;"><strong>Create servlet</strong>, dengan cara klik kanan di module TestEnterpriseProject-war, pilih New -&#62; Servlet. Isikan class name CalculatorServlet, dan package suhearie.blog.enterprise.servlet. Klik next, pastikan option untuk memasukkan informasi servlet ini ke file deployment descriptor diaktifkan, kemudian klik finish.</p>
<p style="text-align:justify;"><a href="http://suhearie.files.wordpress.com/2008/08/calculatorservlet1.jpg"><img class="alignnone size-full wp-image-239" src="http://suhearie.wordpress.com/files/2008/08/calculatorservlet1.jpg" alt="" width="516" height="254" /></a></p>
<p style="text-align:justify;">Modifikasi servlet tersebut menjadi seperti berikut.<br />
Di class ini kita memiliki satu class variable bertipe CalculatorSessionLocal dan memberinya annotation @EJB yang berarti application server akan meng-inject object tersebut secara otomatis ke dalam servlet kita. Konsep ini disebut dengan dependency injection. Selanjutnya, kita mengambil parameter-parameter yang dikirim melalui http request, kemudian menggunakan session bean untuk melakukan perhitungan berdasarkan parameter-parameter tersebut. Hasil perhitungan kita masukkan sebagai attribut di object request. Untuk menampilkannya, kita akan memforward request menuju ke halaman JSP CalculatorPage.jsp (kita buat sesaat lagi) menggunakan RequestDispatcher.</p>
<p>[sourcecode language='java']<br />
package suhearie.blog.enterprise.servlet;</p>
<p>import java.io.*;</p>
<p>import javax.ejb.EJB;<br />
import javax.servlet.*;<br />
import javax.servlet.http.*;<br />
import suhearie.blog.enterprise.ejb.CalculatorSessionLocal;</p>
<p>/**<br />
 *<br />
 * @author sarianto<br />
 */<br />
public class CalculatorServlet extends HttpServlet {</p>
<p>    /**<br />
    * Processes requests for both HTTP <code>GET</code> and <code>POST</code> methods.<br />
    * @param request servlet request<br />
    * @param response servlet response<br />
    */<br />
    @EJB<br />
    CalculatorSessionLocal calculatorSession;<br />
    protected void processRequest(HttpServletRequest request, HttpServletResponse response)<br />
    throws ServletException, IOException {<br />
        String operation = request.getParameter("operation");<br />
        int oper1 = Integer.parseInt(request.getParameter("oper1"));<br />
        int oper2 = Integer.parseInt(request.getParameter("oper2"));</p>
<p>        int result = calculatorSession.calculate(CalculatorSessionLocal.OPERATION.valueOf(operation), oper1, oper2);<br />
        request.setAttribute("result", result);<br />
        request.getRequestDispatcher("/CalculatorPage.jsp").forward(request, response);<br />
    } </p>
<p>    // <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code."><br />
    /**<br />
    * Handles the HTTP <code>GET</code> method.<br />
    * @param request servlet request<br />
    * @param response servlet response<br />
    */<br />
    protected void doGet(HttpServletRequest request, HttpServletResponse response)<br />
    throws ServletException, IOException {<br />
        processRequest(request, response);<br />
    } </p>
<p>    /**<br />
    * Handles the HTTP <code>POST</code> method.<br />
    * @param request servlet request<br />
    * @param response servlet response<br />
    */<br />
    protected void doPost(HttpServletRequest request, HttpServletResponse response)<br />
    throws ServletException, IOException {<br />
        processRequest(request, response);<br />
    }<br />
}<br />
[/sourcecode]</p>
<p><strong>File CalculatorPage.jsp</strong>, kita gunakan untuk menampilkan hasil perhitungan.</p>
<p>[sourcecode language='html']<br />
<html><br />
    <head><br />
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><br />
        <title>Java EE Calculator</title><br />
    </head><br />
    <body></p>
<h2>Java EE Calculator Result:</h2>
<p>Operation: <%=request.getParameter("operation")%><br />
        Operand 1: <%=request.getParameter("oper1")%><br />
        Operand 2: <%=request.getParameter("oper2")%><br />
        Result:<B> <%=  request.getAttribute("result")%></B><br />
        <a href='<%=request.getContextPath()%>/'>BACK</a><br />
    </body><br />
</html><br />
[/sourcecode]</p>
<p style="text-align:justify;">Setelah selesai semua, pindah ke tab Services, buka tree Servers, klik kanan di Glassfish, pilih Start untuk menjalankan Glassfish application server. Setelah glassfish berjalan, kembali ke tab Projects, klik kanan di TestEnterpriseProject, pilih Undeploy and Deploy. Setelah proses undeploy dan deploy selesai, buka web browser anda dan masukkan alamat <strong>http://localhost:8080/TestEnterpriseProject-war</strong>, dan Anda akan melihat halaman seperti berikut:</p>
<p><img class="alignnone size-full wp-image-197" src="http://suhearie.wordpress.com/files/2008/08/index.jpg" alt="" width="504" height="303" /></p>
<p>Masukkan parameter, kemudian klik tombol Calculate, maka hasilnya akan ditampilkan:</p>
<p><img class="alignnone size-full wp-image-198" src="http://suhearie.wordpress.com/files/2008/08/result.jpg" alt="" width="557" height="331" /></p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[Tonight my head is full of bug]]></title>
<link>http://katatunix.wordpress.com/?p=42</link>
<pubDate>Sun, 24 Aug 2008 12:52:54 +0000</pubDate>
<dc:creator>Katatunix</dc:creator>
<guid>http://katatunix.fr.wordpress.com/2008/08/24/tonight-my-head-is-full-of-bug/</guid>
<description><![CDATA[Tôi đang làm một cái từ điển online (Anh Việt, Việt Anh), có sử dụng AJAX. Khôn]]></description>
<content:encoded><![CDATA[<p>Tôi đang làm một cái từ điển online (Anh Việt, Việt Anh), có sử dụng AJAX. Không có vấn đề gì với từ điển Anh Việt, nhưng Việt Anh thì rắc rối: so sánh chuỗi tiếng Việt, IO với Unicode trong Java như thế nào?</p>
<p>Do database của từ điển là 1 file text với các từ được sắp xếp theo thứ tự tăng dần, nên để tìm nghĩa của 1 từ mà người dùng gõ vào, tôi phải dùng Tìm kiếm nhị phân. Việc so sánh 2 chuỗi là rất quan trọng, và phải viết thêm lớp VietComparator để so sánh 2 chuỗi tiếng Việt. Đoạn code sau đây tôi tìm được trên mạng, code rất hay, dễ hiểu và chạy nhanh:</p>
<p><!--more--></p>
<pre style="background-color:#669966;color:#000000;overflow:auto;height:400px;padding:10px;"><code style="font-size:14px;">package&#160;com.bhviet.utils;

import&#160;java.util.Comparator;

/**
&#160;*&#160;Author&#160;:&#160;Le&#160;Bien&#160;Thuy&#160;Dec&#160;18,&#160;2007
&#160;*/
public&#160;class&#160;VietComparator&#160;implements&#160;Comparator&#60;String&#62;&#160;{

&#160;&#160;&#160;&#160;private&#160;int&#160;compare(char&#160;c1,&#160;char&#160;c2)&#160;{
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;if&#160;(c1&#160;==&#160;c2)
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;return&#160;0;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;int&#160;enc1&#160;=&#160;encode(c1);
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;int&#160;enc2&#160;=&#160;encode(c2);
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;return&#160;(enc1&#160;&#60;&#160;0&#160;&#124;&#124;&#160;enc2&#160;&#60;&#160;0)&#160;?&#160;c1&#160;-&#160;c2&#160;:&#160;enc1&#160;-&#160;enc2;
&#160;&#160;&#160;&#160;}

&#160;&#160;&#160;&#160;public&#160;int&#160;compare(String&#160;c1,&#160;String&#160;c2)&#160;{
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;c1&#160;=&#160;c1.toLowerCase();
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;c2&#160;=&#160;c2.toLowerCase();
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;int&#160;min&#160;=&#160;Math.min(c2.length(),&#160;c1.length());
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for&#160;(int&#160;i&#160;=&#160;0;&#160;i&#160;&#60;&#160;min;&#160;i++)&#160;{
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;int&#160;k&#160;=&#160;compare(c1.charAt(i),&#160;c2.charAt(i));
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;if&#160;(k&#160;!=&#160;0)
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;return&#160;k;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;}
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;return&#160;c1.length()&#160;-&#160;c2.length();
&#160;&#160;&#160;&#160;}

&#160;&#160;&#160;&#160;private&#160;int&#160;encode(char&#160;c)&#160;{
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;switch&#160;(c)&#160;{
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;case&#160;'a':
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;return&#160;0;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;case&#160;'à':
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;return&#160;1;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;case&#160;'ả':
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;return&#160;2;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;case&#160;'ã':
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;return&#160;3;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;case&#160;'á':
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;return&#160;4;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;case&#160;'ạ':
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;return&#160;5;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;case&#160;'ă':
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;return&#160;6;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;case&#160;'ằ':
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;return&#160;7;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;case&#160;'ẳ':
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;return&#160;8;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;case&#160;'ẵ':
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;return&#160;9;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;case&#160;'ắ':
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;return&#160;10;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;case&#160;'ặ':
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;return&#160;11;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;case&#160;'â':
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;return&#160;12;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;case&#160;'ầ':
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;return&#160;13;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;case&#160;'ẩ':
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;return&#160;14;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;case&#160;'ẫ':
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;return&#160;15;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;case&#160;'ấ':
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;return&#160;16;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;case&#160;'ậ':
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;return&#160;17;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;case&#160;'b':
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;return&#160;18;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;case&#160;'c':
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;return&#160;19;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;case&#160;'d':
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;return&#160;20;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;case&#160;'đ':
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;return&#160;21;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;case&#160;'e':
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;return&#160;22;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;case&#160;'è':
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;return&#160;23;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;case&#160;'ẻ':
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;return&#160;24;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;case&#160;'ẽ':
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;return&#160;25;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;case&#160;'é':
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;return&#160;26;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;case&#160;'ẹ':
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;return&#160;27;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;case&#160;'ê':
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;return&#160;28;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;case&#160;'ề':
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;return&#160;29;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;case&#160;'ể':
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;return&#160;30;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;case&#160;'ễ':
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;return&#160;31;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;case&#160;'ế':
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;return&#160;32;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;case&#160;'ệ':
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;return&#160;33;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;case&#160;'f':
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;return&#160;34;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;case&#160;'g':
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;return&#160;35;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;case&#160;'h':
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;return&#160;36;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;case&#160;'i':
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;return&#160;37;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;case&#160;'ì':
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;return&#160;38;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;case&#160;'ỉ':
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;return&#160;39;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;case&#160;'ĩ':
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;return&#160;40;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;case&#160;'í':
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;return&#160;41;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;case&#160;'ị':
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;return&#160;42;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;case&#160;'j':
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;return&#160;43;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;case&#160;'k':
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;return&#160;44;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;case&#160;'l':
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;return&#160;45;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;case&#160;'m':
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;return&#160;46;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;case&#160;'n':
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;return&#160;47;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;case&#160;'o':
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;return&#160;48;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;case&#160;'ò':
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;return&#160;49;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;case&#160;'ỏ':
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;return&#160;50;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;case&#160;'õ':
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;return&#160;51;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;case&#160;'ó':
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;return&#160;52;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;case&#160;'ọ':
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;return&#160;53;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;case&#160;'ô':
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;return&#160;54;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;case&#160;'ồ':
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;return&#160;55;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;case&#160;'ổ':
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;return&#160;56;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;case&#160;'ỗ':
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;return&#160;57;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;case&#160;'ố':
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;return&#160;58;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;case&#160;'ộ':
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;return&#160;59;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;case&#160;'ơ':
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;return&#160;60;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;case&#160;'ờ':
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;return&#160;61;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;case&#160;'ở':
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;return&#160;62;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;case&#160;'ỡ':
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;return&#160;63;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;case&#160;'ớ':
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;return&#160;64;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;case&#160;'ợ':
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;return&#160;65;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;case&#160;'p':
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;return&#160;66;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;case&#160;'q':
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;return&#160;67;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;case&#160;'r':
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;return&#160;68;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;case&#160;'s':
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;return&#160;69;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;case&#160;'t':
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;return&#160;70;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;case&#160;'u':
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;return&#160;71;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;case&#160;'ù':
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;return&#160;72;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;case&#160;'ủ':
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;return&#160;73;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;case&#160;'ũ':
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;return&#160;74;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;case&#160;'ú':
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;return&#160;75;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;case&#160;'ụ':
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;return&#160;76;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;case&#160;'ư':
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;return&#160;77;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;case&#160;'ừ':
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;return&#160;78;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;case&#160;'ử':
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;return&#160;79;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;case&#160;'ữ':
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;return&#160;80;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;case&#160;'ứ':
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;return&#160;81;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;case&#160;'ự':
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;return&#160;82;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;case&#160;'v':
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;return&#160;83;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;case&#160;'w':
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;return&#160;84;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;case&#160;'x':
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;return&#160;85;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;case&#160;'y':
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;return&#160;86;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;case&#160;'ỳ':
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;return&#160;87;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;case&#160;'ỷ':
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;return&#160;88;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;case&#160;'ỹ':
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;return&#160;89;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;case&#160;'ý':
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;return&#160;90;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;case&#160;'ỵ':
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;return&#160;91;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;case&#160;'z':
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;return&#160;92;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;default:
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;return&#160;-1;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;}
&#160;&#160;&#160;&#160;}
}</code></pre>
<p>Đọc nội dung file text encoding in UTF-8 trong Java như sau:</p>
<pre style="background-color:#669966;color:#000000;overflow:auto;padding:10px;"><code style="font-size:14px;">try&#160;{
&#160;&#160;&#160;&#160;FileInputStream&#160;f&#160;=&#160;new&#160;FileInputStream(&#34;C:\\filename.txt&#34;);
&#160;&#160;&#160;&#160;BufferedReader&#160;br&#160;=&#160;new&#160;BufferedReader(
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;new&#160;InputStreamReader( f,&#160;&#34;UTF-8&#34; )
&#160;&#160;&#160;&#160;);
&#160;&#160;&#160;&#160;String&#160;strLine;
&#160;&#160;&#160;&#160;while&#160;((strLine&#160;=&#160;br.readLine())&#160;!=&#160;null)&#160;{
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;//&#160;do&#160;something&#160;with&#160;strLine
&#160;&#160;&#160;&#160;}
&#160;&#160;&#160;&#160;br.close();
}&#160;catch&#160;(IOException&#160;e)&#160;{
}</code></pre>
<p>Phải đảm bảo tất cả các chuỗi khi đem ra so sánh phải ở dạng UTF-8, ví dụ chuỗi &#34;á khẩu&#34; nếu không cẩn thận sẽ có dạng ANSI là &#34;Ã¡ kháº©u&#34; và so sánh sai bét. Nếu trong hàm dựng của <code style="font-size:14px;">BufferedReader</code> bạn ko cung cấp tham số &#34;UTF-8&#34; thì phải viết như sau trước khi dùng <code style="font-size:14px;">strLine</code>:</p>
<pre style="background-color:#669966;color:#000000;overflow:auto;padding:10px;"><code style="font-size:14px;">strLine&#160;=&#160;new&#160;String(strLine.getBytes(),&#160;&#34;UTF-8&#34;);</code></pre>
<p>1 điều tồi tệ là tôi lại quên cài đặt quen thuộc của QuickSort và mất khá nhiều thời gian debug để có đoạn code đúng:</p>
<pre style="background-color:#669966;color:#000000;overflow:auto;padding:10px;"><code style="font-size:14px;">public&#160;static&#160;void&#160;sort(int&#160;l,&#160;int&#160;r)&#160;{
&#160;&#160;&#160;&#160;if&#160;(l&#160;&#62;=&#160;r)&#160;return;
&#160;&#160;&#160;&#160;String&#160;x&#160;=&#160;new&#160;String(word[(l&#160;+&#160;r)&#160;/&#160;2]);
&#160;&#160;&#160;&#160;int&#160;i&#160;=&#160;l,&#160;j&#160;=&#160;r;
&#160;&#160;&#160;&#160;while&#160;(i&#160;&#60;=&#160;j)&#160;{
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;while&#160;(cl.compare(word[i],&#160;x)&#160;&#60;&#160;0)&#160;i++;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;while&#160;(cl.compare(x,&#160;word[j])&#160;&#60;&#160;0)&#160;j--;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;if&#160;(i&#160;&#60;=&#160;j)&#160;{
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;String&#160;tmp;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;tmp&#160;=&#160;word[i];&#160;word[i]&#160;=&#160;word[j];&#160;word[j]&#160;=&#160;tmp;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;i++;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;j--;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;}
&#160;&#160;&#160;&#160;}
&#160;&#160;&#160;&#160;sort(l,&#160;j);
&#160;&#160;&#160;&#160;sort(i,&#160;r);
}</code></pre>
<p>Vài bug với QuickSort, ban đầu dòng thứ 3 của tôi là:</p>
<pre style="background-color:#669966;color:#000000;overflow:auto;padding:10px;"><code style="font-size:14px;">x = word[(l + r) / 2];</code></pre>
<p>Dĩ nhiên sai trầm trọng, vì cái ta cần là giá trị của chuỗi nằm chính giữa <code style="font-size:14px;">l</code> và <code style="font-size:14px;">r</code> chứ không phải tham chiếu đối tượng đến nó, vì khi đó giá trị của x có thể bị thay đổi nếu chẳng may tham chiếu này bị thay đổi trong vòng lặp <code style="font-size:14px;">while</code>.</p>
<p>Chưa hết, swap (đổi chỗ) 2 biến String cũng phải hết sức lưu ý: do String cài đặt giao diện <code style="font-size:14px;">Serializable</code> nên khi truyền qua hàm, nó truyền theo tham trị, 2 chuỗi sẽ không bao giờ được đổi chỗ nếu code như sau:</p>
<pre style="background-color:#669966;color:#000000;overflow:auto;padding:10px;"><code style="font-size:14px;">public&#160;static&#160;void&#160;swap(String&#160;s1,&#160;String&#160;s2)&#160;{
&#160;&#160;&#160;&#160;String&#160;tmp&#160;=&#160;s1;
&#160;&#160;&#160;&#160;s1&#160;=&#160;s2;
&#160;&#160;&#160;&#160;s2&#160;=&#160;tmp;
}</code></pre>
<p>Cuối cùng, 1 bug muôn thuở: IE vs Firefox, trong method doPost của Servlet, nếu muốn encode dữ liệu truyền lên từ client ở UTF-8 thì cần phải viết như sau cho IE (Firefox có viết hay ko cũng ko sao, mặc định nó như thế):</p>
<pre style="background-color:#669966;color:#000000;overflow:auto;padding:10px;"><code style="font-size:14px;">public&#160;void&#160;doPost(HttpServletRequest&#160;request,
&#160;&#160;&#160;&#160;HttpServletResponse&#160;response)
&#160;&#160;&#160;&#160;throws&#160;ServletException,&#160;IOException&#160;{
&#160;&#160;&#160;&#160;
&#160;&#160;&#160;&#160;request.setCharacterEncoding(&#34;UTF-8&#34;);
&#160;&#160;&#160;&#160;//&#160;your&#160;code&#160;here
}</code></pre>
]]></content:encoded>
</item>
<item>
<title><![CDATA[Exemplo de Sessão em Java com JSP + Servlet]]></title>
<link>http://jmmwrite.wordpress.com/?p=196</link>
<pubDate>Fri, 22 Aug 2008 13:22:33 +0000</pubDate>
<dc:creator>julianommartins</dc:creator>
<guid>http://jmmwrite.fr.wordpress.com/2008/08/22/exemplo-de-sessao-em-java-com-jsp-servlet/</guid>
<description><![CDATA[Criei um pequeno projeto no Eclipse para servir como base na explicação de criação de sessões e]]></description>
<content:encoded><![CDATA[<p>Criei um pequeno projeto no Eclipse para servir como base na explicação de criação de sessões em Java.</p>
<p>O exemplo chama-se Sessao, tem duas páginas JSP e um servlet que valida o usuário. Segue o exemplo na figura abaixo:</p>
<p style="text-align:center;"><a href="http://jmmwrite.wordpress.com/files/2008/08/sessao_java.jpg"><img class="size-medium wp-image-197 aligncenter" src="http://jmmwrite.wordpress.com/files/2008/08/sessao_java.jpg?w=300" alt="" width="300" height="231" /></a></p>
<p>Para baixar o código fonte, clique <a href="http://dcon.com.br/jd.comment/juliano/Sessao.zip" target="_blank">aqui</a>.</p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[Download Tutorial Pemrograman Java Web (Bahasa Indonesia)]]></title>
<link>http://eecchhoo.wordpress.com/2008/08/11/download-tutorial-pemrograman-java-web-bahasa-indonesia/</link>
<pubDate>Sun, 10 Aug 2008 18:19:35 +0000</pubDate>
<dc:creator>echo</dc:creator>
<guid>http://eecchhoo.fr.wordpress.com/2008/08/11/download-tutorial-pemrograman-java-web-bahasa-indonesia/</guid>
<description><![CDATA[ini tutorial java web dari JENI, semoga berguna bagi yang pengen belajar tentang Servlet ato JSP ato]]></description>
<content:encoded><![CDATA[<p>ini tutorial java web dari JENI, semoga berguna bagi yang pengen belajar tentang Servlet ato JSP ato yang berhubungan dengan Java Web :D</p>
<p><!--more--><br />
<blockquote>
<p>COVER Web Programming</p>
<p>JENI-Web Programming-Bab 1-Pengenalan Pemrograman WEB</p>
<p>JENI-Web Programming-Bab 2-Basic Servlets</p>
<p>JENI-Web Programming-Bab 3-Advanced Servlets</p>
<p>JENI-Web Programming-Bab 4-Dasar JSP</p>
<p>JENI-Web Programming-Bab 5-SQL dan JDBC</p>
<p>JENI-Web Programming-Bab 6-JSP Lanjutan</p>
<p>JENI-Web Programming-Bab 7-MVC Intro</p>
<p>JENI-Web Programming-Bab 8-Advanced MVC</p>
<p>JENI-Web Programming-Bab 9-JSF</p>
<p>JENI-Web Programming-Bab 10-Advanced JSF</p>
<p>JENI-Web Programming-Bab 11-Web Security</p>
<p>JENI-Web Programming-Bab 14-AJAX</p>
<p>JENI-Web Programming-Bab 15-J2EE Design Pattern</p>
<p>JENI-Web Programming-Bab 16-App Case Study</p>
</blockquote>
<p>SILAHKAN DOWNLOAD DISINI :</p>
<h2><a title="http://pocong.wordpress.com/ebook/" href="http://pocong.wordpress.com/ebook/">http://pocong.wordpress.com/ebook/</a></h2>
<p>semoga berguna :mrgreen:</p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[Character decoding Error while retriving parameters in Servlet.]]></title>
<link>http://ninadgawad.wordpress.com/?p=60</link>
<pubDate>Thu, 21 Aug 2008 06:27:39 +0000</pubDate>
<dc:creator>ninadgawad</dc:creator>
<guid>http://ninadgawad.fr.wordpress.com/2008/08/21/character-decoding-error-while-retriving-parameters-in-servlet/</guid>
<description><![CDATA[Problem:
WARNING: Parameters: Character decoding failed. Parameter skipped.
java.io.CharConversionEx]]></description>
<content:encoded><![CDATA[<p><strong>Problem:</strong></p>
<p><strong></strong>WARNING: Parameters: Character decoding failed. Parameter skipped.<br />
java.io.CharConversionException: isHexDigit</p>
<p><strong>Cause:</strong></p>
<ul>
<li>Generally we get this error when we try to add special characters like "%, @, $ .. etc" in the GET/POST request from Ajax Call.</li>
<li>Since these characters are used to URL specific function like <strong>"&#38;"</strong> id used to differentiate various URL parameters. This generates a "null" value for the parameter you will try to retrieve in Servlet.</li>
</ul>
<p><strong>Solution:</strong></p>
<p>The simple way to get over this problem is to massage your Special Character String with "<strong>escape()</strong>" funtion in javascript.</p>
<p><strong>Example:</strong></p>
<p><strong><em>Before:</em></strong></p>
<p>var vUserEnteredData = document.formname.textbox.value ;  //  textbox = 100%</p>
<p>var parameters = "testId=A101&#38;percentageNeeded=" + vUserEnteredData;</p>
<p>// Some Ajax Code .....</p>
<p>request.setRequestHeader( 'Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8' );<br />
request.setRequestHeader("Content-length", parameters.length);<br />
request.setRequestHeader("Connection", "close");<br />
request.send(parameters);</p>
<p>// Note: Here the "%" will cause java.io.CharConversionException: while retriving the percentageNeeded parameter in Servlet.</p>
<p><strong><em>After:</em></strong></p>
<p>var vUserEnteredData = document.formname.textbox.value ;  //  textbox = 100%</p>
<p>var parameters = "testId=A101&#38;percentageNeeded=" + <strong>escape(vUserEnteredData)</strong>;</p>
<p>// Some Ajax Code .....</p>
<p>request.setRequestHeader( 'Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8' );<br />
request.setRequestHeader("Content-length", parameters.length);<br />
request.setRequestHeader("Connection", "close");<br />
request.send(parameters);</p>
<p><strong>Alternate Solution:</strong></p>
<ul>
<li>We can use Ajax Frameworks rather than manually making the Ajax Request like PrototypeJS, DWR etc.</li>
</ul>
]]></content:encoded>
</item>
<item>
<title><![CDATA[Sending array in GET method in Java Servlet ]]></title>
<link>http://sihantech.wordpress.com/?p=61</link>
<pubDate>Thu, 14 Aug 2008 21:18:09 +0000</pubDate>
<dc:creator>sihan</dc:creator>
<guid>http://sihantech.fr.wordpress.com/2008/08/14/sending-array-in-get-method-in-java-servlet/</guid>
<description><![CDATA[Suppose I want to send an array of names from any http client in get method to a servlet like,
name[]]></description>
<content:encoded><![CDATA[<p>Suppose I want to send an array of names from any http client in get method to a servlet like,</p>
<p>name[0] = "sihan"</p>
<p>name[1] = "rasel"</p>
<p>name[2] = "siam"</p>
<p>name[3] = "shamim"</p>
<p>All I have to do build the query  string like this :</p>
<p><strong><code>http://server_url:server_port/servletname?name=sihan&#38;name=rasel&#38;name=siam&#38;name=shamim</code></strong></p>
<p>And in the servlet we can get the array like this:</p>
<p><strong><code>String[] names = request.getParameterValues("name");</code></strong></p>
<p>Then <em>'<strong>names</strong>' </em>array will contain all the four values passed in '<em><strong>name</strong></em>' parameter.</p>
]]></content:encoded>
</item>

</channel>
</rss>
