1 / 20

The Many Variations of Java EE Applications

The Many Variations of Java EE Applications. Many Flavors of Web Interface the three-tier Java EE application that interacts with a user through

conor
Télécharger la présentation

The Many Variations of Java EE Applications

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. The Many Variations of Java EE Applications Many Flavors of Web Interface the three-tier Java EE application that interacts with a user through a client interface, processes incoming information, and stores and retrieves application data in a database, it captures the essence of almost every Java EE application. java servlets are very powerful and flexible and make a great foundation for web Applications it is a replacement for CGI programming because no. of disadvantages 1.If number of clients increases, it takes more time for sending response. 2.For each request, it starts a process and Web server is limited to start processes. 3.It uses platform dependent language e.g. C, C++, perl. Java EE offers a superior web component model to generate dynamic web content for browsers of all kinds: JavaServer Pages (JSP) and JavaServer Faces (JSF).

  2. JSP tag libraries are a powerful organizing technology, and they enhance the reusability of the user interface logic held within a JSP page. • Java Server Faces is the second type of web component that provides a higher-level framework, • including prebuilt user interface components such as lists, buttons, and tables, together with the ability to validate input and define user interaction flows.

  3. The Java EE platform contains a variety of web components that can handle and respond to incoming web service calls. Known as Java Web Service components, these components are to both Simple Object Access Protocol (SOAP) and to Representational State Transfer (REST) web services . • It is a standard message protocol possesses only two fundamental properties.  They are, • Send and receive HTTP transport protocol packets. • Process XML messages. • REST is a web standards based architecture and uses HTTP Protocol for data communication. It revolves around resources where every component is a resource and a resource is accessed by a common interface using HTTP standard methods. • The final type of web component in the Java EE platform gives a server component the ability to send data out to interested clients and is called the Java Web Socket.

  4. Many Kinds of Application Logic: Enterprise Java Beans (EJB) is a development architecture for building highly scalable and robust enterprise level applications to be deployed on J2EE compliant Application Server such as JBOSS, Web Logic etc. A stateless session bean is a type of enterprise bean, which is normally used to perform independent operations A stateful session bean is a type of enterprise bean, which preserve the conversational state with client. A stateful session bean as per its name keeps associated client state in its instance variables. A message driven bean is a type of enterprise bean, which is invoked by EJB container when it receives a message from queue or topic. Message driven bean is a stateless bean and is used to do task asynchronously.

  5. Different Ways to Store Application Data: • The data layer of the Hello Java EE application was created and managed using the Java Persistence API. This API offers a high-level framework with which applications can perform object-relational mapping. • In other words, data objects that you want to model in your application can easily be translated into equivalent data tables in a relational database, which can be a shortcut to designing relational schemas and the various queries needed to store and retrieve the data. • Java EE offers the alternative and more traditional Java Database Connectivity API. • Java Transaction API allows multiple activities to be grouped into a single atomic action that either succeeds, meaning each member of the atomic action succeeds, or fails, • Interfacing with Other Systems: there are three technologies in the platform cater to this outgrowth of the class of Java EE applications. The first we have already touched on: many Java EE applications interface with other systems such as analytics servers, purchasing systems, and order management servers and equivalent systems using the Java web services APIs.

  6. CREATE TABLE  "REGISTERUSER"     (     "NAME" VARCHAR2(4000),        "PASS" VARCHAR2(4000),        "EMAIL" VARCHAR2(4000),        "COUNTRY" VARCHAR2(4000)      )  

  7. <html>   <body>   <form action="servlet/Register" method="post">   Name:<input type="text" name="userName"/><br/><br/>   Password:<input type="password" name="userPass"/><br/><br/>   Email Id:<input type="text" name="userEmail"/><br/><br/>   Country:   <select name="userCountry">   <option>India</option>   <option>Pakistan</option>   <option>other</option>   </select>   <br/><br/>   <input type="submit" value="register"/>   </form>   </body>   </html>  

  8. import java.io.*;   importjava.sql.*;   importjavax.servlet.ServletException;   importjavax.servlet.http.*;   publicclass Register extendsHttpServlet {   publicvoiddoPost(HttpServletRequest request, HttpServletResponse response)   throwsServletException, IOException {   response.setContentType("text/html");   PrintWriter out = response.getWriter();   String n=request.getParameter("userName");   String p=request.getParameter("userPass");   String e=request.getParameter("userEmail");   String c=request.getParameter("userCountry");  

  9. try{   Class.forName("oracle.jdbc.driver.OracleDriver"); Connection con=DriverManager.getConnection(   "jdbc:oracle:thin:@localhost:1521:xe","system","oracle");   PreparedStatementps=con.prepareStatement(   "insert into registeruser values(?,?,?,?)");   ps.setString(1,n);   ps.setString(2,p);   ps.setString(3,e);   ps.setString(4,c);   int i=ps.executeUpdate();   if(i>0)   out.print("You are successfully registered...");  

  10. }catch (Exception e2)  { System.out.println(e2); } out.close();   }   }

  11. Many Kinds of Application Logic • Enterprise Beans are instantiated by the EJB container • each time a new client wishes to use it. This is especially useful in the kind of application that needs to hold its application state for each of its connected clients,

  12. Modularity: • The fundamental three-tier approach of the Java EE platform inherently divides Java EE applications • into the three corresponding areas: presentation in the web tier, application logic in the Enterprise Bean tier, and persistent application data in the data tier. • However, the dependency injection framework allows for the separation of a wide variety of application functions into separate Java classes, and whose instances; lifecycles can be managed by the Java EE container rather than the application. This design pattern can dramatically increase the modularity of Java EE applications. Ways to Secure Java EE Applications: • the Java EE security model focuses on the tasks of restricting access to Java EE applications only to certain known users and to a certain range of protocols. Using a mix of Java annotations, static configuration, and runtime API calls, Java EE applications can be adapted to a wide range of security policies.

  13. Packaging and Deploying Java EE Application: • how to develop, package, and deploy the application. • The Hello Java EE application, as we have seen, consists of web components and an Enterprise Bean and data code. • For deploying the web components in a Java EE application is a file called the Web ARchive file (WAR). The WAR format is a kind of ZIP file, with a predefined structure consisting of a root directory to hold any textual web pages such as HTML pages, JSP, or JSF files. • Additionally, this file type has a special /WEB-INF directory under which any Java class files they need, such as Java servlets, are held, in addition to other configuration information • Moving to the application’s next tier, the application code residing in the Enterprise Bean is packaged in a similar but different kind of archive called an Enterprise Bean JAR. The Enterprise Bean JAR uses the /META-INF directory to store configuration information about the Enterprise Beans it contains,

  14. These relatively straightforward WAR and Enterprise Bean JAR file structures do have variations: some Java EE applications need more configuration information. • This information is contained in special configuration files called deployment descriptor files, which are co-packaged in the archives in the /WEB-INF directory of the WAR file and the /META-INF directory of the Enterprise Bean JAR file. Some Java EE applications co-package JAR files containing library classes and resources, • The final step, which allows the Hello Java EE application to be packaged into one single, self-contained file, is to package these two archives into a third kind of ZIP file called the Enterprise ARchive or EAR file. • This, too, may carry extra configuration information for more sophisticated applications, in which case this configuration information would be held in the /META-INF directory of the WAR file. Otherwise, the EAR file simply contains the web WAR and Enterprise Bean JAR files,

  15. Java EE Platform and Implementations: • the great strength of the platform is that it has many different implementations. What this means is that there are several application servers that support all the application API calls, component models, configuration semantics, security model, database model, and so on that are part of the definition of the platform. • Some Java application servers offer straightforward, basic tools for deploying and managing applications and for administering the server. Other Java EE applications offer sophisticated suites of tools for managing applications and analytics, and monitoring many dimensions of the performance of the running server.

More Related