Presentation is loading. Please wait.

Presentation is loading. Please wait.

Sachin Malhotra Saurabh Choudhary

Similar presentations


Presentation on theme: "Sachin Malhotra Saurabh Choudhary"— Presentation transcript:

1 Sachin Malhotra Saurabh Choudhary
Programming in Java, 2e Sachin Malhotra Saurabh Choudhary

2 Introduction to Advanced Java
Chapter 16 Introduction to Advanced Java

3 Objectives Handle databases Do server side programming with Servlets
Learn basic of JSP Learn basic of Java beans and jar files Create remote application using RMI Learn basics of EJB

4 DATABASE HANDLING USING JDBC
JDBC stands for Java database connectivity. a standard API for all Java programs to connect to databases. The JDBC API is available in two packages: Core API java.sql. Standard extension to JDBC API javax.sql (supports connection pooling, transactions, etc.) JDBC defines a few steps to connect to a database and retrieve/insert/update databases. The steps are as follows: Load the driver Establish connection Create statements Execute query and obtain result Iterate through the results

5 Load the Driver The driver is loaded with the help of a static method,
Class.forName(drivername) Every database has its own driver. All the JDBC drivers have been classified into four categories: Type 1: JDBC ODBC bridge driver Type 2: Native-API/partly Java driver Type 3: Net-protocol driver Type 4: Pure Java driver

6 Driver Names

7 JDBC ODBC Bridge Driver

8 Native API/ Partly Java Driver

9 Type 3: Net Protocol Driver

10 Type 4: Pure Java Driver

11 Establish a Connection
A connection to the database is established using the static method getConnection(databaseUrl) of the DriverManager class. The DriverManager class is class for managing JDBC drivers. The database URL takes the following shape jdbc:subprotocol:subname. If any problem occurs during accessing the database, an SQLException is generated, else a Connection object is returned which refers to a connection to a database. Connection is actually an interface in java.sql package. Connection con=DriverManager.getConnection(databaseUrl);

12 Few Database URLs

13 Create Statement The connection is used to send SQL statements to the database. three interfaces are used for sending SQL statements to databases Statement and its two sub-interfaces, PreparedStatement and Callable Statement. Three methods of the Connection object are used to return objects of these three statements. A Statement object is used to send a simple SQL statement to the database with no parameters. Statement stmt = con.createStatement();

14 Create Statement (contd.)
A PreparedStatement object sends precompiled statements to the databases with or without IN parameters. If n rows need to be inserted, then the same statement gets compiled n number of times. So to increase efficiency, we use precompiled PreparedStatement. only the values that have to be inserted are sent to the database again and again. PreparedStatement ps = con.prepareStatement(String query); A CallableStatement object is used to call stored procedures. CallableStatement cs = con.prepareCall(String query);

15 Execute Query Three methods are used
ResultSet executeQuery(String sqlQuery) throws SQLException int executeUpdate(String sqlQuery) throws SQLException boolean execute(String sqlQuery) throws SQLException executeQuery is used for executing SQL statements that return a single ResultSet, e.g. a select statement. The rows fetched from database are returned as a single ResultSet object. For example, ResultSet rs=stmt.executeQuery(“select * from emp”); executeUpdate is used for DDL and DML SQL statements like insert,update, delete, and create. returns an integer value for DML to indicate the number of rows affected and 0 for DDL statements which do not return anything.

16 Execute Query (contd.) PreparedStatement ps = con.prepareStatement(“update emp set salary=? where empid=?”); The statement is sent to database and is prepared for execution, only the value of the IN (?) parameters need to be sent. ps.setInt(1,100000); ps.setString(2,”Emp001”); ps.executeUpdate(); The execute method is used when the statement may return more than one ResultSet or update counts or a combination of both. This happens when stored procedures are executed.

17 Iterate ResultSet while (rs.next()) {
System.out.println(rs.getString(1)); System.out.println(rs.getInt(2)); …….. }

18 Result Set Meta Data ResultSetMetaData rsmd=rs.getMetaData(); System.out.println(“Column in ResultSet:”+rsmd.getColumnCount()); for(int i=1;i<=rsmd.getColumnCount();i++) { System.out.println(“Column Name :”+rsmd.getColumnName(i)); System.out.println(“Column Type :”+rsmd.getColumnTypeName (i)); }

