Features / Advantages of Servlets

Posted on Updated on

Features / Advantages of Servlets

1)    Portability: Because servlets are written in Java and conform to a well-defined and widely accepted API, they are highly portable across operating systems and across server implementations. You can develop a servlet on a Windows NT machine running the Java Web Server and later deploy it effortlessly on a high-end Unix server running Apache. With servlets, you can truly “write once, serve everywhere.”

2)    Powerful: We can do several things with the servlets which were difficult or even impossible to do with CGI,For example the servlets can talk directly to the web server while the CGI program can not do. Servlets can share data among each other, they even make the database connection pools easy to implement. They can maintain the session by using the session tracking mechanism which helps them to maintain information from request to request. It can do many other things which are difficult to implement in the CGI programs.

3)    Safety:Servlets support safe programming practices on a number of levels. Because they are written in Java, servlets inherit the strong type safety of the Java language. In addition, the Servlet API is implemented to be type-safe. While most values in a CGI program, including a numeric item like a server port number, are treated as strings, values are manipulated by the Servlet API using their native types, so a server port number is represented as an integer. Java’s automatic garbage collection and lack of pointers mean that servlets are generally safe from memory management problems like dangling pointers, invalid pointer references, and memory leaks. Servlets can handle errors safely, due to Java’s exception-handling mechanism.

 

4)    Elegance:The elegance of servlet code is striking.  Servlet code is clean, object oriented, modular, and amazingly simple. One reason for this simplicity is the Servlet API itself, which includes methods and classes to handle many of the routine chores of servlet development. Even advanced operations, like cookie handling and session tracking, are abstracted into convenient classes.

 

5)    Integration:Servlets are tightly integrated with the server. This integration allows a servlet to cooperate with the server in ways that a CGI program cannot. For example, a servlet can use the server to translate file paths, perform logging, check authorization, perform MIME type mapping, and, in some cases, even add users to the server’s user database. Server-specific extensions can do much of this, but the process is usually much more complex and error-prone.

6)    Extensibility and Flexibility:The Servlet API is designed to be easily extensible. As it stands today, the API includes classes that are optimized for HTTP servlets. But at a later date, it could be extended and optimized for another type of servlets, either by Sun or by a third party. It is also possible that its support for HTTP servlets could be further enhanced. Servlets are also quite flexible.

 Posted by Vissicomp Technology Pvt Ltd

For more visit http://www.vissicomp.com

Advertisements

Contol Statement in PHP

Posted on Updated on

<?php

$day=Date(“D”);

if($day==”Sat”)

echo ” Have a nice week end”;

else

echo “Have a nice day”;

?>

Output of Control Statement
Output of Control Statement

<?php

$d=date(“D”);

if ($d==”Sat”)

{

echo “Hello!<br />”;

echo “Have a nice weekend!<br>”;

echo “See you on Monday!”;

}

else

echo “have a nice day”;

?>

Output of Control Statement
Output of Control Statement

Parameters in RMI

Posted on Updated on

Parameters in RMI

 RMI supports method calls to remote objects.

  1. When these calls involve passing parameters or accepting a return value, it depends on whether the parameters are :

I.            Primitive data types.

II.            Objects.

III.            Remote objects.

  1. When the parameter is passed to a method the JVM makes a copy of the value places the copy on the stack and then executes the method.

I.            PRIMITIVE PARAMETERS:

a)      When a primitive data type is passed as a parameter to a remote method, the RMI system passes it by value.

b)     RMI will make a copy of a primitive data type and send it to the remote method. If a method returns a primitive data type, it is also returned to the calling JVM by value.

c)      Values are passed between JVMs in a standard, machine-independent format.

d)     This allows JVMs running on different platforms to communicate with each other reliably.

II.            OBJECT PARAMETERS:

a)   When an object is passed to a remote method, the semantics change from the case of the single JVM.

b)  RMI sends the object itself, not its reference, between JVMs.

