Thursday, 28 April 2016

Static Versus Dynamic Web Pages

Web pages could be either static or dynamic. "Static" page will have constant content, while "dynamic" page has content changing. Therefore, static Web pages contain the same content each time the page is loaded, while the content of dynamic Web pages can be generated on fly.

Example for Static web pages are HTML pages, which defines the structure and content of the Web page. Every time an HTML page is loaded, it looks the same. The only way the content of an HTML page will change is if the Web developer updates and publishes the new file.

On the other hand some of the dynamic web pages are PHP, ASP, and JSP pages, these pages contain "server-side" code, which allows the server to generate dynamic content each time the page is loaded.
For example, the server may display the current time and date on the Web page. Also, dynamic pages use server-side code to access DB, which enables the page's content to be generated dynamically from information stored in the database. 

We can easily say whether the page is dynamic or static just by looking at the page's file extension in the URL, in the Web browser. If it is ".htm" or ".html," the page is probably static. If the extension is ".php," ".asp," or ".jsp," the page is most likely dynamic. 

Java Class file format


Wednesday, 30 March 2016

Steps to write the RMI program with example program

Below are the Steps to write the RMI program

  1. Create the remote interface
  2. Implementation of the remote interface
  3. Compile the implementation class and create the stub and skeleton objects using the rmic tool
  4. Start the registry service 
  5. Create and start the server application
  6. Create and start the client application
Below are the example program with output:-

//Create the remote interface


import java.rmi.*;
public interface AdderApps extends Remote{

public int addition(int x,int y)throws RemoteException;
}


//Implementation of the remote interface


import java.rmi.*;
import java.rmi.server.*;

public class AdderRemoteobj extends UnicastRemoteObject implements AdderApps{

AdderRemoteobj()throws RemoteException{
super();
}

public int addition(int x,int y){return x+y;}

}

//Compile the implementation class and create the stub and skeleton objects using the rmic tool and start the registry service

//Create and start the server application

import java.rmi.*;
import java.rmi.registry.*;

public class MyServer{

public static void main(String args[]){
try{

AdderApps stub=new AdderRemoteobj();
Naming.rebind("rmi://localhost:5000/Sai",stub);

}catch(Exception e){System.out.println(e);}
}

}

//Create and start the client application

import java.rmi.*;

public class MyClient{

public static void main(String args[]){
try{

AdderApps stub=(AdderApps)Naming.lookup("rmi://localhost:5000/Sai");
System.out.println(stub.addition(25,50));

}catch(Exception e){System.out.println(e);}
}

}


Output:-