19 Example import java.sql.*; class DatabaseConnection{
public static void main(String args[]) throws Exception{ Class.forName(“sun.jdbc.odbc.JdbcOdbcDriver”); Connection con=DriverManager.getConnection(“jdbc:odbc:sac”); PreparedStatement ps=con.prepareStatement(“insert into emp values (?,?,?)”); ps.setString(1,”Emp001”); ps.setString(2,”Peter”); ps.setInt(3,10000); System.out.println(“Row inserted : “+ps.execute Update()); Statement stmt=con.createStatement(); ResultSet rs=stmt.executeQuery(“select * from emp”);

20 Example (contd.) ResultSetMetaData rsmd=rs.getMetaData(); int cc=rsmd.getColumnCount(); System.out.println(“Number of columns in result set: “+cc); for(int i=1;i<=cc;i++) System.out.print(rsmd.getColumnName(i)+”\t”); System.out.println(); while(rs.next()){ System.out.print(rs.getString(1)+”\t”); System.out.print(rs.getString(2)+”\t”); System.out.print(rs.getString(3)+”\n”);} } }

21 Scrollable Result Sets
JDBC 2.1 introduced the concept of moving the cursor in the backward direction also. You can even position the cursor of a ResultSet object on a specific row. A scrollable ResultSet is obtained as follows Statement stmt = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); General Syntax: Statement createStatement(int resultSetType, int resultSetConcurrency) throws SQLException

22 Result Set and Concurrency Types

23 Transactions a set of statements that if executed should complete in entirety If any of the statement fails the entire transaction is rolled back First Step: the auto commit feature should be turned off. con.setAutoCommit(false); Transactions can be rolled backed by using the rollback method on the connection object. con.rollback();

24 Transaction (contd.) try { con.setAutoCommit(false);
Statement stmt1=con.createStatement(); Statement stmt2=con.createStatement(); stmt1.executeUpdate("Query 1"); stmt1.executeUpdate("Query 2"); con.commit(); ... } catch(SQLException se){ try{ con.rollback(); } catch(SQLException se) {} }

25 Batch Updates try { con.setAutoCommit(false);
Statement stmt1 = con.createStatement(); stmt1.addBatch("Query1"); stmt1.addBatch("Query2"); int[] i = stmt1.executeBatch(); con.commit(); ... } catch(BatchUpdateException be) { try{ stmt1.clearBatch(); }catch(SQLException se){} }

26 Savepoint try { con.setAutoCommit(false);
Statement stmt1 = con.createStatement(); Statement stmt2 = con.createStatement(); stmt1.executeUpdate("Query 1"); Savepoint sp1 = con.setSavepoint("SavePoint1"); stmt1.executeUpdate("Query 2"); con.commit(); ... } catch(SQLException se){ try{ con.rollback(sp1); } catch(SQLException se){}}

27 Servlets Servlets are Java server-side programs that accept client’s request (usually http request), process them and generate (usually http response) responses. The requests originate from client’s web browser and are routed to a servlet located inside an appropriate web server. Servlets execute within a servlet Containers which resides in a web server like Apache Tomcat. Normally HTTP (hyper text transfer protocol) is used between web client and servlets, but other protocols like FTP (file transfer protocol) can also be used.

28 Life cycle of Servlets

29 First Servlet import javax.servlet.*; import javax.servlet.http.*; import java.io.*; public class FirstServlet extends HttpServlet{ public void service(ServletRequest req, Servlet Response res) throws ServletException,IOException{ res.setContentType(“text/plain”); PrintWriter pw=res.getWriter(); pw.println(“My First Servlet is running”); }}}

30 How to run the servlet? The First step is to compile the servlet:
set classpath = %classpath%; C:\Apache\Tomcat 7.0\lib\servlet-api.jar; javac FirstServlet.java Install a web server or a servlet container. Use Apache Tomcat 7.0 The third step is to place the compiled servlet class into an appropriate directory in the Tomcat.

31 Directory structure for Placing Servlets

32 web.xml file

33 The Output

34 Reading Client Data The client’s data is sent to the server from the client’s browser via two methods of http protocols: get and post. The get method appends data to the URL (of the servlet handling the request) and passes it to the server. The drawbacks of this approach are: The URLs are of fixed size and it puts a restriction on the amount of data that can be transmitted to the server. Moreover, whatever data is sent to the server is visible in clear text. On the other hand, post method overcomes these limitations by sending data to the server as a part of http header format instead of appending it to the URL.