c)   It is the object that is passed by value, not the reference to the object.

d)  Similarly, when a remote method returns an object, a copy of the whole object is returned to the calling program.

e)   Because different JVMs do not share heap memory, RMI must send the referenced object and all objects it references.

f)    RMI uses a technology called Object Serialization to transform an object into a linear format that can then be sent over the network wire.

g)  Object serialization essentially flattens an object and any objects it references.

h)  Serialized objects can be de-serialized in the memory of the remote JVM and made ready for use by a Java program.

III.            REMOTE OBJECT PARAMETERS:

 

Parameters in RMI
Parameters in RMI

a)   A client program can obtain a remote reference to a remote object, through the RMI registry program.

b)  When a method returns a local reference to an exported remote object, RMI does not return that object.

c)   It substitutes another object (remote proxy for that service), in the return stream.

d)  When a reference is returned to the server, it is not converted into a local reference.

e)   When the object from the server is returned, to the client the proxy object is substituted.

Posted by Vissicomp Technology Pvt Ltd

For more http://www.vissicomp.com

Java Database Connectivity

Posted on

How to create Data Source Name (DSN) In Window

Create a System DSN in Windows

  1. Click on Start button , Select Control Panel, point to Administrative Tools, and then double-click Data Sources  (ODBC).
    1.  Click the System DSN tab
    1. Click Add.
    2. Click the database driver that corresponds with the database type to which you are connecting, and then click Finish.

    Type the data source name. Make sure to you a name that you will remember. You will need to use this name later.

  1. Select server name from server dropdown list.
  2. Click on next button.
  1. Click the correct database, and then click on next Button
  2. Click finish button.
Java Database Connectivity
Java Database Connectivity

JDBC1 JDBC2 JDBC3 JDBC4 JDBC5

RMI (Remote Method Invocation)

Posted on Updated on

Firewall Issue in RMI

Firewall issues

  1. Firewalls are inevitably encountered in any network, that has to operate beyond the sheltering confines of an Intranet.
  2. They block all the network traffic with certain exceptions defined in the rule-set.
  3. Since RMI opens a dynamic socket connection, between client and server to facilitate communication, the JRMP traffic is blocked by most protocols.
  4. On top of TCP/IP RMI uses a wire level protocol – Java Remote Method Protocol (JRMP).
  5. To get across a firewall, RMI makes use of HTTP tunneling by encapsulating RMI calls, within an HTTP post.

CLIENT BEHIND FIREWALL

  1. In the above scenario, when the transport layer tries to establish a connection with the server, it is blocked by the firewall.
  2. When this happens, the RMI transport layer automatically retries by encapsulating the JRMP call data within an HTTP POST request. The HTTP POST header for the call is in the form:
  3. http://hostname:port
  4. If a client is behind a firewall, it is important that you also set the system property http.proxyHost appropriately.
  5. Since almost all firewalls recognize the HTTP protocol, the specified proxy server should be able to forward the call directly to the port on which the remote server is listening on the outside.
  6. Once the HTTP-encapsulated JRMP data is received at the server, it is automatically decoded and dispatched by the RMI transport layer.
  7. The reply is then sent back to client as HTTP-encapsulated data.

CLIENT & SERVER BEHIND FIREWALL

  1. In this case, the RMI transport layer uses one additional level of indirection. This is because the client can no longer send the HTTP-encapsulated JRMP calls to arbitrary ports as the server is also behind a firewall. Instead, the RMI transport layer places JRMP call inside the HTTP packets and send those packets to port 80 of the server. The HTTP POST header is now in the form
  2. http://hostname:80/cgi-bin/java-rmi?forward=<port&gt;
  3. This causes the execution of the CGI script, java-rmi.cgi, which in turn invokes a local JVM, unbundles the HTTP packet, and forwards the call to the server process on the designated port.
  4. RMI JRMP-based replies from the server are sent back as HTTP REPLY packets to the originating client port where RMI again unbundles the information and sends it to the appropriate RMI stub.
  5. Of course, for this to work, the java-rmi.cgi script, which is included within the standard JDK 1.1 or Java 2 platform distribution, must be preconfigured with the path of the Java interpreter and located within the web server’s cgi-bin directory.
  6. It is also equally important for the RMI server to specify the host’s fully-qualified domain name via a system property upon startup to avoid any DNS resolution problems, as:
  7.  java.rmi.server.hostname=host.domain.com.

