Sunday, August 26, 2012

Disable Back Button After Login







if your login page is this than






on your login page put the following java script


<SCRIPT type="text/javascript">
 window.history.forward();
 function noBack() { window.history.forward(); }
</SCRIPT>
</HEAD>
<BODY onload="noBack();" 
onpageshow="if (event.persisted) noBack();">
</BODY>

Example

Monday, July 09, 2012

Struts MVC Example (Insert | Update | Delete | Edit | PDF )

First Login Page
Server Side Validation On Login Page

Person Register Page


Server Side Validation On Register Page..

If Register Is Successful Than Show Register Person List If Click On Edit than Person is Edit
If Click On Delete than Person is delete
If Click On PDF than Pdf Report Open....


All Validation Are fire on Update Person Page Which Show On Register Person Page...

When click on pdf than PDF report open in new Window ....


Download Source Code  



Saturday, May 19, 2012

Java varargs

New Feature of Java 5.0 is  "varargs" that enables methods to receive variable numbers of arguments. Variable-length argument lists are a new feature in J2SE 5.0. Programmers can create methods that receive an unspecified number of arguments. An argument type followed by an ellipsis (...) in a method's parameter list indicates that the method receives a variable number of arguments of that particular type.
Example :

public class VarargsDemo {

    /**
     * @author Piyush Chaudhari
     * 
     */
   
    public void display(String...strings)
    {
         System.out.println("Method Argument is :"+strings.length);
         for(String string:strings)
         {
             System.out.println("Argument is :"+string);
         }
    }
   
   
    public static void main(String[] args) {
         // TODO Auto-generated method stub
         VarargsDemo demo=new VarargsDemo();        demo.display("Piyush","Chaudhari","Gujaratvidyapith","Ahmedabad");
    }

}