35 Methods to fetch data

36 Example <html> <head> <title> form data</title></head><body> <center><h1><U>Registration Form</u></h1> <form method = get action = “ Name <input type=text name=fname><br> Address <input type=text name=add><br> User id <input type=text name=uid><br> Password <input type=password name=pass><br> Gender :male <input type=radio name=gender value=male> female <input type=radio name=gender value=female><br> Hobbies:Dancing <input type=checkbox name=hobbies value=dance> Music <input type=checkbox name=hobbies value=music> Travel <input type=checkbox name=hobbies value=travel><br> <input type=submit><input type=reset></center> </body> </html>

37 Example import javax.servlet.*; import javax.servlet.http.*; import java.io.*; import java.util.*; public class ReadData extends HttpServlet{ public void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException{ res.setContentType(“text/html”); PrintWriter out=res.getWriter(); Enumeration e=req.getParameterNames(); out.println(“<html><head><title> client data</title></head>”); out.println(“<body><B>”); while(e.hasMoreElements()){ String name=(String)e.nextElement(); String[] values=req.getParameterValues(name); for(int i=0;i<values.length;i++){ out.println(name +” : <i>”+values [i]+”</i><br>”); }} out.println(“</body></html>”);} public void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException{ doGet(req,res);}}

38 The Output

39 The Output

40 Http Redirect Http redirect is a way of redirecting a user to another location on the Internet. Http redirect is a way of telling the client’s browser about the new URL. All the requests that arrive on the old URL are redirected to the new URL. res.sendRedirect (“ Formdata.html”);

41 Cookies Cookies are basically small pieces of information stored on the client’s machine by the browser. A cookie contains information like user browsing preferences, user id and password combinations, session id, number of times a user has visited a page, etc. This information is stored in pairs, i.e. name-value pairs. This information wrapped in a cookie object is sent to the client browser by a servlet, which stores it somewhere in its temporary Internet files. Whenever a request is sent to that particular server (from where cookie was downloaded), all the cookies (stored in the client’s machine from that very server) are attached to the http request and sent to the server.

42 Example import javax.servlet.*; import javax.servlet.http.*; import java.io.*; public class CookieDemo extends HttpServlet{ public void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException,IOException{ res.setContentType(“text/html”); PrintWriter out=res.getWriter(); Cookie c[]=req.getCookies(); if(c==null){ Cookie counts=new Cookie(“Counts”,”1”); out.println(“<html><head><title> client data</title></head>”); out.println(“<body><B>”); out.println(“Welcome <br>”); out.println(“This is the first time you have visited this page”); out.println(“</body></html>”);

43 Example res.addCookie(counts);} else{ out.println(“<html><head><title> client data</title></head>”); out.println(“<body><B>”); for(int i=0;i<c.length;i++) { String name=c[i].getName(); String val=c[i].getValue(); int accessCount=(Integer.parseInt(val) +1); out.println(“Welcome back<br>”); out.println(“Number of times you have visited this page: “+accessCount); Cookie counts=new Cookie(name,new Integer(accessCount).toString()); res.addCookie(counts); } out.println(“</body></html>”); }} public void doPost(HttpServletRequest req,HttpServletResponse res) throws ServletException,IOException{ doGet(req,res);}}

44 The Output

45 Session Management Session is used to track the user between successive requests from the same client to the same server. The real problem is to maintain the state of the client across various requests. The http protocol is stateless so it does not maintain client information Either the client or the server will maintain the sessions. (a) hidden fields, (b) URL rewriting, (c) cookies, or (d) HttpSession API.

46 Hidden Fields are html fields not visible to the users.
The state is maintained (at client side) in hidden fields and embedded in the responses generated by the servlet. sent back to the server with the http request and extracted by the servlet. <INPUT TYPE="hidden" NAME="Id" VALUE="Unique Identifier"> <INPUT TYPE="hidden" NAME="Customer Name" VALUE="Tom">

47 Drawbacks of Hidden fields
they will only be sent to the server once the form is submitted and not when a user clicks on a hyperlink can be used when information is less. Hidden fields can viewed by selecting the “View Source”option in the browser, cannot be used for security purposes.

