2. Java 2 Platform Enterprise Edition(J2EE)
1. J2EE is an architecture for implementing enterprise class applications using Java and
Internet Technology
2. The original J2EE specification was developed by Sun Microsystems.
3. The J2EE platform consists of a set of services, APIs, and protocols that provide the
functionality for developing multitierd, Web-based applications.
4. The server side java industry has gone through a whirl wind of change in following years.
4. Advantages of J2EE
1. High availability
2. Scalability
3. Integration with existing systems
4. Freedom to choose vendors of application servers, tools, components
5. Multi-platform
6. J2EE Tiers
1. Client Presentation
• HTML or Java applets deployed in Browser
• XML documentations transmitted through HTTP
• Java clients running in Client Java Virtual Machine (JVM)
2. Presentation Logic
◦ Servlets or Java Server Pages running in web server
3. Application Logic
◦ Enterprise JavaBeans running in Server
7. J2EE Application Model
Browser is able to process HTML and applets pages.
It forwards requests to the web server, which has JSPs and Servlets
Servlets and JSPs may access EJB server.
Java Stand alone runs on java client, which access EJB server using RMI.
9. JSP
1. Used for web pages with dynamic content
2. Processes HTTP requests (non-blocking call-and-return)
3. Accepts HTML tags, special JSP tags, and script-lets of Java code
4. Separates static content from presentation logic
5. Can be created by web designer using HTML tools
12. JSP example
</td> </tr>
</form> </table>
<%
if (request.getParameter("username") != null) {
%>
<%@ include file="response.jsp" %>
<%
}
%>
</body>
</html>
13. JSP Advantages
Performance
• Runtime characteristics of servlets
• Automatic recompilation of modified pages
• Server side processing
Programming
• Emphasize use of reusable components
• Write Once , Run Anywhere properties
• Extensible through custom tag libraries
Provides front end access mechanism to EJBs
14. Servlet Overview
1. Server is Java program that runs as separate thread and processes HTTP request inside
servlet container.
2. Replaced Common Gateway Interface(CGI) or Active Server Pages (ASP)
3. Generate dynamic response to requests from web based clients
4. It interact with web client using response request paradigm
5. Written in Java; uses print statements to render HTML
6. Loaded into memory once and then called many times
7. Provides APIs for session management
15. Servlet example
public class HelloWorldServlet extends HttpServlet {
public void service(HttpServletRequest req,
HttpServletResponse res) throws IOException {
res.setContentType("text/html");
PrintWriter out = res.getWriter();
out.println("<html><head><title>Hello
World Servlet</title></head>");
out.println("<body><h1>Hello
World!</h1></body></html>");
}}
16. Java Beans
According to Oracle java bean is a reusable software component. A bean encapsulates many
objects into one object, so we can access this object from multiple places. Moreover, it provides
the easy maintenance.
A java class is considered java bean class if it follows following condition:-
1. It should have a no-arg constructor.
2. It should be Serializable.
3. It should provide methods to set and get the values of the properties, known as getter and
setter methods.
17. Example of Java Bean Class
package mypack;
public class Employee implements java.io.Serializable{
private int id;
private String name;
public Employee(){}
public void setId(int id){this.id=id;}
public int getId(){return id;}
public void setName(String name){this.name=name;}
public String getName(){return name;} }
package mypack;
public class Test{
public static void main(String args[]){
Employee e=new Employee();
//object is created
e.setName("Arjun");
//setting value to the object
System.out.println(e.getName());
}}
Accessing
Java Bean
Making Java
Bean Class
19. Enterprise Java Beans (EJBs)
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.
• Entity Beans
1. Represent persistent business Entity.
2. Persisted in storage system ( usually Database).
3. Might contain Application logic intrinsic to entity.
• Session Beans
1. Perform work for individual clients on the server.
2. Encapsulate complex business logic.
3. Can coordinate transactional work on multiple entity beans.
20. Summer Project-
Online Recruitment Process
Online Recruitment Portal is one of the large commercial and informative website providing its
services to all kinds of people. Major functionalities of the site include providing services to
recruitment agencies, software and hardware development companies, job seekers and e-
learners.
There are two modules in this project
1.Job Provider/HR
2.Job Seeker
21. 1.Job Provider is the one who offers jobs to the job seekers.
Initially, he has to register himself to the site. Once the job
providers register with site by giving the details of their
company he can login into the site using the email address and
password set during registration and achieve the services like
placing the job advertisement for the people with specific skills
.He is provided with two specific services such as:
1. Add jobs: - The employer can add the jobs according to his
requirements.
2. List jobs: - The employer can view the list of jobs he
previously added, he can view applicants for the jobs and can
delete the jobs that are filled.
3. Change profile: - The job seeker can change his profile as the
academic qualifications, skillset, etc., can change with time.
4. Change Password: - The job seeker has the option to change
his password as and when required.
22. 2.Job Seeker is the one who is need for the job. Initially, he has
to register himself to the site. After
Registration he can login using his email id and password. Job
seekers can search for the jobs by giving the queries and
getting the information. He is provided with 3 specific services
such as:
1. Search jobs: - The job seeker can search for the jobs
depending on his skills, academic qualifications and can apply
for the job.
2. Change profile: - The job seeker can change his profile as the
academic qualifications, skillset, etc., can change with time.
3. Change Password: - The job seeker has the option to change
his password as and when required.
24. Sources & Resources
•Java 2 Platform Enterprise Edition Specification, v1.3
•Designing Enterprise Applications with the Java 2,
Enterprise Edition. Nicholas Kassen and the Enterprise Team
•Javatpoint.com
•Oracle.com
•Wikipedia.com