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

<channel>
	<title>Berthou.com &#187; java</title>
	<atom:link href="http://www.berthou.com/us/tag/java/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.berthou.com/us</link>
	<description>A french developper blog</description>
	<lastBuildDate>Mon, 09 Aug 2010 08:55:28 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5</generator>
		<item>
		<title>Verify PDF signature with iText</title>
		<link>http://www.berthou.com/us/2009/07/01/verify-pdf-signature-with-itext/</link>
		<comments>http://www.berthou.com/us/2009/07/01/verify-pdf-signature-with-itext/#comments</comments>
		<pubDate>Wed, 01 Jul 2009 17:56:39 +0000</pubDate>
		<dc:creator>rberthou</dc:creator>
				<category><![CDATA[java]]></category>
		<category><![CDATA[certificat]]></category>
		<category><![CDATA[pdf]]></category>

		<guid isPermaLink="false">http://www.berthou.com/us/?p=54</guid>
		<description><![CDATA[Description After the article &#8220;How to sign a PDF in Java&#8221; I had various demands concerning the verification of this signature. You will find in this article an exemple of code which permit to check this. Tools used http://itextpdf.sourceforge.net/howtosign.html#howtoverify : Origins of the informations and of the code used below Acrobat reader 8.x ou sup [...]]]></description>
				<content:encoded><![CDATA[<h2 class="titre2">Description</h2>
<p><img src="/_img/pdf_sign.png" class="left"/><br />
After the article &#8220;How to sign a PDF in Java&#8221; I had various demands concerning the verification of this signature.<br />
You will find in this article an exemple of code which permit to check this.</p>
<h2 class="titre2">Tools used</h2>
<ul>
<li><a href="http://itextpdf.sourceforge.net/howtosign.html" target="_new">http://itextpdf.sourceforge.net/howtosign.html#howtoverify</a> : Origins of the informations and of the code used below</li>
<li><a href="http://www.adobe.com/fr/products/acrobat/" target="_blank">Acrobat reader 8.x ou sup</a> To read the PDF documents</li>
<li><a href="http://www.lowagie.com/iText/" target="_blank">iText 2.x</a>Java librarie tools (the reference according to me) to create, sign and handle PDF documents</li>
<li><a href="http://www.bouncycastle.org/fr/index.html" target="_blank">bouncycastle.org</a> used in itext (bcprov)</li>
</ul>
<p><span id="more-54"></span></p>
<h2 class="titre2">Exemple (source code)</h2>
<p>As you can see the java code to do this is very simple :</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">package</span> <span style="color: #006699;">com.berthou.test.pdf</span> <span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.io.*</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.security.*</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.security.cert.Certificate</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.util.ArrayList</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.util.Calendar</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">com.lowagie.text.*</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">com.lowagie.text.pdf.*</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> test_pdf  <span style="color: #009900;">&#123;</span>
	<span style="color: #008000; font-style: italic; font-weight: bold;">/**
	 * Name of the PDF document
	 */</span>
	<span style="color: #000000; font-weight: bold;">static</span> <span style="color: #003399;">String</span> dirname  <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;D:<span style="color: #000099; font-weight: bold;">\\</span>&quot;</span> <span style="color: #339933;">;</span><span style="color: #666666; font-style: italic;">// &quot;D:\\&quot;</span>
	<span style="color: #000000; font-weight: bold;">static</span> <span style="color: #003399;">String</span> fname  <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;HelloWorld_sign&quot;</span> <span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000066; font-weight: bold;">void</span> main<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> args<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">try</span> <span style="color: #009900;">&#123;</span>
			test_pdf.<span style="color: #006633;">verifyPdf</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
		<span style="color: #000000; font-weight: bold;">catch</span><span style="color: #009900;">&#40;</span><span style="color: #003399;">Exception</span> e<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #003399;">System</span>.<span style="color: #006633;">err</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span>e.<span style="color: #006633;">getMessage</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000000; font-weight: bold;">final</span> <span style="color: #000066; font-weight: bold;">boolean</span> verifyPdf<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
                   <span style="color: #000000; font-weight: bold;">throws</span> <span style="color: #003399;">IOException</span>, DocumentException, <span style="color: #003399;">Exception</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #003399;">KeyStore</span> kall <span style="color: #339933;">=</span> PdfPKCS7.<span style="color: #006633;">loadCacertsKeyStore</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		PdfReader reader <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> PdfReader<span style="color: #009900;">&#40;</span>dirname <span style="color: #339933;">+</span> fname <span style="color: #339933;">+</span><span style="color: #0000ff;">&quot;.pdf&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		AcroFields af <span style="color: #339933;">=</span> reader.<span style="color: #006633;">getAcroFields</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #666666; font-style: italic;">// Search of the whole signature</span>
		<span style="color: #003399;">ArrayList</span> names <span style="color: #339933;">=</span> af.<span style="color: #006633;">getSignatureNames</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #666666; font-style: italic;">// For every signature :</span>
		<span style="color: #000000; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> k <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span> k <span style="color: #339933;">&lt;</span> names.<span style="color: #006633;">size</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #339933;">++</span>k<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		   <span style="color: #003399;">String</span> name <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span><span style="color: #009900;">&#41;</span>names.<span style="color: #006633;">get</span><span style="color: #009900;">&#40;</span>k<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  		   <span style="color: #666666; font-style: italic;">// Affichage du nom</span>
		   <span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Signature name: &quot;</span> <span style="color: #339933;">+</span> name<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		   <span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Signature covers whole document: &quot;</span>
                                <span style="color: #339933;">+</span> af.<span style="color: #006633;">signatureCoversWholeDocument</span><span style="color: #009900;">&#40;</span>name<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  		   <span style="color: #666666; font-style: italic;">// Affichage sur les revision - version</span>
		   <span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Document revision: &quot;</span> <span style="color: #339933;">+</span> af.<span style="color: #006633;">getRevision</span><span style="color: #009900;">&#40;</span>name<span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> <span style="color: #0000ff;">&quot; of &quot;</span>
                                <span style="color: #339933;">+</span> af.<span style="color: #006633;">getTotalRevisions</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		   <span style="color: #666666; font-style: italic;">// Debut de l'extraction de la &quot;revision&quot;</span>
		   <span style="color: #003399;">FileOutputStream</span> out <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">FileOutputStream</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;d:<span style="color: #000099; font-weight: bold;">\\</span>revision_&quot;</span>
                                <span style="color: #339933;">+</span> af.<span style="color: #006633;">getRevision</span><span style="color: #009900;">&#40;</span>name<span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> <span style="color: #0000ff;">&quot;.pdf&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		   <span style="color: #000066; font-weight: bold;">byte</span> bb<span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">8192</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
		   <span style="color: #003399;">InputStream</span> ip <span style="color: #339933;">=</span> af.<span style="color: #006633;">extractRevision</span><span style="color: #009900;">&#40;</span>name<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		   <span style="color: #000066; font-weight: bold;">int</span> n <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>
		   <span style="color: #000000; font-weight: bold;">while</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>n <span style="color: #339933;">=</span> ip.<span style="color: #006633;">read</span><span style="color: #009900;">&#40;</span>bb<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&gt;</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span> out.<span style="color: #006633;">write</span><span style="color: #009900;">&#40;</span>bb, <span style="color: #cc66cc;">0</span>, n<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		   out.<span style="color: #006633;">close</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		   ip.<span style="color: #006633;">close</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		   <span style="color: #666666; font-style: italic;">// Fin extraction revision</span>
&nbsp;
		   PdfPKCS7 pk <span style="color: #339933;">=</span> af.<span style="color: #006633;">verifySignature</span><span style="color: #009900;">&#40;</span>name<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		   <span style="color: #003399;">Calendar</span> cal <span style="color: #339933;">=</span> pk.<span style="color: #006633;">getSignDate</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		   <span style="color: #003399;">Certificate</span> pkc<span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> pk.<span style="color: #006633;">getCertificates</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		   <span style="color: #666666; font-style: italic;">// Information about the certificat, le signataire</span>
		   <span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Subject: &quot;</span>
                                <span style="color: #339933;">+</span> PdfPKCS7.<span style="color: #006633;">getSubjectFields</span><span style="color: #009900;">&#40;</span>pk.<span style="color: #006633;">getSigningCertificate</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		   <span style="color: #666666; font-style: italic;">// Le document à t'il ete modifié ?</span>
		   <span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Document modified: &quot;</span> <span style="color: #339933;">+</span> <span style="color: #339933;">!</span>pk.<span style="color: #006633;">verify</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		   <span style="color: #666666; font-style: italic;">// Is the certificate avaible ? Be carefull we search the chain of certificat</span>
		   <span style="color: #003399;">Object</span> fails<span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> PdfPKCS7.<span style="color: #006633;">verifyCertificates</span><span style="color: #009900;">&#40;</span>pkc, kall, <span style="color: #000066; font-weight: bold;">null</span>, cal<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		   <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>fails <span style="color: #339933;">==</span> <span style="color: #000066; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span>
		       <span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Certificates verified against the KeyStore&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		   <span style="color: #000000; font-weight: bold;">else</span>
		       <span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Certificate failed: &quot;</span> <span style="color: #339933;">+</span> fails<span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
		<span style="color: #000000; font-weight: bold;">return</span> <span style="color: #000066; font-weight: bold;">true</span> <span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<h2 class="titre2">Sample PDF generate</h2>
<p class="alertDownload">
<a href="/download.php?type=wp&#038;file=HelloWorld_sign.pdf" target="_blank">HelloWorld_sign.pdf</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.berthou.com/us/2009/07/01/verify-pdf-signature-with-itext/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>A ServletFilter to monitor the execution state of a JSP.</title>
		<link>http://www.berthou.com/us/2009/02/14/a-servletfilter-to-monitor-the-execution-state-of-a-jsp/</link>
		<comments>http://www.berthou.com/us/2009/02/14/a-servletfilter-to-monitor-the-execution-state-of-a-jsp/#comments</comments>
		<pubDate>Sat, 14 Feb 2009 18:08:31 +0000</pubDate>
		<dc:creator>rberthou</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[websphere]]></category>

		<guid isPermaLink="false">http://www.berthou.com/us/2009/02/14/a-servletfilter-to-monitor-the-execution-state-of-a-jsp/</guid>
		<description><![CDATA[The reasons of this little project Recently I had a little problem on a Websphere application server. A JSP page running on this application server had a problem (a no ending loop). This was a bit hard to identify because noting permit to isolate on this server the pages running. To solve this lake of [...]]]></description>
				<content:encoded><![CDATA[<h2 class="titre2">The reasons of this little project</h2>
<p>Recently I had a little problem on a Websphere application server. A JSP page running on this application server had a problem (a no ending loop). This was a bit hard to identify because noting permit to isolate on this server the pages running.<br />
To solve this lake of informations I realized a little  Servletfilter which permit to monitor this.<br />
I propose you this little tool for exemple as a ServletFilter. I wish it would be useful to you.<br />
<br/><br/></p>
<p><img src="/_img/StatsFilter_0.png" class="center" /><br />
<span id="more-51"></span></p>
<h2 class="titre2">The goal of the project.</h2>
<p>It consist to put in a HashTable the running pages. I also had some others informations which permit me to offer some more statistics (execution time, number of errors, number of executions&#8230;)<br />
A JSP page display the informations of this Hashtable.</p>
<p>The use of this filter allows me to add this option to the whole webapps without changing the actif code (only the file web.xml which have to be modifiate to activate the filter).<br />
<br/><br/></p>
<h2 class="titre2">Project source</h2>
<p>The whole source code is avaible to download. The application is composed of three smalls classes :</p>
<h3 class="titre3">StatsFilter.java : The filter</h3>
<p>Little class doing all his work in the method<strong>doFilter</strong></p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">package</span> <span style="color: #006699;">com.berthou.web.filtre</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.io.*</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javax.servlet.*</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javax.servlet.http.*</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">final</span> <span style="color: #000000; font-weight: bold;">class</span> StatsFilter <span style="color: #000000; font-weight: bold;">implements</span> Filter <span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">private</span> FilterConfig filterConfig <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">null</span><span style="color: #339933;">;</span>
    <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #003399;">String</span> appli <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;&quot;</span> <span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> doFilter<span style="color: #009900;">&#40;</span>ServletRequest request, ServletResponse response,
        FilterChain chain<span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">throws</span> <span style="color: #003399;">IOException</span>, ServletException <span style="color: #009900;">&#123;</span>
        <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>filterConfig <span style="color: #339933;">==</span> <span style="color: #000066; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span>  <span style="color: #000000; font-weight: bold;">return</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #003399;">String</span> key <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;&quot;</span> <span style="color: #339933;">;</span>
    	<span style="color: #000066; font-weight: bold;">long</span> startTime <span style="color: #339933;">=</span> <span style="color: #003399;">System</span>.<span style="color: #006633;">currentTimeMillis</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000000; font-weight: bold;">try</span> <span style="color: #009900;">&#123;</span>
    		key <span style="color: #339933;">=</span> appli <span style="color: #339933;">+</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>HttpServletRequest<span style="color: #009900;">&#41;</span>request<span style="color: #009900;">&#41;</span>.<span style="color: #006633;">getServletPath</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">;</span>
    		<span style="color: #666666; font-style: italic;">// On ajoute la page dans la liste des pages en cours</span>
    		MonitorJsp.<span style="color: #006633;">action</span><span style="color: #009900;">&#40;</span> MonitorJsp.<span style="color: #006633;">ACT_ADD</span>, key, <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">;</span>
    		chain.<span style="color: #006633;">doFilter</span><span style="color: #009900;">&#40;</span>request, response<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    		<span style="color: #666666; font-style: italic;">// On supprime la page dans la liste des pages en cours (+temsp d'execution)</span>
    		MonitorJsp.<span style="color: #006633;">action</span><span style="color: #009900;">&#40;</span> MonitorJsp.<span style="color: #006633;">ACT_DEL</span>, key, <span style="color: #009900;">&#40;</span><span style="color: #003399;">System</span>.<span style="color: #006633;">currentTimeMillis</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">-</span> startTime<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #009900;">&#40;</span><span style="color: #003399;">IOException</span> io<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    		<span style="color: #666666; font-style: italic;">// Une erreur ce produit =&gt; on la trace puis on la renvoie</span>
    		MonitorJsp.<span style="color: #006633;">action</span><span style="color: #009900;">&#40;</span> MonitorJsp.<span style="color: #006633;">ACT_ERR</span>, key, <span style="color: #009900;">&#40;</span><span style="color: #003399;">System</span>.<span style="color: #006633;">currentTimeMillis</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">-</span> startTime<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">;</span>
    		<span style="color: #000000; font-weight: bold;">throw</span> io <span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #009900;">&#40;</span>ServletException se<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    		<span style="color: #666666; font-style: italic;">// Une erreur ce produit =&gt; on la trace puis on la renvoie</span>
    		MonitorJsp.<span style="color: #006633;">action</span><span style="color: #009900;">&#40;</span> MonitorJsp.<span style="color: #006633;">ACT_ERR</span>, key, <span style="color: #009900;">&#40;</span><span style="color: #003399;">System</span>.<span style="color: #006633;">currentTimeMillis</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">-</span> startTime<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">;</span>
    		<span style="color: #000000; font-weight: bold;">throw</span> se <span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span>
    <span style="color: #008000; font-style: italic; font-weight: bold;">/**
     * Lecture des paramètres d'exécution (dans web.xml)
     *  Ici uniquement la zone APPLICATION
     */</span>
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> init<span style="color: #009900;">&#40;</span>FilterConfig filterConfig<span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">throws</span> ServletException <span style="color: #009900;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">filterConfig</span> <span style="color: #339933;">=</span> filterConfig<span style="color: #339933;">;</span>
	appli <span style="color: #339933;">=</span> filterConfig.<span style="color: #006633;">getInitParameter</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;APPLICATION&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> destroy<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">filterConfig</span> <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">null</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<h3 class="titre3">MonitorJsp.java : The monitor</h3>
<p>It is a static class of supervision (it is possible to change to a singleton)</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">package</span> <span style="color: #006699;">com.berthou.web.filtre</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.text.SimpleDateFormat</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.util.*</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.io.*</span> <span style="color: #339933;">;</span>
&nbsp;
<span style="color: #008000; font-style: italic; font-weight: bold;">/**
 * Classe de suppervision permettant de suivre l'état de certains objets
 * c'est un classe &lt;b&gt;static&lt;/b&gt;
 *
 * @author rberthou
 *
 */</span>
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> MonitorJsp <span style="color: #009900;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000000; font-weight: bold;">final</span> <span style="color: #003399;">String</span> version <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;MonitorJsp V1.00 du 4 Septembre 2008&quot;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000000; font-weight: bold;">protected</span> <span style="color: #003399;">Hashtable</span> map <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">Hashtable</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">100</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000000; font-weight: bold;">final</span> <span style="color: #000066; font-weight: bold;">int</span> ACT_ADD <span style="color: #339933;">=</span> <span style="color: #cc66cc;">1</span> <span style="color: #339933;">;</span>
	<span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000000; font-weight: bold;">final</span> <span style="color: #000066; font-weight: bold;">int</span> ACT_DEL <span style="color: #339933;">=</span> <span style="color: #cc66cc;">2</span> <span style="color: #339933;">;</span>
	<span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000000; font-weight: bold;">final</span> <span style="color: #000066; font-weight: bold;">int</span> ACT_ERR <span style="color: #339933;">=</span> <span style="color: #cc66cc;">5</span> <span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000000; font-weight: bold;">synchronized</span> <span style="color: #000066; font-weight: bold;">void</span> action<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> act, <span style="color: #003399;">String</span> key, <span style="color: #000066; font-weight: bold;">long</span> delay<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
    	ItemMonitor itm <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>ItemMonitor<span style="color: #009900;">&#41;</span>map.<span style="color: #006633;">get</span><span style="color: #009900;">&#40;</span>key<span style="color: #009900;">&#41;</span> <span style="color: #339933;">;</span>
    	<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span> itm <span style="color: #339933;">==</span> <span style="color: #000066; font-weight: bold;">null</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    		<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>act <span style="color: #339933;">==</span> ACT_ADD<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    			itm <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> ItemMonitor<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">;</span>
    			map.<span style="color: #006633;">put</span><span style="color: #009900;">&#40;</span>key, itm<span style="color: #009900;">&#41;</span> <span style="color: #339933;">;</span>
    		<span style="color: #009900;">&#125;</span>
    	<span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">else</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>act <span style="color: #339933;">==</span> ACT_ADD<span style="color: #009900;">&#41;</span> itm.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">;</span> 	       <span style="color: #000000; font-weight: bold;">else</span>
   			<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>act <span style="color: #339933;">==</span> ACT_DEL<span style="color: #009900;">&#41;</span> itm.<span style="color: #006633;">remove</span><span style="color: #009900;">&#40;</span>delay<span style="color: #009900;">&#41;</span> <span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">else</span>
   			<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>act <span style="color: #339933;">==</span> ACT_ERR<span style="color: #009900;">&#41;</span> itm.<span style="color: #006633;">error</span><span style="color: #009900;">&#40;</span>delay<span style="color: #009900;">&#41;</span> <span style="color: #339933;">;</span>
    	<span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span>
    ..... <span style="color: #009900;">&#91;</span>CUT<span style="color: #009900;">&#93;</span> ....
  <span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<h3 class="titre3">ItemMonitor.java : The data</h3>
<p>It is a representation of a list of element.</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">package</span> <span style="color: #006699;">com.berthou.web.filtre</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> ItemMonitor <span style="color: #009900;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000066; font-weight: bold;">long</span> nbrun  <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span>  <span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// Nombre d'execution</span>
	<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000066; font-weight: bold;">long</span> nbact <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span> <span style="color: #339933;">;</span>   <span style="color: #666666; font-style: italic;">// Nombre de page active</span>
	<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000066; font-weight: bold;">long</span> nberr <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span> <span style="color: #339933;">;</span>    <span style="color: #666666; font-style: italic;">// Nombre d'erreur</span>
	<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000066; font-weight: bold;">long</span> mints <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span> <span style="color: #339933;">;</span>    <span style="color: #666666; font-style: italic;">// Temps min</span>
	<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000066; font-weight: bold;">long</span> maxts <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span> <span style="color: #339933;">;</span>   <span style="color: #666666; font-style: italic;">// Temps Max</span>
	<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000066; font-weight: bold;">long</span> lastAcc <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span> <span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// date last exec</span>
&nbsp;
	<span style="color: #008000; font-style: italic; font-weight: bold;">/**
	 * Constructeur
	 */</span>
	<span style="color: #000000; font-weight: bold;">public</span> ItemMonitor<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> reset<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		nbrun  <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span>  <span style="color: #339933;">;</span>
		nberr <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span> <span style="color: #339933;">;</span>
		mints <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span> <span style="color: #339933;">;</span>
		maxts <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span> <span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> add<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		nbact<span style="color: #339933;">++</span> <span style="color: #339933;">;</span>
		lastAcc <span style="color: #339933;">=</span> <span style="color: #003399;">System</span>.<span style="color: #006633;">currentTimeMillis</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> remove<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">long</span> delay<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		nbrun<span style="color: #339933;">++</span> <span style="color: #339933;">;</span>
		nbact<span style="color: #339933;">--</span> <span style="color: #339933;">;</span>
&nbsp;
		sumts <span style="color: #339933;">+=</span> delay <span style="color: #339933;">;</span>
		<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>mints <span style="color: #339933;">&lt;</span> <span style="color: #cc66cc;">1</span> <span style="color: #339933;">||</span> delay <span style="color: #339933;">&lt;</span> mints<span style="color: #009900;">&#41;</span> mints <span style="color: #339933;">=</span> delay <span style="color: #339933;">;</span>
		<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>delay <span style="color: #339933;">&gt;</span> maxts<span style="color: #009900;">&#41;</span> maxts <span style="color: #339933;">=</span> delay <span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> error<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">long</span> delay<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		nberr<span style="color: #339933;">++</span> <span style="color: #339933;">;</span>
		nbact<span style="color: #339933;">--</span> <span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
      ..... <span style="color: #009900;">&#91;</span>CUT<span style="color: #009900;">&#93;</span> .....
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p><br/><br/></p>
<h2 class="titre2">Utilisation</h2>
<p>To use this filter you have to :</p>
<ul>
<li>Add the archive .jar in the collective librairies of your application server. (Be careful: if you put it at once in your directory /WEB-INF/lib of your webapp it will only work for this application.)</li>
<li>Change the file web.xml to parameter this filter (exemple just below). </li>
</ul>

<div class="wp_syntax"><table><tr><td class="code"><pre class="xml" style="font-family:monospace;">    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;filter<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;filter-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>StatsFilter<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/filter-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;filter-class<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>com.berthou.web.flitre.StatsFilter<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/filter-class<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;init-param<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
          <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;param-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>APPLICATION<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/param-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
          <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;param-value<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>TEST1<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/param-value<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/init-param<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/filter<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;filter-mapping<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
       <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;filter-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>StatsFilter<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/filter-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
       <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;url-pattern<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>*.jsp<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/url-pattern<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/filter-mapping<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>

<p>It allows you to identify the filter in your webapp. You just have to write a JSP page as the one below to display the current datas</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="java" style="font-family:monospace;"><span style="color: #339933;">&lt;%</span>@ <span style="color: #000000; font-weight: bold;">import</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;com.berthou.web.filtre.*,java.util.*&quot;</span><span style="color: #339933;">%&gt;</span>
<span style="color: #339933;">&lt;%</span>
	<span style="color: #666666; font-style: italic;">// Get iterator for keys in HashMap</span>
	<span style="color: #003399;">Hashtable</span> monitorSession <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #003399;">Hashtable</span><span style="color: #009900;">&#41;</span>MonitorJsp.<span style="color: #006633;">cloneIt</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;b&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #003399;">Iterator</span> sessionIter     <span style="color: #339933;">=</span> monitorSession.<span style="color: #006633;">keySet</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">iterator</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #003399;">String</span> id <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;&quot;</span> <span style="color: #339933;">;</span>
	ItemMonitor itm <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">null</span> <span style="color: #339933;">;</span>
<span style="color: #339933;">%&gt;</span>
<span style="color: #339933;">&lt;</span>table<span style="color: #339933;">&gt;&lt;</span>thead<span style="color: #339933;">&gt;&lt;</span>tr<span style="color: #339933;">&gt;</span>
  <span style="color: #339933;">&lt;</span>th<span style="color: #339933;">&gt;</span>id<span style="color: #339933;">&lt;/</span>th<span style="color: #339933;">&gt;&lt;</span>th<span style="color: #339933;">&gt;</span>act<span style="color: #339933;">&lt;/</span>th<span style="color: #339933;">&gt;&lt;</span>th<span style="color: #339933;">&gt;</span>run<span style="color: #339933;">&lt;/</span>th<span style="color: #339933;">&gt;&lt;</span>th<span style="color: #339933;">&gt;</span>err<span style="color: #339933;">&lt;/</span>th<span style="color: #339933;">&gt;&lt;</span>th<span style="color: #339933;">&gt;</span>last<span style="color: #339933;">&lt;/</span>th<span style="color: #339933;">&gt;&lt;</span>th<span style="color: #339933;">&gt;</span>min<span style="color: #339933;">/</span>max<span style="color: #339933;">&lt;/</span>th<span style="color: #339933;">&gt;&lt;</span>th<span style="color: #339933;">&gt;</span>Sum<span style="color: #339933;">&lt;/</span>th<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;/</span>tr<span style="color: #339933;">&gt;&lt;/</span>thead<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>tbody<span style="color: #339933;">&gt;&lt;%</span>
<span style="color: #000000; font-weight: bold;">while</span><span style="color: #009900;">&#40;</span>sessionIter.<span style="color: #006633;">hasNext</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  id <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span><span style="color: #009900;">&#41;</span>sessionIter.<span style="color: #006633;">next</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  itm <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>ItemMonitor<span style="color: #009900;">&#41;</span>monitorSession.<span style="color: #006633;">get</span><span style="color: #009900;">&#40;</span>id<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #000000; font-weight: bold;">try</span>
  <span style="color: #009900;">&#123;</span>
		<span style="color: #339933;">%&gt;&lt;</span>tr valign<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;top&quot;</span><span style="color: #339933;">&gt;&lt;</span>td <span style="color: #339933;">&gt;&lt;%=</span>id<span style="color: #339933;">%&gt;&lt;/</span>td<span style="color: #339933;">&gt;&lt;%=</span>itm.<span style="color: #006633;">toHtmlString</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">%&gt;&lt;/</span>tr<span style="color: #339933;">&gt;&lt;%</span>
  <span style="color: #009900;">&#125;</span>
  <span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #009900;">&#40;</span> java.<span style="color: #006633;">lang</span>.<span style="color: #003399;">IllegalStateException</span> ie <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #339933;">%&gt;</span>
<span style="color: #339933;">&lt;/</span>tbody<span style="color: #339933;">&gt;&lt;/</span>table<span style="color: #339933;">&gt;</span></pre></td></tr></table></div>

<p><br/><br/></p>
<h2 class="titre2">Attention</h2>
<p>I use a static class which is <strong>&#8220;synchronized&#8221;</strong>. You have to be careful about the goulot d&#8217;étranglement for the application server with a huge traffic. Personnaly I use this in a production server (intranet ) without any problems.<br />
<br/><br/></p>
<h2 class="titre2">Downloads</h2>
<p class="alertDownload">
<a href="/download.php?type=java&#038;file=StatsFilter.zip">StatsFilter.zip le code Source</a><br />
<a href="/download.php?type=java&#038;file=StatsFilter.jar">StatsFilter.jar la librairie</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.berthou.com/us/2009/02/14/a-servletfilter-to-monitor-the-execution-state-of-a-jsp/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>MemoryTable &#8211; To simplify the values listes gestion</title>
		<link>http://www.berthou.com/us/2008/02/09/memorytable-to-simplify-the-values-listes-gestion/</link>
		<comments>http://www.berthou.com/us/2008/02/09/memorytable-to-simplify-the-values-listes-gestion/#comments</comments>
		<pubDate>Sat, 09 Feb 2008 13:16:51 +0000</pubDate>
		<dc:creator>rberthou</dc:creator>
				<category><![CDATA[java]]></category>
		<category><![CDATA[OpenSource]]></category>
		<category><![CDATA[source]]></category>

		<guid isPermaLink="false">http://www.berthou.com/us/2008/02/09/memorytable-to-simplify-the-values-listes-gestion/</guid>
		<description><![CDATA[Description Usually in software devellopement we use values liste that we take from &#8220;properties&#8221;, SQL tables or in the worst case, &#8220;in hard codding&#8221; in our application. As many people I had this problem ans I solve it by creating &#8220;Tables Memories&#8221;. It permits me to limit the access to the database (or file), to [...]]]></description>
				<content:encoded><![CDATA[<h2 class="titre2">Description</h2>
<p>Usually in software devellopement we use values liste that we take from &#8220;properties&#8221;, SQL tables or in the worst case, &#8220;in hard codding&#8221; in our application.</p>
<p>As many people I had this problem ans I solve it by creating &#8220;Tables Memories&#8221;. It permits me to limit the access to the database (or file), to low the occupation memory by having just one request of these memories liste, and to simplify my code.</p>
<p>This code is quite old and could be improved (use of the patern singleton instead of a full static classe, synchronize optimisation&#8230;). I use this in a huge number of project and I always report these modifications because I don&#8217;t have any performance or memories problems.</p>
<h2 class="titre2">Fonctions</h2>
<p>During the cration of this componant I wanted to have the following functions also I simplify in maximum its use in a JSP page or a Servtel :</p>
<ul>
<li>&#8220;Connection&#8221; sql connection outside bean</li>
<li>Do not reload the data  if they are already in memory</li>
<li>Load of a liste from a select SQL : loadQuery(&#8230;)</li>
<li>Load of a list from a values liste : loadListe(&#8230;)</li>
<li>Read of the description associated to a code (String) : getValue(&#8230;)</li>
<li>Read of the description associated to a code (Combobox) : getListe(&#8230;)</li>
<li>Read of the description associated to a code (Radio Bouton) : getRadio(&#8230;)</li>
</ul>
<p><span id="more-36"></span></p>
<h2 class="titre2">Download</h2>
<p class="alertDownload">
<a href="/download.php?type=java&#038;file=memorytable.zip">memorytable.zip</a>
</p>
<h2 class="titre2">Use</h2>
<p>This little sample of a code (jsp) show how to do the load (initialisation) of the &#8220;Memory Table&#8221;.</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="java" style="font-family:monospace;"><span style="color: #339933;">&lt;%</span>@ page language<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;java&quot;</span> <span style="color: #000000; font-weight: bold;">import</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;com.berthou.sql.*&quot;</span><span style="color: #339933;">%&gt;</span>
<span style="color: #339933;">&lt;%</span>
java.<span style="color: #006633;">sql</span>.<span style="color: #003399;">Connection</span> conn <span style="color: #339933;">=</span> .... <span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// Initialize you connection</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// Load a hard coded liste</span>
MemoryTable.<span style="color: #006633;">loadListe</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;TEST_L_ETAT&quot;</span>,<span style="color: #0000ff;">&quot;    = ;V=Valide;E=En erreur;I=Incomplete;&quot;</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// Load a SQL Query liste</span>
<span style="color: #666666; font-style: italic;">// Research of the service code and of the description of the actifs service.</span>
<span style="color: #003399;">String</span> sql <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;select cdserv, libelle from service where status = 'O' &quot;</span> <span style="color: #339933;">;</span>
MemoryTable.<span style="color: #006633;">loadQuery</span><span style="color: #009900;">&#40;</span>conn, <span style="color: #0000ff;">&quot;TBL_SERV&quot;</span>,sql <span style="color: #009900;">&#41;</span> <span style="color: #339933;">;</span>
<span style="color: #339933;">%&gt;</span></pre></td></tr></table></div>

<p>When this load has been made you can use at once the &#8220;memory tables&#8221;</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="java" style="font-family:monospace;"><span style="color: #339933;">&lt;%</span>@ page language<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;java&quot;</span> <span style="color: #000000; font-weight: bold;">import</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;com.berthou.sql.*&quot;</span><span style="color: #339933;">%&gt;</span>
....
<span style="color: #339933;">&lt;%</span> <span style="color: #003399;">String</span> service <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;1305&quot;</span> <span style="color: #339933;">;</span> <span style="color: #339933;">%&gt;</span>
Service <span style="color: #339933;">:</span> <span style="color: #339933;">&lt;%=</span>service<span style="color: #339933;">%&gt;</span> <span style="color: #339933;">-</span> <span style="color: #339933;">&lt;%=</span>MemoryTable.<span style="color: #006633;">getValue</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;TBL_SERV&quot;</span>, service<span style="color: #009900;">&#41;</span><span style="color: #339933;">%&gt;</span>
<span style="color: #009900;">&#40;</span>affiche Service <span style="color: #339933;">:</span> <span style="color: #cc66cc;">1305</span> <span style="color: #339933;">-</span> Libelle du service1305<span style="color: #009900;">&#41;</span>
&nbsp;
Service <span style="color: #339933;">:</span>
<span style="color: #339933;">&lt;</span>select name<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;service&quot;</span><span style="color: #339933;">&gt;&lt;%=</span>MemoryTable.<span style="color: #006633;">getListe</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;TBL_SERV&quot;</span>, service<span style="color: #009900;">&#41;</span><span style="color: #339933;">%&gt;&lt;/</span>select<span style="color: #339933;">&gt;</span>
<span style="color: #009900;">&#40;</span>build a combobox by activating the asked service<span style="color: #009900;">&#41;</span></pre></td></tr></table></div>

<h2 class="titre2">The MemoryTable class</h2>

<div class="wp_syntax"><table><tr><td class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">package</span> <span style="color: #006699;">com.berthou.sql</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.sql.Connection</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.sql.ResultSet</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.sql.ResultSetMetaData</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.sql.SQLException</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.sql.Statement</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.util.Hashtable</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.util.StringTokenizer</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.util.Vector</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.apache.log4j.Logger</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #008000; font-style: italic; font-weight: bold;">/**
 * @author rberthou
 *
 * Creating 3 févr. 2001
 * Package  com.berthou.sql
 * Projet   tools
 * -------+------------+-------------------------------------------------------------------------
 *   Ver  | Date       | Comments
 * -------+------------+-------------------------------------------------------------------------
 *  2.00  | 04/04/2006 | List's add and radio button (+ comments)
 *  1.00  | 03/02/2001 | Creation
 * -------+------------+-------------------------------------------------------------------------
 */</span>
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> MemoryTable <span style="color: #009900;">&#123;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000000; font-weight: bold;">final</span> Logger logger <span style="color: #339933;">=</span> Logger.<span style="color: #006633;">getLogger</span><span style="color: #009900;">&#40;</span>MemoryTable.<span style="color: #000000; font-weight: bold;">class</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000000; font-weight: bold;">protected</span> <span style="color: #003399;">Hashtable</span> h <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">Hashtable</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">10</span>, <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #008000; font-style: italic; font-weight: bold;">/**
	 * Reload of the data of a guery
	 *
	 * @param Connection
	 *            conn : used connection
	 * @param String
	 *            tableName : Name of the Query
	 * @param String
	 *            Sql : Ordre SQL à executer
	 * @param boolean
	 *            tr : true if trim colonne code
	 *
	 * @return int rc : nombre d'enregistrements chargés
	 */</span>
	<span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">synchronized</span> <span style="color: #000066; font-weight: bold;">int</span> reloadQuery<span style="color: #009900;">&#40;</span><span style="color: #003399;">Connection</span> conn,
			<span style="color: #003399;">String</span> tableName, <span style="color: #003399;">String</span> sql, <span style="color: #000066; font-weight: bold;">boolean</span> tr<span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">throws</span> <span style="color: #003399;">SQLException</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #666666; font-style: italic;">/* Si la table est déja chargé on la recharge */</span>
		freeTable<span style="color: #009900;">&#40;</span>tableName<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #000000; font-weight: bold;">return</span> loadQuery<span style="color: #009900;">&#40;</span>conn, tableName, sql, tr<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #008000; font-style: italic; font-weight: bold;">/**
	 * rechargement des données d'un query
	 *
	 * @param Connection
	 *            conn : Connexion utilisée
	 * @param String
	 *            tableName : Nom du Query
	 * @param String
	 *            Sql : Ordre SQL à executer
	 *
	 * @return int rc : nombre d'enregistrements chargés
	 */</span>
	<span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">synchronized</span> <span style="color: #000066; font-weight: bold;">int</span> reloadQuery<span style="color: #009900;">&#40;</span><span style="color: #003399;">Connection</span> conn,
			<span style="color: #003399;">String</span> tableName, <span style="color: #003399;">String</span> sql<span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">throws</span> <span style="color: #003399;">SQLException</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">return</span> reloadQuery<span style="color: #009900;">&#40;</span>conn, tableName, sql, <span style="color: #000066; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #008000; font-style: italic; font-weight: bold;">/**
	 * chargement des données d'une table
	 *
	 * @param Connection
	 *            conn : Connexion utilisée
	 * @param String
	 *            tableName : Nom du Query
	 * @param String
	 *            Sql : Ordre SQL à executer
	 *
	 * @return int rc : nombre d'enregistrements chargés
	 */</span>
	<span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">synchronized</span> <span style="color: #000066; font-weight: bold;">int</span> loadQuery<span style="color: #009900;">&#40;</span><span style="color: #003399;">Connection</span> conn, <span style="color: #003399;">String</span> queryName,
			<span style="color: #003399;">String</span> sql<span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">throws</span> <span style="color: #003399;">SQLException</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">return</span> loadQuery<span style="color: #009900;">&#40;</span>conn, queryName, sql, <span style="color: #000066; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #008000; font-style: italic; font-weight: bold;">/**
	 * chargement des données d'une table
	 *
	 * @param Connection
	 *            conn : Connexion utilisée
	 * @param String
	 *            tableName : Nom du Query
	 * @param String
	 *            Sql : Ordre SQL à executer
	 * @param boolean
	 *            isTrim : Vrai si colonne code a trim
	 *
	 * @return int rc : nombre d'enregistrements chargés
	 */</span>
	<span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">synchronized</span> <span style="color: #000066; font-weight: bold;">int</span> loadQuery<span style="color: #009900;">&#40;</span><span style="color: #003399;">Connection</span> conn, <span style="color: #003399;">String</span> queryName,
			<span style="color: #003399;">String</span> sql, <span style="color: #000066; font-weight: bold;">boolean</span> isTrim<span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">throws</span> <span style="color: #003399;">SQLException</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>isLoaded<span style="color: #009900;">&#40;</span>queryName<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
			<span style="color: #000000; font-weight: bold;">return</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span><span style="color: #003399;">Vector</span><span style="color: #009900;">&#41;</span> h.<span style="color: #006633;">get</span><span style="color: #009900;">&#40;</span>queryName<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">size</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #000066; font-weight: bold;">int</span> rc <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>
		<span style="color: #003399;">Vector</span> v <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">Vector</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">10</span>, <span style="color: #cc66cc;">5</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #000000; font-weight: bold;">try</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #003399;">Statement</span> stmt <span style="color: #339933;">=</span> conn.<span style="color: #006633;">createStatement</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
			<span style="color: #666666; font-style: italic;">/* Execution */</span>
			<span style="color: #003399;">ResultSet</span> rs <span style="color: #339933;">=</span> stmt.<span style="color: #006633;">executeQuery</span><span style="color: #009900;">&#40;</span>sql<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>rs <span style="color: #339933;">!=</span> <span style="color: #000066; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
				<span style="color: #003399;">ResultSetMetaData</span> rsdt <span style="color: #339933;">=</span> rs.<span style="color: #006633;">getMetaData</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
				<span style="color: #666666; font-style: italic;">/* Si utile recherche de la liste des colonnes */</span>
				<span style="color: #000066; font-weight: bold;">int</span> K <span style="color: #339933;">=</span> rsdt.<span style="color: #006633;">getColumnCount</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
				<span style="color: #666666; font-style: italic;">/* Lecture des données et mémorisation dans un Vecteur */</span>
				<span style="color: #000000; font-weight: bold;">while</span> <span style="color: #009900;">&#40;</span>rs.<span style="color: #006633;">next</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
					<span style="color: #003399;">String</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> s <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">String</span><span style="color: #009900;">&#91;</span>K<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
					<span style="color: #000000; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> I <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span> I <span style="color: #339933;">&lt;</span> K<span style="color: #339933;">;</span> I<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
						<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>I <span style="color: #339933;">==</span> <span style="color: #cc66cc;">0</span> <span style="color: #339933;">&amp;&amp;</span> isTrim<span style="color: #009900;">&#41;</span>
							s<span style="color: #009900;">&#91;</span>I<span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> rs.<span style="color: #006633;">getString</span><span style="color: #009900;">&#40;</span>I<span style="color: #339933;">+</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">trim</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
						<span style="color: #000000; font-weight: bold;">else</span>
							s<span style="color: #009900;">&#91;</span>I<span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> rs.<span style="color: #006633;">getString</span><span style="color: #009900;">&#40;</span>I<span style="color: #339933;">+</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
					<span style="color: #009900;">&#125;</span>
					rc<span style="color: #339933;">++;</span>
					v.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span>s<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
				<span style="color: #009900;">&#125;</span>
				<span style="color: #666666; font-style: italic;">/* Ajout de ce Vecteur dans la HashTable */</span>
				h.<span style="color: #006633;">put</span><span style="color: #009900;">&#40;</span>queryName, v<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
				rs.<span style="color: #006633;">close</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #009900;">&#125;</span>
			stmt.<span style="color: #006633;">close</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #009900;">&#40;</span><span style="color: #003399;">SQLException</span> e<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			logger
					.<span style="color: #006633;">error</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;unable to fetch table [&quot;</span> <span style="color: #339933;">+</span> queryName <span style="color: #339933;">+</span> <span style="color: #0000ff;">&quot;] err : &quot;</span>
							<span style="color: #339933;">+</span> e<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #000000; font-weight: bold;">throw</span> e<span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">finally</span> <span style="color: #009900;">&#123;</span>
&nbsp;
		<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>rc <span style="color: #339933;">&gt;</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span>
			logger.<span style="color: #006633;">info</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Chargement de la table/query [&quot;</span> <span style="color: #339933;">+</span> queryName <span style="color: #339933;">+</span> <span style="color: #0000ff;">&quot;] : &quot;</span>
					<span style="color: #339933;">+</span> rc<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #000000; font-weight: bold;">return</span> rc<span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #008000; font-style: italic; font-weight: bold;">/**
	 * rechargement des données d'une liste
	 *
	 * @param String
	 *            tableName : Nom de la liste
	 * @param String
	 *            valeurs : liste des valeurs
	 *
	 * @return int rc : nombre d'enregistrements chargés
	 */</span>
	<span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">synchronized</span> <span style="color: #000066; font-weight: bold;">int</span> reloadListe<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span> tableName, <span style="color: #003399;">String</span> sql<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #666666; font-style: italic;">/* Si la table est déja chargé on la recharge */</span>
		freeTable<span style="color: #009900;">&#40;</span>tableName<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #000000; font-weight: bold;">return</span> loadListe<span style="color: #009900;">&#40;</span>tableName, sql<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #008000; font-style: italic; font-weight: bold;">/**
	 * rechargement des données d'une liste
	 *
	 * @param String
	 *            tableName : Nom de la liste
	 * @param String
	 *            valeurs : liste des valeurs
	 *
	 * @return int rc : nombre d'enregistrements chargés
	 */</span>
	<span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">synchronized</span> <span style="color: #000066; font-weight: bold;">int</span> loadListe<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span> tableName, <span style="color: #003399;">String</span> sql<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>isLoaded<span style="color: #009900;">&#40;</span>tableName<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
			<span style="color: #000000; font-weight: bold;">return</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span><span style="color: #003399;">Vector</span><span style="color: #009900;">&#41;</span> h.<span style="color: #006633;">get</span><span style="color: #009900;">&#40;</span>tableName<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">size</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #000066; font-weight: bold;">int</span> rc <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>
		<span style="color: #003399;">Vector</span> v <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">Vector</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">5</span>, <span style="color: #cc66cc;">2</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #003399;">StringTokenizer</span> stoken <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">StringTokenizer</span><span style="color: #009900;">&#40;</span>sql, <span style="color: #0000ff;">&quot;;&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #666666; font-style: italic;">/* Lecture des données et mémorisation dans un Vecteur */</span>
		<span style="color: #000000; font-weight: bold;">while</span> <span style="color: #009900;">&#40;</span>stoken.<span style="color: #006633;">hasMoreElements</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #003399;">String</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> s <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">String</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">2</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
			<span style="color: #003399;">String</span> token <span style="color: #339933;">=</span> stoken.<span style="color: #006633;">nextToken</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #000066; font-weight: bold;">int</span> i <span style="color: #339933;">=</span> token.<span style="color: #006633;">indexOf</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'='</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			s<span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> token.<span style="color: #006633;">substring</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">0</span>, i<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// cle</span>
			s<span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> token.<span style="color: #006633;">substring</span><span style="color: #009900;">&#40;</span>i <span style="color: #339933;">+</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// valeur</span>
			rc<span style="color: #339933;">++;</span>
			v.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span>s<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
		<span style="color: #666666; font-style: italic;">/* Ajout de ce Vecteur dans la HashTable */</span>
		h.<span style="color: #006633;">put</span><span style="color: #009900;">&#40;</span>tableName, v<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>rc <span style="color: #339933;">&gt;</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span>
			logger.<span style="color: #006633;">info</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Chargement de la table/liste [&quot;</span> <span style="color: #339933;">+</span> tableName <span style="color: #339933;">+</span> <span style="color: #0000ff;">&quot;] : &quot;</span>
					<span style="color: #339933;">+</span> rc<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #000000; font-weight: bold;">return</span> rc<span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #008000; font-style: italic; font-weight: bold;">/**
	 * Nombre de tables chargées
	 *
	 * @return int r : nombre de table
	 */</span>
	<span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">synchronized</span> <span style="color: #000066; font-weight: bold;">int</span> size<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">return</span> h.<span style="color: #006633;">size</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #008000; font-style: italic; font-weight: bold;">/**
	 * Test si une table est chargée
	 *
	 * @param String
	 *            tableName : Nom de la table
	 *
	 * @return boolean b : oui ou non...
	 */</span>
	<span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">synchronized</span> <span style="color: #000066; font-weight: bold;">boolean</span> isLoaded<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span> tableName<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">return</span> h.<span style="color: #006633;">containsKey</span><span style="color: #009900;">&#40;</span>tableName<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #008000; font-style: italic; font-weight: bold;">/**
	 * libération d'une table
	 *
	 * @param String
	 *            tableName : Nom de la table
	 */</span>
	<span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">synchronized</span> <span style="color: #000066; font-weight: bold;">void</span> freeTable<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span> tableName<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>h.<span style="color: #006633;">containsKey</span><span style="color: #009900;">&#40;</span>tableName<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
			h.<span style="color: #006633;">remove</span><span style="color: #009900;">&#40;</span>tableName<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #008000; font-style: italic; font-weight: bold;">/**
	 * Lecture des données d'une table
	 *
	 * @param String
	 *            tableName : Nom de la table
	 *
	 * @return Vector v : les données
	 */</span>
	<span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">synchronized</span> <span style="color: #003399;">Vector</span> getTable<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span> tableName<span style="color: #009900;">&#41;</span>
			<span style="color: #000000; font-weight: bold;">throws</span> <span style="color: #003399;">SQLException</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">return</span> <span style="color: #009900;">&#40;</span><span style="color: #003399;">Vector</span><span style="color: #009900;">&#41;</span> h.<span style="color: #006633;">get</span><span style="color: #009900;">&#40;</span>tableName<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #008000; font-style: italic; font-weight: bold;">/**
	 * Formatage des données d'une table sous forme d'une combobox
	 *
	 * @param String
	 *            tableName : Nom de la table
	 * @param String
	 *            val : Valeur selectionnée
	 *
	 * @return String s : les données (format : &amp;lt;option ... )
	 */</span>
	<span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">synchronized</span> <span style="color: #003399;">String</span> getListe<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span> tableName, <span style="color: #003399;">String</span> val<span style="color: #009900;">&#41;</span>
			<span style="color: #000000; font-weight: bold;">throws</span> <span style="color: #003399;">SQLException</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #003399;">StringBuffer</span> sb <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">StringBuffer</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #003399;">Vector</span> v <span style="color: #339933;">=</span> getTable<span style="color: #009900;">&#40;</span>tableName<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>v <span style="color: #339933;">!=</span> <span style="color: #000066; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #000066; font-weight: bold;">int</span> K <span style="color: #339933;">=</span> v.<span style="color: #006633;">size</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #003399;">String</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> s<span style="color: #339933;">;</span>
			<span style="color: #000000; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> I <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span> I <span style="color: #339933;">&lt;</span> K<span style="color: #339933;">;</span> I<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
				s <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> v.<span style="color: #006633;">elementAt</span><span style="color: #009900;">&#40;</span>I<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
				<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>s.<span style="color: #006633;">length</span> <span style="color: #339933;">&gt;</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
					<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>s<span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span>.<span style="color: #006633;">equals</span><span style="color: #009900;">&#40;</span>val<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
						sb.<span style="color: #006633;">append</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;&lt;option value=<span style="color: #000099; font-weight: bold;">\&quot;</span>&quot;</span> <span style="color: #339933;">+</span> s<span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">+</span> <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\&quot;</span> selected&gt;&quot;</span>
								<span style="color: #339933;">+</span> s<span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">+</span> <span style="color: #0000ff;">&quot;&lt;/option&gt;<span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
					<span style="color: #000000; font-weight: bold;">else</span>
						sb.<span style="color: #006633;">append</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;&lt;option value=<span style="color: #000099; font-weight: bold;">\&quot;</span>&quot;</span> <span style="color: #339933;">+</span> s<span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">+</span> <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\&quot;</span>&gt;&quot;</span> <span style="color: #339933;">+</span> s<span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span>
								<span style="color: #339933;">+</span> <span style="color: #0000ff;">&quot;&lt;/option&gt;<span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
				<span style="color: #009900;">&#125;</span>
			<span style="color: #009900;">&#125;</span>
		<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #000000; font-weight: bold;">return</span> sb.<span style="color: #006633;">toString</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #008000; font-style: italic; font-weight: bold;">/**
	 * Formatage des données d'une table sous forme de radio boutons
	 *
	 * @param String :
	 *            Nom de la zone HTML (name = )
	 * @param String
	 *            tableName : Nom de la table
	 * @param String
	 *            val : Valeur selectionnée
	 * @param String
	 *            after : Le code html a ajouter apres chaque ligne
	 *            (&amp;lt;br/&amp;gt;)
	 *
	 * @return String s : les données (format : &amp;lt;option ... )
	 */</span>
	<span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">synchronized</span> <span style="color: #003399;">String</span> getRadio<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span> nm, <span style="color: #003399;">String</span> tableName,
			<span style="color: #003399;">String</span> val, <span style="color: #003399;">String</span> after<span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">throws</span> <span style="color: #003399;">SQLException</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #003399;">StringBuffer</span> sb <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">StringBuffer</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #003399;">Vector</span> v <span style="color: #339933;">=</span> getTable<span style="color: #009900;">&#40;</span>tableName<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>after <span style="color: #339933;">==</span> <span style="color: #000066; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span>
			after <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>v <span style="color: #339933;">!=</span> <span style="color: #000066; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #000066; font-weight: bold;">int</span> K <span style="color: #339933;">=</span> v.<span style="color: #006633;">size</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #003399;">String</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> s<span style="color: #339933;">;</span>
			<span style="color: #000000; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> I <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span> I <span style="color: #339933;">&lt;</span> K<span style="color: #339933;">;</span> I<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
				s <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> v.<span style="color: #006633;">elementAt</span><span style="color: #009900;">&#40;</span>I<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
				<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>s.<span style="color: #006633;">length</span> <span style="color: #339933;">&gt;</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
					sb.<span style="color: #006633;">append</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;&lt;input type=<span style="color: #000099; font-weight: bold;">\&quot;</span>RADIO<span style="color: #000099; font-weight: bold;">\&quot;</span> name=<span style="color: #000099; font-weight: bold;">\&quot;</span>&quot;</span> <span style="color: #339933;">+</span> nm <span style="color: #339933;">+</span> <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\&quot;</span> id=<span style="color: #000099; font-weight: bold;">\&quot;</span>&quot;</span>
							<span style="color: #339933;">+</span> nm <span style="color: #339933;">+</span> <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\&quot;</span> value=<span style="color: #000099; font-weight: bold;">\&quot;</span>&quot;</span> <span style="color: #339933;">+</span> s<span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">+</span> <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\&quot;</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
					<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>s<span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span>.<span style="color: #006633;">equals</span><span style="color: #009900;">&#40;</span>val<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
						sb.<span style="color: #006633;">append</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot; checked&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
					sb.<span style="color: #006633;">append</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;&gt;&quot;</span> <span style="color: #339933;">+</span> s<span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">+</span> <span style="color: #0000ff;">&quot;&lt;/input&gt;&quot;</span> <span style="color: #339933;">+</span> after<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
				<span style="color: #009900;">&#125;</span>
			<span style="color: #009900;">&#125;</span>
		<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #000000; font-weight: bold;">return</span> sb.<span style="color: #006633;">toString</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #008000; font-style: italic; font-weight: bold;">/**
	 * Lecture d'une valeur
	 *
	 * @param String
	 *            tableName : Nom de la table
	 * @param String
	 *            val : Valeur selectionnée
	 *
	 * @return String s : le libelle
	 */</span>
	<span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">synchronized</span> <span style="color: #003399;">String</span> getValue<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span> tableName, <span style="color: #003399;">String</span> val<span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">throws</span> <span style="color: #003399;">SQLException</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #003399;">String</span> r <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">;</span>
		<span style="color: #003399;">Vector</span> v <span style="color: #339933;">=</span> getTable<span style="color: #009900;">&#40;</span>tableName<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>v <span style="color: #339933;">!=</span> <span style="color: #000066; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #000066; font-weight: bold;">int</span> K <span style="color: #339933;">=</span> v.<span style="color: #006633;">size</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #003399;">String</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> s<span style="color: #339933;">;</span>
			<span style="color: #000000; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> I <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span> I <span style="color: #339933;">&lt;</span> K<span style="color: #339933;">;</span> I<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
				s <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> v.<span style="color: #006633;">elementAt</span><span style="color: #009900;">&#40;</span>I<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
				<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>s.<span style="color: #006633;">length</span> <span style="color: #339933;">&gt;</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
					<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>s<span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span>.<span style="color: #006633;">equals</span><span style="color: #009900;">&#40;</span>val<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
						r <span style="color: #339933;">=</span> s<span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
						<span style="color: #000000; font-weight: bold;">break</span><span style="color: #339933;">;</span>
					<span style="color: #009900;">&#125;</span>
				<span style="color: #009900;">&#125;</span>
			<span style="color: #009900;">&#125;</span>
		<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #000000; font-weight: bold;">return</span> r<span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://www.berthou.com/us/2008/02/09/memorytable-to-simplify-the-values-listes-gestion/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Sun Acquires MySQL / Oracle Acquires BEA</title>
		<link>http://www.berthou.com/us/2008/01/16/www-sun-to-acquire-mysql/</link>
		<comments>http://www.berthou.com/us/2008/01/16/www-sun-to-acquire-mysql/#comments</comments>
		<pubDate>Wed, 16 Jan 2008 17:33:14 +0000</pubDate>
		<dc:creator>rberthou</dc:creator>
				<category><![CDATA[java]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[www]]></category>

		<guid isPermaLink="false">http://www.berthou.com/us/2008/01/16/www-sun-to-acquire-mysql/</guid>
		<description><![CDATA[After some rumors, Sun announces an agreement to acquire MySql and Oracle announced that it has entered into an agreement to acquire BEA Systems, Inc. It will give to Sun a popular database missing from its catalogue and it&#8217;s a very good database&#8230; More informations on this news - http://www.mysql.com/news-and-events/ - http://www.oracle.com/bea/index.html]]></description>
				<content:encoded><![CDATA[<p><img src="/_img/sun_mysql.png" class="right" /><br />
After some rumors, Sun announces an agreement to acquire MySql and Oracle announced that it has entered into an agreement to acquire BEA Systems, Inc.</p>
<p>It will give to Sun a popular database missing from its catalogue and it&#8217;s a very good database&#8230;</p>
<p>More informations on this news<br />
- <a href="http://www.mysql.com/news-and-events/sun-to-acquire-mysql.html" target="_blank">http://www.mysql.com/news-and-events/</a><br />
- <a href="http://www.oracle.com/bea/index.html" target="_blank">http://www.oracle.com/bea/index.html</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.berthou.com/us/2008/01/16/www-sun-to-acquire-mysql/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>aTicker &#8211; applet</title>
		<link>http://www.berthou.com/us/2007/12/18/aticker-applet/</link>
		<comments>http://www.berthou.com/us/2007/12/18/aticker-applet/#comments</comments>
		<pubDate>Tue, 18 Dec 2007 21:51:57 +0000</pubDate>
		<dc:creator>rberthou</dc:creator>
				<category><![CDATA[applet]]></category>
		<category><![CDATA[exemple]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[source]]></category>

		<guid isPermaLink="false">http://www.berthou.com/us/2007/12/18/aticker-applet/</guid>
		<description><![CDATA[Description aTicker is a simple, free and small Ticker texte scrolling Applet. aTicker runs on all browsers with JDK 1.1x support. (aTicker is free with all source code). This applet is available in JDK 1.1x Source HTML &#60;applet codebase="/jar" archive="applet-aticker.jar" code="com.berthou.applet.aticker.aticker.class" width=220 height=20 mayscript&#62; &#60;param name=file value="s"&#62; &#60;param name=cSep value="§"&#62; &#60;param name="speed" value="1"&#62; &#60;param name="delay" [...]]]></description>
				<content:encoded><![CDATA[<h2 class="titre2">Description</h2>
<p>aTicker is a simple, free and small Ticker texte scrolling Applet. aTicker runs on all browsers with JDK 1.1x support. (aTicker is free with all source code).<br />
This applet is available in JDK 1.1x</p>
<p><center><br />
<applet codebase="/jar" archive="applet-aticker.jar" code="com.berthou.applet.aticker.aticker.class" width=220 height=20 MAYSCRIPT></p>
<param name=file value="s">
<param name=cSep value="§">
<param name="speed" value="1">
<param name="delay" value="30">
<param name="local" value="true">
<param name="bgcolor" value="13693183">
<param name="Font1" value="Verdana, 14, 0, 0">
<param name="Font2" value="Verdana, 14, 1, 1220">
<param name="s0" value="JavaSide § http://www.javaside.com § _load">
<param name="s1" value="Mess 2 § javascript:alert('Salut...') § _script § ?PopupJavascript">
<param name="s2" value="berthou-fr § http://www.berthou.com/fr/ § _load">
<param name="s3" value="berthou-us § http://www.berthou.com/us/ § _load">
</applet></p>
<p></center></p>
<h2 class="titre2">Source HTML</h2>
<pre class="alertCode">
&lt;applet codebase="/jar" archive="applet-aticker.jar" code="com.berthou.applet.aticker.aticker.class" width=220 height=20 mayscript&gt;
	&lt;param name=file value="s"&gt;
	&lt;param name=cSep value="§"&gt;
	&lt;param name="speed" value="1"&gt;
	&lt;param name="delay" value="30"&gt;
	&lt;param name="local" value="true"&gt;
	&lt;param name="bgcolor" value="13693183"&gt;
	&lt;param name="Font1" value="Verdana, 14, 0, 0"&gt;
	&lt;param name="Font2" value="Verdana, 14, 1, 1220"&gt;
	&lt;param name="s0" value="JavaSide § http://www.javaside.com § _load"&gt;
	&lt;param name="s1" value="Mess 2 § javascript:alert('Salut...') § _script § ?PopupJavascript"&gt;
	&lt;param name="s2" value="berthou-fr § http://www.berthou.com/fr/ § _load"&gt;
	&lt;param name="s3" value="berthou-us § http://www.berthou.com/us/ § _load"&gt;
&lt;/applet&gt;
</pre>
<p><span id="more-29"></span></p>
<h2 class="titre2">Parameters</h2>
<table class="tbl0" >
<thead>
<tr class="rh">
<th>Param name</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr class="r1">
<td>file</td>
<td>string</td>
<td>Data file or prefix pour &#8220;line param&#8221;</td>
</tr>
<tr class="r2">
<td>cSep</td>
<td>char</td>
<td>text delimiteur (defaut &#8220;;&#8221;)</td>
</tr>
<tr class="r1">
<td>speed</td>
<td>integer</td>
<td>vitesse de defilement (1)</td>
</tr>
<tr class="r2">
<td>local</td>
<td>String</td>
<td>&#8220;true&#8221; : to read datas in parameters (no external data file)</td>
</tr>
<tr class="r1">
<td>delay</td>
<td>integer</td>
<td>mili-secs entre 2 affichages (100)</td>
</tr>
<tr class="r2">
<td>bgcolor</td>
<td>integer</td>
<td>Background color (en decimal)</td>
</tr>
<tr class="r1">
<td>Font1</td>
<td>String</td>
<td>Definition de la police : Face, Size, Style, color</td>
</tr>
<tr class="r2">
<td>Font2</td>
<td>String</td>
<td>Definition de la police active: Face, Size, Style, color</td>
</tr>
</tbody>
</table>
<h2 class="titre2">Data file</h2>
<p>You can define your data in external file (static or dynamique PHP, ASP, ..) you must remove &#8220;local&#8221; parameter to use an external file</p>
<table class="tbl0">
<thead class="rh">
<tr>
<th>Col</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr class="r1">
<td>1 Message</td>
<td>string</td>
<td>message</td>
</tr>
<tr class="r2">
<td>2 URL</td>
<td>string</td>
<td>Link URL<br /> si &#8220;&#8211;&#8221; pas de lien</td>
</tr>
<tr class="r1">
<td>3 Target</td>
<td>string</td>
<td>utiliser _script pour un appel javascript</td>
</tr>
<tr class="r2">
<td>4 Status line</td>
<td>String</td>
<td>Message affiché dans la ligne de &#8220;status&#8221;</td>
</tr>
</tbody>
</table>
<h2 class="titre2">Download</h2>
<p class="alertDownload">
<a href="/download.php?type=java&#038;file=aticker.zip">aticker.zip</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.berthou.com/us/2007/12/18/aticker-applet/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MS CAPI and Java (JCE SunMSCAPI)</title>
		<link>http://www.berthou.com/us/2007/12/05/ms-capi-and-java-jce-sunmscapi/</link>
		<comments>http://www.berthou.com/us/2007/12/05/ms-capi-and-java-jce-sunmscapi/#comments</comments>
		<pubDate>Wed, 05 Dec 2007 21:20:37 +0000</pubDate>
		<dc:creator>rberthou</dc:creator>
				<category><![CDATA[java]]></category>
		<category><![CDATA[certificat]]></category>
		<category><![CDATA[jce]]></category>

		<guid isPermaLink="false">http://www.berthou.com/us/2007/12/05/ms-capi-and-java-jce-sunmscapi/</guid>
		<description><![CDATA[Description This news is the following of &#8220;How to signing a PDF with Java&#8221; I continu my research to use certificate available in the MS Windows Keystrore.I wanted to use a certificate stored in a card (use for MS Windows signe on). Thanks to these researchs I discovered that with JDK 6 it is very [...]]]></description>
				<content:encoded><![CDATA[<h2 class="titre2">Description</h2>
<p>This news is the following of <a href="http://www.berthou.com/us/?p=18">&#8220;How to signing a PDF with Java&#8221;</a><br />
<br/><br />
I continu my research to use certificate available in the MS Windows Keystrore.I wanted to use a certificate stored in a card (use for MS Windows signe on).<br />
<br/><br />
Thanks to these researchs I discovered that with JDK 6 it is very simple to  use the <a href="http://en.wikipedia.org/wiki/Cryptographic_API" target="_blank"><b>MSCAPI</b></a>&#8216;s API .<br />
<span id="more-23"></span><br />
With Java SE 6 you have a large choice of tools and it is configurate with most of crypto &#8220;providers&#8221; as <b>SunMSCAPI Provider</b> (see $JRE_HOME/lib/security/java.security ).</p>
<pre class="alertCode">
#
# List of providers and their preference orders (see above):
#
security.provider.1=sun.security.provider.Sun
security.provider.2=sun.security.rsa.SunRsaSign
security.provider.3=com.sun.net.ssl.internal.ssl.Provider
security.provider.4=com.sun.crypto.provider.SunJCE
security.provider.5=sun.security.jgss.SunProvider
security.provider.6=com.sun.security.sasl.Provider
security.provider.7=org.jcp.xml.dsig.internal.dom.XMLDSigRI
security.provider.8=sun.security.smartcardio.SunPCSC
security.provider.9=sun.security.mscapi.SunMSCAPI
</pre>
<h2 class="titre2">Services supported by SunMSCAPI</h2>
<table class=tbl0>
<thead class="rh">
<tr>
<th>Type</th>
<th>Name</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr class="r1">
<td>KeyPairGenerator</td>
<td>
<ul>
<li>RSA</li>
</ul>
</td>
<td>Generates RSA key pairs needed by other cryptographic services such as Signature and Cipher.</td>
</tr>
<tr class="r2">
<td>Signature</td>
<td>
<ul>
<li>SHA1withRSA</li>
<li>MD5withRSA</li>
<li>MD2withRSA</li>
</ul>
</td>
<td>Creates and validates signatures using various message digest and encryption algorithm as specified in the service name.</td>
</tr>
<tr class="r1">
<td>Cipher</td>
<td>
<ul>
<li>RSA</li>
<li>RSA/ECB/PKCS1Padding</li>
</ul>
</td>
<td>Performs RSA encryption and decryption.</td>
</tr>
<tr class="r2">
<td>KeyStore</td>
<td>
<ul>
<li>Windows-MY</li>
<li>Windows-ROOT</li>
</ul>
</td>
<td>Provides direct read-write access to MS Window&#8217;s keystores. The Windows-MY keystore contains the user&#8217;s private keys and the associated certificate chains. The Windows-ROOT keystore contains all root CA certificates trusted by the machine.</td>
</tr>
<tr class="r1">
<td>SecureRandom</td>
<td>
<ul>
<li>Windows-PRNG</li>
</ul>
</td>
<td>Generates random numbers for the random data that other cryptographic services need.</td>
</tr>
</tbody>
</table>
<p class="alertWarning">
Warning :By using this API I saw that the PIN&#8217;s code is asked even if you pass it in the code.  (I think it should be a bug in drivers card readers) .
</p>
<p><br/></p>
<h2 class="titre2">Exemple</h2>

<div class="wp_syntax"><table><tr><td class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">try</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #003399;">KeyStore</span> ks <span style="color: #339933;">=</span> <span style="color: #003399;">KeyStore</span>.<span style="color: #006633;">getInstance</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Windows-ROOT&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	ks.<span style="color: #006633;">load</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">null</span>, <span style="color: #000066; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">;</span>
	java.<span style="color: #006633;">util</span>.<span style="color: #003399;">Enumeration</span> en <span style="color: #339933;">=</span> ks.<span style="color: #006633;">aliases</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">while</span> <span style="color: #009900;">&#40;</span>en.<span style="color: #006633;">hasMoreElements</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #003399;">String</span> aliasKey <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span><span style="color: #009900;">&#41;</span>en.<span style="color: #006633;">nextElement</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">;</span>
		<span style="color: #003399;">Certificate</span> c <span style="color: #339933;">=</span> ks.<span style="color: #006633;">getCertificate</span><span style="color: #009900;">&#40;</span>aliasKey<span style="color: #009900;">&#41;</span> <span style="color: #339933;">;</span>
		<span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;---&gt; alias : &quot;</span> <span style="color: #339933;">+</span> sss<span style="color: #009900;">&#41;</span> <span style="color: #339933;">;</span>
		<span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;    Certificat : &quot;</span> <span style="color: #339933;">+</span> c.<span style="color: #006633;">toString</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>aliasKey.<span style="color: #006633;">equals</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;myKey&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		      <span style="color: #003399;">PrivateKey</span> key <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #003399;">PrivateKey</span><span style="color: #009900;">&#41;</span>ks.<span style="color: #006633;">getKey</span><span style="color: #009900;">&#40;</span>aliasKey, <span style="color: #0000ff;">&quot;monPassword&quot;</span>.<span style="color: #006633;">toCharArray</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		      <span style="color: #003399;">Certificate</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> chain <span style="color: #339933;">=</span> ks.<span style="color: #006633;">getCertificateChain</span><span style="color: #009900;">&#40;</span>aliasKey<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #009900;">&#40;</span><span style="color: #003399;">Exception</span> ioe<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #003399;">System</span>.<span style="color: #006633;">err</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span>ioe.<span style="color: #006633;">getMessage</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p class="alertLink">
<b>Voir aussi</b><br />
<a href="http://java.sun.com/developer/technicalArticles/J2SE/security/" target="_blank">http://java.sun.com/developer/technicalArticles/J2SE/security/</a><br />
<a href="http://java.sun.com/javase/6/docs/technotes/guides/security/crypto/CryptoSpec.html" target="_blank">http://java.sun.com/javase/6/docs/technotes/guides/security/crypto/CryptoSpec.html</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.berthou.com/us/2007/12/05/ms-capi-and-java-jce-sunmscapi/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>aDraw &#8211; Drawing Applet</title>
		<link>http://www.berthou.com/us/2007/12/01/adraw-drawing-applet/</link>
		<comments>http://www.berthou.com/us/2007/12/01/adraw-drawing-applet/#comments</comments>
		<pubDate>Sat, 01 Dec 2007 22:36:02 +0000</pubDate>
		<dc:creator>rberthou</dc:creator>
				<category><![CDATA[applet]]></category>
		<category><![CDATA[java]]></category>

		<guid isPermaLink="false">http://www.berthou.com/us/?p=21</guid>
		<description><![CDATA[Index Applet aDraw description Sample use (with save option) Description aDraw is a drawing java applet including a save option with acxImage and jspImage components or a php script. It works on all the navigators supporting the JDK 1.1. With this java applet you can easily include a drawing option in your Internet or Intranet [...]]]></description>
				<content:encoded><![CDATA[<h2 class="titre2">Index</h2>
<ul>
<li>Applet aDraw description</li>
<li><a href="?p=22">Sample use (with save option)</a></li>
</ul>
<h2 class="titre2">Description</h2>
<p>aDraw is a drawing java applet including a save option with acxImage and jspImage components or a php script. It works on all the navigators supporting the JDK 1.1. With this java applet you can easily include a drawing option in your Internet or Intranet site.<br />
<img src="/_img/adraw.png" class="center"/></p>
<h2 class="titre2">Download</h2>
<p class="alertDownload"><a href="/download.php?type=java&#038;file=adraw.zip">aDraw.zip</a></p>
<h2 class="titre2">News</h2>
<p class="titre3">Version 2.00 </p>
<ul>
<li>Add arrow on lines  </li>
<li>Add background image </li>
<li>Add symbol object&#8230;  </li>
</ul>
<p><span id="more-21"></span></p>
<h2 class="titre2">Enregistrement</h2>
<p>aDraw is a FreeWare for non commercial site.<br />
For personnal use you want add a reference to me (my URL page) and send to me your URL (with aDraw applet).<br />
For a professional use you want get a &#8220;professional registration&#8221;. With this registration you can use aDraw with no reference to me and i send to you all aDraw source.<br />
For more information on &#8220;Professional registration&#8221; you can use this form :<br />
<div id="wpcf"><fieldset><legend>Contact Form</legend><form action="http://www.berthou.com/us/2007/12/01/adraw-drawing-applet/" name="wpcf_form" method="post"><input type="hidden" value="process" name="wpcf_stage"/><p><label for="wpcf_your_name">Your Name:</label><input class="field" type="text" name="wpcf_your_name" id="wpcf_your_name" maxlength="50" tabindex="11" value="" /></p><p><label for="wpcf_email">Your Email:</label><input class="field" type="text" name="wpcf_email" id="wpcf_email" maxlength="50" tabindex="12" value="" /></p><p><label>Challenge:</label><span class="challenge">(no spam question) 4 + 2 =</span></p><p><label for="wpcf_response">Answer:</label><input class="field" type="text" name="wpcf_response" id="wpcf_response" maxlength="50" tabindex="13" value="" /></p><p><label for="wpcf_website">Your Website:</label><input class="field" type="text" name="wpcf_website" id="wpcf_website" maxlength="100" tabindex="14" value="" /></p><p><label for="wpcf_usersubject">Subject:</label><input class="field" type="text" name="wpcf_usersubject" id="wpcf_usersubject" tabindex="15" maxlength="50" value="" /></p><p><label for="wpcf_msg">Your Message:</label><textarea name="wpcf_msg" id="wpcf_msg" cols="" rows="" tabindex="16"></textarea></p><p class="button"><input id="contactsubmit" type="submit" value="Submit" tabindex="18" name="Submit"/></p></form></fieldset></div></p>
<h2 class="titre2">HTML Source </h2>
<p class="alertCode">
&lt;applet code=&#8221;aDraw.class&#8221; archive=&#8221;aDraw.jar&#8221; width=&#8221;520&#8243; height=&#8221;330&#8243; MAYSCRIPT name=&#8221;aDraw&#8221;&gt;<br />
&nbsp; &nbsp; &lt;param name=&#8221;url&#8221; value=&#8221;javascript:test();&#8221;&gt;<br />
&nbsp; &nbsp; &lt;param name=&#8221;save&#8221; value=&#8221;yes&#8221;&gt;<br />
&nbsp; &nbsp; &lt;param name=&#8221;bgcolor&#8221; value=&#8221;#D0D0D0&#8243;&gt;<br />
&nbsp; &nbsp; &lt;param name=&#8221;image&#8221; value=&#8221;CN_1.gif&#8221;&gt;<br />
&nbsp; &nbsp; &lt;param name=&#8221;symbol&#8221; value=&#8221;s&#8221;&gt;<br />
&nbsp; &nbsp; &lt;param name=&#8221;sizeW&#8221; value=&#8221;430&#8243;&gt;<br />
&nbsp; &nbsp; &lt;param name=&#8221;sizeH&#8221; value=&#8221;250&#8243;&gt;<br />
&nbsp; &nbsp; &lt;param name=&#8221;bouton&#8221; value=&#8221;bouton.gif&#8221;&gt;<br />
&lt;/applet&gt;
</p>
<h2 class="titre2">Parameters</h2>
<table class="tbl1">
<thead class="rh">
<tr>
<th>Param name</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr class="r1">
<td>save</td>
<td>string</td>
<td>If this parameter is define a &#8220;Save&#8221; button is show in the applet with parameter value for label.</td>
</tr>
<tr class="r2">
<td>bgcolor</td>
<td>integer</td>
<td>Define background color (start by &#8220;#&#8221; if hexa).</td>
</tr>
<tr class="r1">
<td>bouton</td>
<td>string</td>
<td>relative URL for gif button definition (default &#8220;bouton.gif&#8221;)</td>
</tr>
<tr class="r2">
<td>url</td>
<td>string</td>
<td>This URL string define &#8220;Save&#8221; action. You can call URL or javascript function.<br />
Sample :
<ul>
<li>&lt;param name=&#8221;url&#8221; value=&#8221;http://www.mycgiserver.com/~javaside/aDraw.jsp&#8221;&gt;</li>
<li>&lt;param name=&#8221;url&#8221; value=&#8221;http://www.berthou.com/adraw/save.php&#8221;&gt;</li>
<li>&lt;param name=&#8221;url&#8221; value=&#8221;javascript:sauvegarde();&#8221;&gt;</li>
</td>
</tr>
<tr class="r1">
<td>image</td>
<td>string</td>
<td>background image</td>
</tr>
<tr class="r2">
<td>symbol</td>
<td>string</td>
<td>relative or absolute URL for symbols ( with &#8220;../img/tot&#8221; the applet read &#8220;../img/tot0.gif &#8230; &#8220;../img/tot9.gif&#8221; for symbol and &#8220;../img/tot0s.gif &#8230; &#8220;../img/tot9s.gif&#8221; for icon images</td>
</tr>
<tr class="r1">
<td>sizeW</td>
<td>integer</td>
<td>Size width drawing surface</td>
</tr>
<tr class="r2">
<td>sizeH</td>
<td>integer</td>
<td>Size height drawing surface</td>
</tr>
</tbody>
</table>
<h2 class="titre2">Utilisation</h2>
<table class="tbl1">
<thead class="rh">
<tr>
<th>Image</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr class="r1">
<td class="tdc"><img src="/_img/adraw_0.gif"></td>
<td>Active foreground and background color. You can change there colors with color palet.</td>
</tr>
<tr class="r2">
<td class="tdc"><img src="/_img/adraw_1.gif"></td>
<td>Pencil : Can use forground or background color with right or left mouse button, and you can change the line size.</td>
</tr>
<tr class="r1">
<td class="tdc"><img src="/_img/adraw_2.gif"></td>
<td>Line : Can use forground or background color with right or left mouse button, and you can change the line size.</td>
</tr>
<tr class="r2">
<td class="tdc"><img src="/_img/adraw_3.gif"></td>
<td>Gum : Erase drawing with background color.</td>
</tr>
<tr class="r1">
<td class="tdc"><img src="/_img/adraw_4.gif"></td>
<td>Text : To draw a text.</td>
</tr>
<tr class="r2">
<td class="tdc"><img src="/_img/adraw_5.gif"></td>
<td>Rectangle.</td>
</tr>
<tr class="r1">
<td class="tdc"><img src="/_img/adraw_6.gif"></td>
<td>Oval.</td>
</tr>
<tr class="r2">
<td class="tdc"><img src="/_img/adraw_7.gif"></td>
<td>Fill function .</td>
</tr>
<tr class="r1">
<td class="tdc"><img src="/_img/adraw_8.gif"></td>
<td>Change size line for pencil and line functions.</td>
</tr>
<tr class="r2">
<td class="tdc"><img src="/_img/adraw_9.gif"></td>
<td>Erase all drawing ( !! Warning : no alert message ).</td>
</tr>
<tr class="r1">
<td class="tdc"></td>
<td><img src="/_img/adraw_10.gif"><br/>Color palet.</td>
</tr>
<tr class="r2">
<td></td>
<td><img src="/_img/adraw_11.gif"><br/>Font selection and input zone.</td>
</tr>
</tbody>
</table>
]]></content:encoded>
			<wfw:commentRss>http://www.berthou.com/us/2007/12/01/adraw-drawing-applet/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>tChart</title>
		<link>http://www.berthou.com/us/2007/11/01/tchart/</link>
		<comments>http://www.berthou.com/us/2007/11/01/tchart/#comments</comments>
		<pubDate>Thu, 01 Nov 2007 21:18:28 +0000</pubDate>
		<dc:creator>rberthou</dc:creator>
				<category><![CDATA[applet]]></category>
		<category><![CDATA[java]]></category>

		<guid isPermaLink="false">http://www.berthou.com/us/?p=6</guid>
		<description><![CDATA[Description tChart is a Chart Applet. The applet&#8217;s size is very small (14Ko&#8230;25Ko). tChart runs on all browsers with JDK 1.1 support (or greater). tChart is a simple sample of my cChart Component. With tChart you can draw : Bars, lines, pies, data tables, Area&#8230; Download tChart.zip News V5.31 Version V 5.31 Correct a small [...]]]></description>
				<content:encoded><![CDATA[<p><a title="_0" name="_0"></a></p>
<h2 class="titre2">Description</h2>
<p>
tChart is a <b>Chart Applet</b>. The applet&#8217;s size is very small (14Ko&#8230;25Ko). tChart runs on all browsers with JDK 1.1 support (or greater).<br />
tChart is a simple sample of my cChart Component. With tChart you can draw : Bars, lines, pies, data tables, Area&#8230;</p>
<p><img src="/_img/tchart.png" class="center"/></p>
<h2 class="titre2">Download</h2>
<p class="alertDownload">
<a href="/download.php?type=java&#038;file=tchart.zip">tChart.zip</a>
</p>
<h2 class="titre2">News V5.31</h2>
<p class="titre3">Version V 5.31</p>
<ul>
<li>Correct a small bug (when all values < 0)</li>
</ul>
<p class="titre3">Version 5.30</p>
<ul>
<li>add new presentation mode (point mode &#8220;8&#8243;)</li>
<li>Can change color in line</li>
<li>restore bgimg option and add center right and mosaic options</li>
<li>add javascript&#8217;s functions</li>
<li>and more&#8230;.</li>
</ul>
<p class="titre3">Version 5.20</p>
<ul>
<li>Rotate Texte in label and Ox axe</li>
<li>add tChart4 with auto-refresh</li>
<li>can change origine position</li>
<li>can change all font</li>
<li>add public method to addRow in javascript</li>
<li>change presentation in line and NAN value</li>
</ul>
<p><span id="more-6"></span></p>
<p><a title="_1" name="_1"></a></p>
<p class="titre2">Enregistrement</p>
<p>tChart is FreeWare for non commercial sites.<br />
For personal use, please add a link on your site back to my Home Page (http://www.javaside.com/) and send me the URL where you wish to place the tChart applet.<br />
For professional / commercial use, you will need to obtain a &#8220;professional registration&#8221;. With this registration you can use tChart with no reference to me and I will send you the complete tChart and cChart source.<br/><br />
If you want to use cChart in another Applet or application, then you must obtain a &#8220;professionnal registration&#8221;.<br />
For more information about <strong>&#8220;Professional registration&#8221;</strong> : <div id="wpcf"><fieldset><legend>Contact Form</legend><form action="http://www.berthou.com/us/2007/11/01/tchart/" name="wpcf_form" method="post"><input type="hidden" value="process" name="wpcf_stage"/><p><label for="wpcf_your_name">Your Name:</label><input class="field" type="text" name="wpcf_your_name" id="wpcf_your_name" maxlength="50" tabindex="11" value="" /></p><p><label for="wpcf_email">Your Email:</label><input class="field" type="text" name="wpcf_email" id="wpcf_email" maxlength="50" tabindex="12" value="" /></p><p><label>Challenge:</label><span class="challenge">(no spam question) 4 + 2 =</span></p><p><label for="wpcf_response">Answer:</label><input class="field" type="text" name="wpcf_response" id="wpcf_response" maxlength="50" tabindex="13" value="" /></p><p><label for="wpcf_website">Your Website:</label><input class="field" type="text" name="wpcf_website" id="wpcf_website" maxlength="100" tabindex="14" value="" /></p><p><label for="wpcf_usersubject">Subject:</label><input class="field" type="text" name="wpcf_usersubject" id="wpcf_usersubject" tabindex="15" maxlength="50" value="" /></p><p><label for="wpcf_msg">Your Message:</label><textarea name="wpcf_msg" id="wpcf_msg" cols="" rows="" tabindex="16"></textarea></p><p class="button"><input id="contactsubmit" type="submit" value="Submit" tabindex="18" name="Submit"/></p></form></fieldset></div>
</p>
<p class="titre2">HTML Source</p>
<pre language="HTML">
&lt;applet code="tchart.class" width=550 height=380&gt;
   &lt;param name=bgImg value="./f_2.gif"&gt;
   &lt;param name=font value="Dialog,0,8"&gt;
   &lt;param name=fontL value="Arial,1,14"&gt;
   &lt;param name=fontT value="Arial,3,16"&gt;
   &lt;param name=origine value="50,80"&gt;
   &lt;param name=bgcolor value=14737632&gt;
   &lt;param name=frame value=25&gt;
&lt;/applet&gt;
</pre>
<p class="titre2">Parameters</p>
<table class="tbl1">
<thead class="rh">
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr class="r1">
<td>csep</td>
<td>char</td>
<td>char separator (default &#8216;;&#8217;)</td>
</tr>
<tr class="r2">
<td>file</td>
<td>string</td>
<td>File (with link to data file) use &#8220;./&#8221; for relative URL (default file.txt)</td>
</tr>
<tr class="r1">
<td>actif</td>
<td>integer</td>
<td>number of actif data file (default 0)</td>
</tr>
<tr class="r2">
<td>bgImg</td>
<td>string</td>
<td>Name of background image</td>
</tr>
<tr class="r1">
<td>cbg</td>
<td>char</td>
<td>background disposition R / L / M / C</td>
</tr>
<tr class="r2">
<td>bgcolor</td>
<td>integer</td>
<td>Border color rrggbb info (#FFFFFF)</td>
</tr>
<tr class="r1">
<td>lgcolor</td>
<td>integer</td>
<td>Line color rrggbb info (#FFFFFF)</td>
</tr>
<tr class="r2">
<td>font</td>
<td>text</td>
<td>Font bullet definition format : &#8220;name,style,size&#8221;</td>
</tr>
<tr class="r1">
<td>fontT</td>
<td>text</td>
<td>Font Title definition format : &#8220;name,style,size&#8221;</td>
</tr>
<tr class="r2">
<td>fontL</td>
<td>text</td>
<td>Font Legend definition format : &#8220;name,style,size&#8221;</td>
</tr>
<tr class="r1">
<td>origine</td>
<td>text</td>
<td>origine position format : &#8220;X,Y&#8221; default &#8220;40,40&#8243;</td>
</tr>
<tr class="r2">
<td>rotate</td>
<td>char</td>
<td>Rotate text and legend option (default &#8220;Y&#8221;)</td>
</tr>
<tr class="r1">
<td>frame</td>
<td>integer</td>
<td>Size of 2 canvas (if not define no 2 canvas)</td>
</tr>
</tbody>
</table>
<p class="titre2">File Liste Format</p>
<table class="tbl1">
<thead class="rh">
<tr>
<th>Colum</th>
<th>Name</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td colspan="4" class="tdc">&#8220;*&#8221; =&gt; mandatory / obligatoire</td>
</tr>
<tr class="r1">
<td>1*</td>
<td>Title</td>
<td>String</td>
<td>Title of data file</td>
</tr>
<tr class="r2">
<td>2*</td>
<td>NumCol</td>
<td>Integer</td>
<td>Number of column in data file</td>
</tr>
<tr class="r1">
<td>3*</td>
<td>DataFile</td>
<td>String</td>
<td>URL of Data file</td>
</tr>
<tr class="r2">
<td>4*</td>
<td>Style</td>
<td>Integer</td>
<td>
Presentation style</p>
<ul>
<li>0 : Bar</li>
<li>1 : Line</li>
<li>2 : Pie</li>
<li>3 : SumBar</li>
<li>4 : Table</li>
<li>5 : Line Area</li>
<li>6 : Sum Line Area</li>
<li>7 : Mode point</li>
<li>8 : Mode point simple</li>
</ul>
</td>
</tr>
<tr class="r1">
<td>5</td>
<td>ExtStyle</td>
<td>Integer</td>
<td>Extended style</p>
<ul>
<li>0 &#8211; Bullet and Presentation (Default)</li>
<li>1 &#8211; No bullet / presenation</li>
<li>2 &#8211; Bullet / No presentation</li>
<li>3 &#8211; No bullet / No presentation</li>
<li>10 &#8211; bullet (in graph) / Pas presentation</li>
<li>11 &#8211; gestion sourie / Pas presentation</li>
<li>12 &#8211; bullet (in graph) / presentation</li>
<li>13 &#8211; gestion sourie / presentation</li>
</ul>
</td>
</tr>
<tr class="r2">
<td>6</td>
<td>hscale</td>
<td>Integer</td>
<td>Number of item display Without horizotal scroll (default 0 =&gt; all)</td>
</tr>
<tr class="r1">
<td>7</td>
<td>Min</td>
<td>Double</td>
<td>Force min value</td>
</tr>
<tr class="r2">
<td>8</td>
<td>Max</td>
<td>Double</td>
<td>Force max value</td>
</tr>
<tr class="r1">
<td rowspan="3">all</td>
<td>unit</td>
<td>String</td>
<td>format unit=dddddd:sssss change unit with ddddd=double unit conversion and sssss string unit (kb, cm, &#8230;)</td>
</tr>
<tr class="r2">
<td>frm</td>
<td>String</td>
<td>Decimal presentation format (Use java format) sample &#8220;#,##0.00&#8243;</td>
</tr>
<tr class="r1">
<td>ilg</td>
<td>int</td>
<td>number of mark on Ox axis. If ilg=5 cChart display 1 legend for 5 data<br/>WARNING !! if ilg=-5 cChart display 5 legends</td>
</tr>
<tr class="r2">
<td colspan="4">
<p class="alertCode">
; name      ; nbcol ;   file           ; pres ; pres2 ; nbval ; Min ; Max<br />
Kake         ; 3      ; ./txt/test.txt   ; 2    ; 10<br />
Test 0 iY    ; 1     ; ./txt/m_0.txt    ; 0    ;  1    ;       ;     ;<br />
Test 1 Bar  ; 1	    ; ./txt/m_0197.txt ; 0    ; 11    ;   5   ; 22  ; 150 ;<br />
Test 1 Aire ; 1	    ; ./txt/m_0197.txt ; 5    ;  1    ; unit=2:zz
</p>
</td>
</tr>
</tbody>
</table>
<table class="tbl1">
<thead class="rh">
<tr>
<th>Colum</th>
<th>Name</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<th colspan="4">&#8220;*&#8221; =&gt; mandatory / obligatoire</th>
</tr>
<tr class="r1">
<td>1*</td>
<td>Title</td>
<td>String</td>
<td>Title of data file</td>
</tr>
<tr class="r2">
<td>2*</td>
<td>NumCol</td>
<td>Integer</td>
<td>Number of column in data file</td>
</tr>
<tr class="r1">
<td>3*</td>
<td>DataFile</td>
<td>String</td>
<td>URL of Data file</td>
</tr>
<tr class="r2">
<td>4*</td>
<td>Style</td>
<td>Integer</td>
<td>Presentation style</p>
<ul>
<li>0 : Bar</li>
<li>1 : Line</li>
<li>2 : Pie</li>
<li>3 : SumBar</li>
<li>4 : Table</li>
<li>5 : Line Area</li>
<li>6 : Sum Line Area</li>
<li>7 : Mode Point</li>
<li>8 : Mode point simple</li>
</ul>
</td>
</tr>
<tr class="r1">
<td>5*</td>
<td>ExtStyle</td>
<td>Integer</td>
<td>Extended style</p>
<ul>
<li>0 &#8211; Bullet and Presentation (Default)</li>
<li>1 &#8211; No bullet / presenation</li>
<li>2 &#8211; Bullet / No presentation</li>
<li>3 &#8211; No bullet / No presentation</li>
<li>10 &#8211; bullet (in graph) / No presentation</li>
<li>11 &#8211; gestion sourie / Pas presentation</li>
<li>12 &#8211; bullet (in graph) / presentation</li>
<li>13 &#8211; gestion sourie / presentation</li>
</ul>
</td>
</tr>
<tr class="r2">
<td>6*</td>
<td>Font Name</td>
<td>String</td>
<td>Font Name</td>
</tr>
<tr class="r1">
<td>7*</td>
<td>Font Size</td>
<td>Integer</td>
<td>Font Size</td>
</tr>
<tr class="r2">
<td>8*</td>
<td>BGColor</td>
<td>Integer</td>
<td>Background color (in decimal)</td>
</tr>
<tr class="r1">
<td>9*</td>
<td>xPosition</td>
<td>Integer</td>
<td>Position left</td>
</tr>
<tr class="r2">
<td>10*</td>
<td>yPosition</td>
<td>Integer</td>
<td>Position top</td>
</tr>
<tr class="r1">
<td>11*</td>
<td>Width</td>
<td>Integer</td>
<td>Size width</td>
</tr>
<tr class="r2">
<td>12*</td>
<td>Height</td>
<td>Integer</td>
<td>Size Height</td>
</tr>
<tr class="r1">
<td>13</td>
<td>hscale</td>
<td>Integer</td>
<td>Number of item display Without horizotal scroll</td>
</tr>
<tr class="r2">
<td>14</td>
<td>Min</td>
<td>Double</td>
<td>Force min value</td>
</tr>
<tr class="r1">
<td>15</td>
<td>Max</td>
<td>Double</td>
<td>Force max value</td>
</tr>
<tr class="r2">
<td>last</td>
<td>bg Image</td>
<td>String</td>
<td>Back ground image</td>
</tr>
<tr class="r1">
<td rowspan="3">all</td>
<td>unit</td>
<td>String</td>
<td>format unit=dddddd:sssss change unit with ddddd=double unit conversion and sssss string unit (kb, cm, &#8230;)</td>
</tr>
<tr class="r2">
<td>frm</td>
<td>String</td>
<td>ecimal presentation format (Use java format) sample &#8220;#,##0.00&#8243;</td>
</tr>
<tr class="r1">
<td>ilg</td>
<td>int</td>
<td>number of mark on Ox axis. If ilg=5 cChart display 1 legend for 5 data<br/>WARNING !! if ilg=-5 cChart display 5 legends</td>
</tr>
<tr class="r2">
<td colspan="4">
<p class="alertCode">;name ;ncol;   file     ; prs;prs2; font  ;fsiz; bgcolor ; xPos; yPos;Width;Heigh;nval; Min ; Max<br />
Tt A  ; 1  ; ./m_07.txt ; 0  ; 1  ; Arial ; 10 ; 1473732 ;  30 ;  30 ; 430 ; 250 ; 10 ; ./f_2.gif<br />
Tt B  ; 1  ; ./m_07.txt ; 4  ; 1  ; Arial ;  8 ; 1277632 ; 500 ;  30 ; 130 ; 250<br />
Tt 3  ; 2  ; ./tcht.txt ; 1  ; 0  ; Arial ; 10 ; 1260511 ;  30 ; 300 ; 600 ; 220 ;    ; 0   ; 100
</p>
</td>
</tr>
</tbody>
</table>
<p class="titre2">Data File Format</p>
<table class="tbl1">
<thead>
<tr class="rh">
<th>Colum</th>
<th>Nom</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr class="r1">
<td>1</td>
<td>Titre</td>
<td>String</td>
<td>File Title</td>
</tr>
<tr class="r2">
<td>2</td>
<td>NumCol</td>
<td>Ineger</td>
<td>Number of column in data file</td>
</tr>
<tr class="r1">
<td>3</td>
<td>DataFile</td>
<td>String</td>
<td>Data file URL</td>
</tr>
<tr class="r2">
<td colspan="4">Part 1</td>
</tr>
<tr class="r1">
<td colspan="4">
<p class="alertCode">* Parts 0 : with &#8220;title&#8221;       title chart<br />
title ;	Test &#8220;tChart&#8221;<br />
* Parts 1 : with &#8220;col&#8221;       column informations<br />
col ; Praxis   ; 12632256<br />
col ; Picpus   ; 16711680<br />
col ; Gerico   ; 00065280<br />
col ; Sigagip  ; 00000255<br />
col ; CASH     ; 00065535<br />
col-1 : always &#8220;col&#8221;<br />
col-2 : column title (string)<br />
col-3 : column color (int)<br />
* Parts 2 : with &#8220;label&#8221;       oX and oY label<br />
label ;	x Label ; y Label</p>
</td>
</tr>
<tr class="r2">
<td colspan="4">Part 2</td>
</tr>
<tr class="r1">
<td colspan="4">
<p class="alertCode">* Parts 2 : Data<br />
Janvier ; 10 ; 20 ; 15 ; 30 ; 30<br />
Fevrier ; 15 ; 30 ; 20 ; 30 ; 25</p>
<p>col-1 : line title (string)<br />
col-2 &#8230; col-n : values (int)
</p>
</td>
</tr>
</tbody>
</table>
<p class="titre2">Historique</p>
<table class="tbl1">
<tbody>
<tr class="r1">
<td>5.31</td>
<td>Correct a prb with all negatives values.</td>
</tr>
<tr class="r2">
<td>5.30</td>
<td>add javascript function , mode point simple, and more&#8230;</td>
</tr>
<tr class="r1">
<td>5.20</td>
<td>add tChart4, Rotate Texte,&#8230;</td>
</tr>
<tr class="r2">
<td>5.00</td>
<td>JDK 1.1, mode point, &#8230;</td>
</tr>
<tr class="r1">
<td>4.51</td>
<td>change default delimiter.</td>
</tr>
<tr class="r2">
<td>4.50</td>
<td>add setUnit function, change bar presentation.</td>
</tr>
<tr class="r1">
<td>4.30</td>
<td>Change data file format (texte delimited), can get all data in param.</td>
</tr>
<tr class="r2">
<td>4.20</td>
<td>Add Javascript setup, can change decimal format.</td>
</tr>
<tr class="r1">
<td>4.15</td>
<td>Add a nan function,&#8230;.</td>
</tr>
<tr class="r2">
<td>4.01</td>
<td>Correct a minor bug in set Min max,&#8230;.</td>
</tr>
<tr class="r1">
<td>4.00</td>
<td>Add scalling support, add min-max option,&#8230;.</td>
</tr>
<tr class="r2">
<td>3.52</td>
<td>Add &#8220;title&#8221; option and JavaScript support in tChart3.</td>
</tr>
<tr class="r1">
<td>3.51</td>
<td>Correct a minor bug in refresh data.</td>
</tr>
<tr class="r2">
<td>3.50</td>
<td>Add Horizontal Scroll.</td>
</tr>
<tr class="r1">
<td>3.10</td>
<td>Add Area and SumArea support (type 5 and 6) and hide comment.</td>
</tr>
<tr class="r2">
<td>3.00</td>
<td>Make component cChart, support 2 canvas in tChart.</td>
</tr>
<tr class="r1">
<td>2.00</td>
<td>Add table display. Float support</td>
</tr>
<tr class="r2">
<td>1.00</td>
<td>First version.</td>
</tr>
</tbody>
</table>
<p><br/></p>
]]></content:encoded>
			<wfw:commentRss>http://www.berthou.com/us/2007/11/01/tchart/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Exemple tChart</title>
		<link>http://www.berthou.com/us/2007/10/30/exemple-tchart/</link>
		<comments>http://www.berthou.com/us/2007/10/30/exemple-tchart/#comments</comments>
		<pubDate>Tue, 30 Oct 2007 22:21:10 +0000</pubDate>
		<dc:creator>rberthou</dc:creator>
				<category><![CDATA[applet]]></category>
		<category><![CDATA[java]]></category>

		<guid isPermaLink="false">http://www.berthou.com/us/?p=7</guid>
		<description><![CDATA[tChart2 sample use This is a small tChart applet sample. You can chose different data file and display mode with right combobox. auto Scale : m_0.txt exemple simple utilisant le calcul automatique du min et max Nan Test : dd.txt use du Nan (Not a number) if no values for cols Bar (bullet): m_0197.txt Display [...]]]></description>
				<content:encoded><![CDATA[<h2 class="titre2">tChart2 sample use</h2>
<p>This is a small  tChart applet sample. You can chose different data file and display mode with right combobox.</p>
<ul>
<li><strong>auto Scale </strong>: <a target="z" href="/jar/txt/m_0.txt">m_0.txt</a> exemple simple utilisant le calcul automatique du min et max</li>
<li><strong>Nan Test </strong>: <a target="z" href="/jar/txt/dd.txt">dd.txt</a> use du Nan (Not a number) if no values for cols</li>
<li><strong>Bar (bullet)</strong>: <a target="z" href="/jar/txt/m_0197.txt">m_0197.txt</a> Display bar with bullet on mouserOver</li>
<li><strong>Manual scale</strong>: <a target="z" href="/jar/txt/m_0197.txt">m_0197.txt</a> le même avec modification des min et max manuellement</li>
<li><strong>Mscale 5 elt</strong>: <a target="z" href="/jar/txt/m_0197.txt">m_0197.txt</a> le même avec modification du nombre d&#8217;élément par page</li>
<li><strong>Test ASP </strong>: <a target="z" href="/jar/txt/vc.asp.txt">vc.asp</a> Exemple de generation du fichier de donn&eacute;es a partir d&#8217;un ASP</li>
<li><strong>Test PERL </strong>: <a target="z" href="/jar/txt/vc.pl.txt">vc.pl</a> Exemple de génération du fichier de donn&eacute;es a partir d&#8217;un script Perl</li>
<li><strong>Mode 8 </strong>: Exemple du mode simple point</li>
</ul>
<p><span id="more-7"></span></p>
<p align="center">
<applet codeBase="/jar" archive="tchart2.jar" code="tchart2.class" width=550 height=380></p>
<param name="Copyright"	value="RBL : rbl@berthou.com">
<param name=rotate   	value="N">
<param name=file		value="./txt/file2.txt">
<param name=font		value="Arial,0,11">
<param name=fontL		value="Arial,1,14">
<param name=fontT		value="Dialog,3,16">
<param name=origine		value="50,60">
<param name=bgcolor 	value="#D0F0FF">
</applet></p>
]]></content:encoded>
			<wfw:commentRss>http://www.berthou.com/us/2007/10/30/exemple-tchart/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>JVMine &#8211; Minesweeper</title>
		<link>http://www.berthou.com/us/2007/10/21/jvmine-un-classique/</link>
		<comments>http://www.berthou.com/us/2007/10/21/jvmine-un-classique/#comments</comments>
		<pubDate>Sun, 21 Oct 2007 16:54:28 +0000</pubDate>
		<dc:creator>rberthou</dc:creator>
				<category><![CDATA[applet]]></category>
		<category><![CDATA[games]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[source]]></category>

		<guid isPermaLink="false">http://www.berthou.com/us/?p=12</guid>
		<description><![CDATA[This small applet is a &#34;minesweeper&#34; clone, the goal of the game is very easy, you just have to discover and mark all the mines. To do this you have as option left clic which show you the land (you loose of there is a mine) and right clic which mark a mine (if the [...]]]></description>
				<content:encoded><![CDATA[<p>This small applet is a &quot;minesweeper&quot; clone, the goal of the game is very easy, you just have to discover and mark all the mines. To do this you have as option left clic which show you the land (you loose of there is a mine) and right clic which mark a mine (if the case is not discovered).</p>
<p>For developpers all source code is avaible <a href="/download.php?type=java&file=jvmine.zip">here</a></p>
<p> i have also done a midlet version of this game and I think I am going to propose it to you soon.</p>

<br />
PS : My best score is in expert mode  153 sec.</p>

<span id="more-12"></span>

<div align="center">
<form name="cJVM">
    <input type="button" onclick="newJVM()" value="New Game" />     <select id="jvm_lvl" name="jvm_lvl">
    <option value="1">Debutant</option>
    <option value="1">Moyen</option>
    <option selected="selected" value="3">Expert</option>
    </select>
</form>
<br/>
<applet width="450" height="285" name="JMine" id="JMine" code="com.berthou.applet.game.jvmine.class" archive="/jar/jvmine.jar">
  <param value="/img/j" name="bImg" />
  <param value="12632256" name="bgcolor" />
  <param value="Arial" name="font" />
  <param value="16" name="fontsize" />
</applet>
</p>
</div>

<p>
<ul>
<h3>Download</h3>
<li><a href="/download.php?type=java&file=jvmine.zip">jvmine.zip</a></li>
</ul>
<ul>
<h3>Code html</h3>
<pre langage="HTML">
&lt;applet code=JVMine.class width="450" height="300" /&gt;
	&lt;param name=bImg value="img/j" /&gt;
	&lt;param name=bgcolor value=2222200&gt;
	&lt;param name=nbmine value="10" /&gt;
	&lt;param name=nbcol value="8" /&gt;
	&lt;param name=nbligne value="8" /&gt;
	&lt;param name=font value="Arial" /&gt;
	&lt;param name=fontsize value=14 /&gt;
&lt;/applet>
</pre>
</ul>

</p>

<script language="JavaScript">
function newJVM() {
    var JMine = document.getElementById("JMine") ;
    var sl = document.getElementById("jvm_lvl") ;

    var iM = sl.selectedIndex ;
    if (iM == 0) {
	JMine.m_col    = 8 ;
	JMine.m_ligne  = 8 ;
	JMine.m_mine   = 10 ;
    }
    if (iM == 1) {
	JMine.m_col    = 16 ;
	JMine.m_ligne  = 16 ;
	JMine.m_mine   = 40 ;
    }
    if (iM == 2) {
	JMine.m_col    = 30 ;
	JMine.m_ligne  = 16 ;
	JMine.m_mine   = 99 ;
    }
    JMine.newGame( ) ;
    return ;
   }
</script>
]]></content:encoded>
			<wfw:commentRss>http://www.berthou.com/us/2007/10/21/jvmine-un-classique/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