48 URL Rewriting history/session information/state of the client is appended to the URL before sending the page back to the client & userid=sac123 &... precaution must be taken in maintaining and appending the parameters every time while rewriting URL’s until the session completes. Moreover, you cannot have static pages; each page will be dynamically generated if this approach is used.

49 Cookies is a small amount of information stored on the client’s machine within the browser’s files It is a key value pair sent by the server to the client. This pair is automatically attached with every request to the server from where it was downloaded and then sent to the server. Problem if the users disable cookies

50 Session API HttpSession API is used for creating and maintaining sessions among clients and servers. HttpSession is an interface within javax.servlet.http package and it maintains all the sessions A HttpSession Object is created using a getSession method of the request object. HttpSession session=request.getSession(true); setAttribute() and getAttribute() are used to store and retrieve objects from the session object. session.setAttribute("name","Tom"); String n=(String) session.getAttribute(name); session can be destroyed by using the invalidate() function

51 Introduction to JSP is basically a page that contains Java code embedded within html tags. JSP fi les have an extension .jsp They execute within a JSP container present in the webserver. This container translates the .jsp into an equivalent servlet.

52 Advantages JSP is embedded in html with some special delimiters which look like tags. So it is easy to learn. Moreover, JSP pages are automatically recompiled when required, which is not the case with servlets The URL mapping required in web.xml fi le for servlets is not required in the case of JSP.

53 JSP Life Cycle NOTE: jspInit() and jspDestroy() methods can be declared in a JSP page _jspService() method cannot be declared in a JSP page as it is dynamically generated by the JSP container.

54 Steps in JSP Execution User sends request for a JSP page to the webserver through a web browser. Webserver accepts the request and passes it to the JSP container. If the JSP file has been called for the first time then the JSP container parses the page, converts it into a servlet, and compiles the servlet. The container loads the Servlet class by instantiating it and calling the jspInit() and _jspService() methods of the JSP life cycle.

55 Steps in JSP Execution If JSP page is called for second or nth time, the container checks whether the JSP page is newer than its class and if yes, the translation of JSP to servlet takes place and again it is compiled, instantiated, and loaded again; otherwise the most updated instance is already running. The generated HTML is displayed on the user’s web browser.

56 JSP Elements Directives Expressions, Scriptlets and declarations
Actions are specific instructions to the container informing it how to process the JSP page. three types of directives in JSP: page, include, and taglib. The syntax for adding directive to a JSP page is directive-name attribute-name="value" …. >

57 Examples of Directive Directive Xml equivalent tag
page import="java.util.*" %> <jsp:directive.page import ="java.util.*" /> include fi le="includedirective.html" %> <jsp:directive.include file="includedirective.html" /> taglib uri=" " prefix="" > xmlns:prefix="tag library url"

58 JSP Expressions Expressions are enclosed within <%= … %>.
The result of expression is directly embedded in the html page. E.g. <%= (2+2-2) %> <% ="Introduction to JSP" %>.

59 JSP Scriptlets Used to execute a number of statements
enclosed within <% %> <% out.println("This following text is visible through a Scriptlet <br>"); d=new Date(); out.println("<br> The Current Date is: "+d+"<br>"); out.println("<br><b> A Sample for Loop</b><br> "); for (int i=0;i<5;i++) out.println("Iteration No :" +i+"<br>"); %>

60 Implicit objects in JSP

61 JSP Declarations If you wish to declare any item it should be done here. Note that declarations are enclosed within <%! %>. all declarations in the scriptlet code goes into the service method of the JSP page and all JSP declarations reside on top of the service method. For example, <%! Date d;%>

62 JSP Actions

63 Placing your JSP in the Webserver

64 Java Beans Java Beans provides a standard format for writing Java classes. is a reusable software component.

65 Guidelines for a Java Bean
must have a no-argument constructor. should have no public properties. Properties should be modified and accessed through setter (setXXX) and getter (getXXX) Supporting introspection which allows a builder tool to analyze how a bean works. Supporting customization of a bean. Supporting events they can fire and handle. Supporting persistence

66 Properties of a Bean Basic Properties Indexed properties
is one which accepts a single value. Indexed properties is one which accepts an array of values. Bound properties is bound to the listener and this listener is notified whenever the value of this field changes. Constrained properties the listeners are consulted prior to changing the constrained property and if there is no objection from any of the listeners, changes are made.