Posted by Vissicomp Technology Pvt Ltd

For more http://www.visscomp.com

Linux

Posted on Updated on

1.    What is Linux?

Linux is, in simplest terms, an operating system. It is the software on a computer that enables applications and the computer operator to access the devices on the computer to perform desired functions. The operating system (OS) relays instructions from an application to, for instance, the computer’s processor. The processor performs the instructed task, then sends the results back to the application via the operating system.

But something sets Linux apart from these operating systems. The Linux operating system represented a $25 billion ecosystem in 2008. Since its inception in 1991, Linux has grown to become a force in computing, powering everything from the New York Stock Exchange to mobile phones to supercomputers to consumer devices.

As an open operating system, Linux is developed collaboratively, meaning no one company is solely responsible for its development or ongoing support. Companies participating in the Linux economy share research and development costs with their partners and competitors. This spreading of development burden amongst individuals and companies has resulted in a large and efficient ecosystem and unheralded software innovation.

Over 1,000 developers, from at least 100 different companies, contribute to every kernel release. In the past two years alone, over 3,200 developers from 200 companies have contributed to the kernel–which is just one small piece of a Linux distribution.

This article will explore the various components of the Linux operating system, how they are created and work together, the communities of Linux, and Linux’s incredible impact on the IT ecosystem.

  1. Where is Linux?

One of the most noted properties of Linux is where it can be used. Windows and OS X are predominantly found on personal computing devices such as desktop and laptop computers. Other operating systems, such as Symbian, are found on small devices such as phones and PDAs, while mainframes and supercomputers found in major academic and corporate labs use specialized operating systems such as AS/400 and the Cray OS.

Linux, which began its existence as a server OS and Has become useful as a desktop OS, can also be used on all of these devices. ‚ÄúFrom wristwatches to supercomputers,‚Äù is the popular description of Linux’ capabilities.

An abbreviated list of some of the popular electronic devices Linux is used on today includes:

These are just the most recent examples of Linux-based devices available to consumers worldwide. This actual number of items that use Linux numbers in the thousands. The Linux Foundation is building a centralized database that will list all currently offered Linux-based products, as well as archive those devices that pioneered Linux-based electronics.

Linux_1
Linux_1

Posted by Vissicomp Technology Pvt Ltd

ww.vissicomp.com

Maths formula

Posted on Updated on

  1. COMPOUND INTEREST

M = P( 1 + i )n

M is the final amount including the principal.

P is the principal amount.

i is the rate of interest per year.

n is the number of years invested.

Applying the Formula

Let’s say that I have $1000.00 to invest for 3 years at rate of 5% compound interest.

M = 1000 (1 + 0.05)3 = $1157.62.

You can see that my $1000.00 is worth $1157.62.

Area and Perimeter of a Triangle, Rectangle, Parallelogram, Trapezoid and Circle

Area and Perimeter of a Triangle, Rectangle, Parallelogram, Trapezoid and Circle
Area and Perimeter of a Triangle, Rectangle, Parallelogram, Trapezoid and Circle
Area and Perimeter of a Triangle, Rectangle, Parallelogram, Trapezoid and Circle
Area and Perimeter of a Triangle, Rectangle, Parallelogram, Trapezoid and Circle

Surface Area and Perimeter of a Triangle

  Surface Area and Perimeter of a Triangle

Surface Area and Perimeter of a Triangle