Number validation using javascript

 <html>  
 <head>  
 <script>  
 function floatValidation(e,control)  
 {  
   if (e.keyCode==46)  
   {     
     var patt1=new RegExp("\\.");  
     var ch =patt1.exec(control.value);  
     if(ch==".")  
     {  
       e.keyCode=0;  
     }  
   }  
   else if( (e.keyCode>=48 && e.keyCode<=57) || e.keyCode==8)//Numbers or BackSpace  
   {     
     if (control.value.indexOf('.') != -1)//. Exist in TextBox  
     {  
       var pointIndex=control.value.indexOf('.');  
       var beforePoint = control.value.substring(0,pointIndex);  
       var afterPoint = control.value.substring(pointIndex+1);  
       var iCaretPos = 0;  
       if (document.selection)  
       {  
         if (control.type == 'text') // textbox  
         {  
           var selectionRange = document.selection.createRange();  
           selectionRange.moveStart ('character', -control.value.length);  
           iCaretPos = selectionRange.text.length;  
         }  
       }  
       if(iCaretPos > pointIndex && afterPoint.length >= 2)  
       {  
         e.keyCode=0;  
        alert('You enter two digit only after decimal point');  
       }  
       else if(iCaretPos <= pointIndex && beforePoint.length >= 7)  
       {  
         e.keyCode=0;  
       }  
     }  
     else//. Not Exisist in TextBox  
     {  
       if(control.value.length >= 7)  
       {  
         e.keyCode=0;  
         alert('You enter 7 digit only before decimal point');  
       }  
     }  
   }  
   else  
   {  
     e.keyCode=0;  
   }  
 }  
 </script>  
 </head>  
 <body>  
      <input id="amt" type="text" name="Amount" onkeypress="return floatValidation(event,this)" onfocus="setCaretPosition(this,0);"/>  
 </body>  
 </html>  

Why do we need wrapper classes in java?

It is sometimes easier to deal with primitives as objects. Moreover most of the collection classes store objects and not primitive data types. And also the wrapper classes provide many utility methods also. Because of these resons we need wrapper classes. And since we create instances of these classes we can store them in any of the collection classes and pass them around as a collection. Also we can pass them around as method parameters where a method expects an object.

Configuring Tomcat 6 For https (SSL) Page for Windows

Prerequisites:-
1. JDK
2. Tomcat

For any https (SSL) page a certificate is very necessary. First we will learn generating a keystore, which will contain a certificate chain. We will use the keytool command from JDK.

1. Goto the command prompt.

2. Type keytool -genkey -alias tomcat -keyalg RSA (if your path is not set to the java bin directory, please go there and type the command).

3. Now you will prompted for a keystore password give it as changeit (you can give it different but you will have to make some changes later).

4. Enter the details needed.

5. Now alias password will be aksed. It must be same as keystore password.

6. After the end of it a keystore will be generated in "drive":\Documents and Settings\"username"\.keystore
Now configure "tomcat_home"\conf\server.xml, add the following code:-

  You are done with your configuration. Save the server.xml file. Restart your tomcat. Now type https://localhost:8443

This should show you the same tomcat homepage but in secured format.