67 Using Beans through JSP
jsp:useBean action is used to load a bean in the JSP page. <jsp:useBean id="calc" class="beans.CalculateBean" > can be considered as equivalent to the following scriptlet code: <% beans.CalculateBean calc = new beans.CalculateBean; %> <jsp:getProperty> and <jsp:setProperty> tags are used to get and set the properties of a bean <jsp:setProperty name="calc" property="name" value="Peter" /> <jsp:getProperty name="calc" property="name" />

68 Example <Html> <Head> <title> Using Java Beans in JSP </title> </Head> <body> Hello <br> <jsp:useBean id="calc" class="beans.CalculateBean" > After Instantiating Bean <br> <jsp:setProperty name="calc" property="*" /> <jsp:setProperty name="calc" property="name" value="sachin" /> After Setting property: name <br> <jsp:setProperty name="calc" property="var1" value="10" />

69 Example (contd.) After Setting property: variable 1 <br>
<jsp:setProperty name="calc" property="var2" value="10" /> After Setting property: variable 2 <br> Name: <jsp:getProperty name="calc" property="name" /><br> Variable 1: <jsp:getProperty name="calc" property="var1" /><br> Variable 2: <jsp:getProperty name="calc" property="var2" /><br> <%= "Result: "+ calc.sum() %> </jsp:useBean> </body> </Html>

70 CalculateBean.java package beans; import java.io.*;
public class CalculateBean implements Serializable { private int var1; private int var2; private String name=new String(); public int getVar1() { return var1; } public int getVar2() { return var2; } public String getName() { return name; } public void setName(String x) { name=x; }

71 CalculateBean.java public void setVar1(int x) { var1=x; }
public void setVar2(int y) var2=y; /*Method for calculating sum*/ public int sum() return var1+var2; } }

72 Place your Beans in Apache tomcat

73 Jar files stands for Java archive. It is similar to a ZIP file.
A Jar tool is provided with Java development kit (JDK) to perform basic tasks with Jar files. Creating a JAR File jar -cvmf jar-fi le-name manifest-file-name input-fi le-names c option stands for creating a Jar file. v stands for verbose output f stands for file to indicate that the output will go into a file m stands for specifying manifest fi le to be added to the Jar File names to be a part of Jar fi le can be specifi ed separated by single white spaces x option stands for extracting the contents.

74 Creating and viewing the contents of JAR file

75 Manifest Files is a special file that can contain information about the files contained in a Jar file. A manifest file could be used to tell which classes in the JAR are bean classes, or which class is the starting point in the JAR, etc. is automatically created (if not provided) when a JAR is created and there will be only one manifest file in a JAR as shown. The manifest’s entries are in “header : value” pairs.

76 Modifying a Manifest File

77 Remote Method Invocation
RMI client/server applications are used over TCP/IP networking model. In TCP/IP, it is the application layer’s responsibility to deal with presentation as well as session layer issues. So the RMI provides the functionality for these layers The presentation layer’s functionality at client and server is handled by stub and skeleton respectively. RRL (Remote Reference Layer) handles the session layer functionality by managing the session among client and server.

78 Stub and Skeleton Stub is a client-side proxy class, whereas Skeleton is a server-side proxy class generated by the special, rmic (rmicompiler). Both these classes are generated from the server (.class) has been compiled by the rmic. (The newer version of JRMP protocol has made Skeleton class obsolete and now it is not generated by the rmic. Functions of Stubs are: Marshalling arguments and unmarshalling return values. Informs the RRL that a call should be invoked on the server. Informs the RRL that the call is complete. The functions performed by Skeleton are: Marshalling return values and unmarshalling arguments. Invoking the actual remote object implementation.

79 RMI over TCP/IP

80 Creating a RMI Application
An interface needs to be created which would contain the definition of the methods that can be invoked remotely. Create a Server class that provides the implementation of the methods in the interface. Generate Stubs using rmic. A client to invoke the remote methods. Run RMI registry. Run server and client.

81 Creating an Interface import java.rmi.*; public interface Calculation extends Remote{ public double remainder(double a, double b) throws RemoteException; public double cube(double a) throws RemoteException;}

82 RMI Server import java.rmi.*; import java.rmi.server.*; public class Server extends UnicastRemoteObject implements Calculation{ public Server() throws RemoteException{ super();} public double remainder(double a,double b) throws RemoteException{ return a%b;} public double cube(double a) throws RemoteException{ return a*a*a;} public static void main(String args[]) throws Exception{ try{ Server s=new Server(); System.out.println(“Object created”); Naming.rebind(“rmi://localhost/Calculator”,s); System.out.println(“Object Registered”);} catch(Exception e){System.out.println(e);}}}

83 RMIRegistry & rmic RMI registry Stub
helps to locate a remote object whose methods it wishes to invoke. a name service which keeps an association of simple names to their corresponding remote objects. runs on the same machine as that of RMI server. objects must register itself by a name on the registry service. Client look up the registered name in the registry service and get a reference to the remote object in return. Stub The stub class is generated by a special rmicompiler (rmic). The Server class is first compiled and then, the rmic is used on the compiled Server class. The stub class generated has the following name: <Servername>_Stub.class.

84 Client import java.rmi.*; public class Client{ public static void main(String args[]) throws Exception{ Calculation c=(Calculation)Naming.lookup(“rmi://localhost/Calculator”); System.out.println(“Remainder of 3.2 % 3.2: “+c.remainder(3.2,3.2)); System.out.println(“Cube of 3.2: “+c.cube(3.2)); }}

85 The Output C:\javabook\programs\CHAP15~1\rmiserver>java Server Object created Object Registered C:\javabook\programs\chap 15\rmiclient>java Client Remainder of 3.2 % 3.2: 0.0 Cube of 3.2:

86 EJB EJB is a server side distributed component
primarily provides business logic The system level services to be handled by EJB server such as multiple threading, object pool, security, instance management, connection pooling, and transactions. based on the concept database related logic should be independent of the business logic that relies on the data.

87 Types of EJB

88 Entity Bean models real world objects/entities.
entities represent business concepts that include a customer or a product. is used to manage a collection of data (also known as persistent data), retrieved from a database. may insert, update or delete data from the database. must implement the javax.ejb.EntityBean interface. are transactional in nature and can be shared among different clients. Two types of entity beans: BMP ( Bean Managed Persistence) and CMP (Container Managed Persistence).

89 Session Bean contain business logic;
used for managing processes or tasks. provides service to the client and it exists for the entire client server session. used for modeling interactions between clients and server. Session beans are aware about transactions. Instances of session beans are not shared among clients. A session beans has to implement the javax.ejb.SessionBean interface. can be either stateful or stateless.

90 Message-driven Beans Can receive messages from Java messaging service (JMS) and perform actions. was introduced in EJB 2.0 specifications inherits the javax.ejb.MessageDrivenBean interface. are asynchronous in nature. clients use a messaging service like JMS in order to send messages to the MDB which are registered against JMS destinations. When the messaging service receives the message for a destination, the EJB container invokes MDB associated with that destination. It is a local object; does not require home or remote interfaces.

91 EJB Architecture specifies two kinds of interfaces for session and entity beans: Home interface (javax.ejb.EJBHome) and contains methods for creating, finding, and destroying remote objects. Remote interface (javax.ejb.EJBObject). contains business methods that are exposed to the clients. container manages interaction between the EJB components using these interface. The local clients use the Home interface for interacting with the EJB. Remote clients use the Remote interface to interact with the EJB

92 EJB Architecture EJB 2.0 specifications added
local (javax.ejb.EJBLocalObject) and Localhome (javax.ejb.EJBLocalHome)interfaces in addition to Remote and Home interface. So according to EJB 2.0, Local and LocalHome interface is used by local client, i.e., clients on the same JVM and Remote interface for clients outside the JVM. What Home interface does for a remote client, LocalHome does the same for a local client and likewise for local and remote interfaces.

93 Summary In this chapter, we have learnt about some of the concepts of advanced Java such as servlets, JDBC, jsp, Java Beans, jar files RMI and EJB. Servlets and JSP are used for generating responses for clients, based on the requests received. JDBC API deals with a variety of databases for storing and manipulating data within them. Java beans used for creating software reusable components Java RMI is the solution for RPC, where a Java program on remote machine can be called from a Java client program. Basically, RMI and EJB helps in distributed computing.


Download ppt "Sachin Malhotra Saurabh Choudhary"

Similar presentations


Ads by Google