SlideShare a Scribd company logo
1 of 53
Get Trained on:
Workshop Agenda
Day 1
1.Understanding Struts2
2.Architecture of Struts2
3.Features of Struts2
4.Environment Setup
5.Understanding Configuration of Project
Day 1 Continue
6.Practical Lab
7.Introduction to Hibernate
8.Demo of Struts2 Application
Understanding Struts2
•Apache Struts 2 is an elegant, extensible framework for
creating enterprise-ready Java web applications.
•The framework is designed to streamline the full
development cycle, from building, to deploying, to
maintaining applications over time.
•To make web development easier for the developers.
MVC Design Pattern
Architecture of Struts2
What kind of MVC is Struts2
Struts 2 is pull MVC
Request Life Cycle
• User sends a request to the server for requesting for
some resource (i.e pages).
• The FilterDispatcher looks at the request and then
determines the appropriate Action.
• Configured interceptors functionalities applies such as
validation, file upload etc.
• Selected action is executed to perform the
requested operation.
• Again, configured interceptors are applied to do any
post-processing if required.
• Finally the result is prepared by the view and returns
the result to the user.
Features of Struts2
• POJO forms and POJO actions
• Tag Support
• AJAX Support
• Easy Integration
Features continued…
• Template Support
• Plugin Support
• Profiling
• Easy to modify tags
• Promote less configuration
• View Technologies (JSP, Velocity, Freemarker,etc)
Environment Setup
4 Simple Steps:
•Step 1 - Setup Java Development Kit (JDK)
•Step 2 - Setup Apache Tomcat
•Step 3 - Setup Eclipse (IDE)
•Step 4 - Setup Struts2 Libraries
Understand Configuring
Project
4 Simple Steps
•Create an Action Class
•Create a View
•Create a launch page
•Now configure all of them
Create an Action Class
public class Student
{
private String fullName;
public String execute() throws Exception {
return "success";
}
public String getFullName() {
return name;
}
public void setFullName(String name) {
this.name = name;
}
}
Create View
<%@ page contentType="text/html; charset=UTF-8" %>
<%@ taglib prefix="s" uri="/struts-tags" %>
<html>
<head>
<title>Welcome to Team Go Getters</title>
</head>
<body>
Hello,
We are glad to have <s:property value=”fullName"/> as our
student.
</body>
</html>
Create a launch page
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Struts2 Workshop</title>
</head>
<body>
<h1>Welcome to Team Go Getters</h1>
<form action=”welcome">
<label for="name">Please enter your name</label><br/>
<input type="text" name=”fullName"/>
<input type="submit" value=”Enroll"/>
</form>
</body>
</html>
Configuration Files
Struts.xml file
•Mapping between URL ,Action classes and Result Types
(View)
•Since Struts 2 requires struts.xml to be present in classes
folder.
• So create struts.xml file under the WebContent/WEB-
INF/classes folder.
Struts.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd">
<struts>
<constant name="struts.devMode" value="true" />
<package name=”workshop" extends="struts-default">
<action name=”welcome"
class="com.teamgogetters.struts2.Student"
method="execute">
<result name="success">/Welcome.jsp</result>
</action>
</package>
</struts>
Multiple struts.xml files
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration
2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd">
<struts>
<include file="my-struts1.xml"/>
<include file="my-struts2.xml"/>
</struts>
Web.xml
• Entry point for any request to Struts 2
• Mapping FilterDispatcher
• Deployment Descriptor
• Security Parameters
Web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
id="WebApp_ID" version="3.0">
<display-name>Struts 2</display-name>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
<filter>
<filter-name>struts2</filter-name>
<filter-class>
org.apache.struts2.dispatcher.FilterDispatcher
</filter-class>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
</web-app>
Interceptors
• Providing preprocessing logic before the action is
called.
• Providing post-processing logic after the action is
called.
• Catching exceptions so that alternate processing can
be performed.
List of Interceptors
• timer
• params
• checkbox
• createSession
• logger
• fileUpload
• scope
• alias
Snippet
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd">
<struts>
<constant name="struts.devMode" value="true" />
<package name=”workshop" extends="struts-default">
<action name=”welcome"
class="com.teamgogetters.struts2.Student"
method="execute">
<interceptor-ref name="params"/>
<interceptor-ref name="timer" />
<result name="success">/welcome.jsp</result>
</action>
</package>
</struts>
Result and Result Types
• <results> tag plays the role of a view in the Struts2 MVC
framework. The action is responsible for executing the
business logic. The next step after executing the business logic
is to display the view using the <results> tag.
• Struts comes with a number of predefined result types and
whatever we've already seen that was the default result type
dispatcher, which is used to dispatch to JSP pages. Struts
allow you to use other markup languages for the view
technology to present the results and popular choices include
Velocity, Freemaker, XSLT and Tiles.
Snippet
<result name="success" type="dispatcher">
<param name="location">
/HelloWorld.jsp
</param >
</result>
<result name="success" type="freemarker">
<param name="location">
/hello.fm
</param>
</result>
<result name="success" type="freemarker">
<param name="location">
/hello.fm
</param>
</result>
Practical Lab
JDBC is going obsolete?
• Complex if it is used in large projects
• Large programming overhead
• No encapsulation
• Hard to implement MVC concept
• Query is DBMS specific
What’s Next ?
Hibernate: ORM
• Hibernate is a high-performance Object/Relational
persistence and query service
• Hibernate takes care of the mapping from Java classes to
database tables
• Hibernate data query and retrieval facilities
ORM New Generation
1. Let business code access objects rather than DB tables.
2. Hides details of SQL queries from OO logic.
3. Based on JDBC 'under the hood’
4. No need to deal with the database implementation.
ORM New Generation…
5. Entities based on business concepts rather than
database structure.
6. Transaction management and automatic key
generation.
7. Fast development of application.
Visual presentation of
Hibernate
Demo
Day 2 Agenda
1.Day 1 Glimpse
2.Architecture of Hibernate
3.Core classes of Hibernate
4.Hibernate configuration
5.States of Persistent Class Instances
7. Overview of Caching in Hibernate
8. Understanding Spring
9. Why Spring?
10. Core Concepts of Spring
11. Spring Architecture
12. Architecture of Live Project
Architecture of Hibernate
Detailed Architecture
Core classes
• Configuration : Loads Configuration.
• SessionFactory : Only one per database. Thread safe.
• Session : Not thread safe.
• Transaction : Handle transaction management.
• Query : SQL or HQL
• Criteria: Object oriented retrieval from database.
Hibernate Configuration
States of Persistent Class Instance
• transient: A new instance of a a persistent class which is not
associated with a Session and has no representation in the
database and no identifier value is considered transient by
Hibernate.
• persistent: You can make a transient instance persistent by
associating it with a Session. A persistent instance has a
representation in the database, an identifier value and is
associated with a Session.
• detached: Once we close the Hibernate Session, the
persistent instance will become a detached instance.
Overview of Caching
Understanding Spring
• Spring framework is an open source Java platform that
provides comprehensive infrastructure support for developing
robust Java applications very easily and very rapidly.
• Spring framework is an open source Java platform and it was
initially written by Rod Johnson and was first released under
the Apache 2.0 license in June 2003.
• It is simple because it just requires POJOs
Why Spring?
• Spring is organized in a modular fashion.
• Spring does not reinvent the wheel
• Testing an application written with Spring is simple because
environment-dependent code is moved into this framework
• Spring's web framework is a well-designed web MVC
framework
• Spring provides a consistent transaction management
interface
Core Concepts
• Dependency Injection
• Aspect oriented programming
Dependency Injection
“Simple. Inject dependent objects.”
Aspect Oriented
Programming
““Isolate function (cross cutting concerns) from objects they
affect””
Spring Architecture
Architecture of Live Project
Demo of Live Project
Thank you from :
Reach Us
Name: Jay Shah(Founder of Team Go Getters)
Contact No: +918980965112
Personal Email: jay.shahse@gmail.com

More Related Content

What's hot

Session 36 - JSP - Part 1
Session 36 - JSP - Part 1Session 36 - JSP - Part 1
Session 36 - JSP - Part 1PawanMM
 
2015 Java update and roadmap, JUG sevilla
2015  Java update and roadmap, JUG sevilla2015  Java update and roadmap, JUG sevilla
2015 Java update and roadmap, JUG sevillaTrisha Gee
 
Java EE revisits design patterns
Java EE revisits design patterns Java EE revisits design patterns
Java EE revisits design patterns Alex Theedom
 
Parallel batch processing with spring batch slideshare
Parallel batch processing with spring batch   slideshareParallel batch processing with spring batch   slideshare
Parallel batch processing with spring batch slideshareMorten Andersen-Gott
 
Spring - Part 4 - Spring MVC
Spring - Part 4 - Spring MVCSpring - Part 4 - Spring MVC
Spring - Part 4 - Spring MVCHitesh-Java
 
Alfresco Content Modelling and Policy Behaviours
Alfresco Content Modelling and Policy BehavioursAlfresco Content Modelling and Policy Behaviours
Alfresco Content Modelling and Policy BehavioursJ V
 
Java EE 7 Batch processing in the Real World
Java EE 7 Batch processing in the Real WorldJava EE 7 Batch processing in the Real World
Java EE 7 Batch processing in the Real WorldRoberto Cortez
 
Drools Happenings 7.0 - Devnation 2016
Drools Happenings 7.0 - Devnation 2016Drools Happenings 7.0 - Devnation 2016
Drools Happenings 7.0 - Devnation 2016Mark Proctor
 
Java EE 8 Update
Java EE 8 UpdateJava EE 8 Update
Java EE 8 UpdateRyan Cuprak
 
Hibernate - Part 1
Hibernate - Part 1Hibernate - Part 1
Hibernate - Part 1Hitesh-Java
 
Apache Cayenne: a Java ORM Alternative
Apache Cayenne: a Java ORM AlternativeApache Cayenne: a Java ORM Alternative
Apache Cayenne: a Java ORM AlternativeAndrus Adamchik
 
MSc Enterprise Systems Development Guest Lecture at UniS (2/12/09)
MSc Enterprise Systems Development Guest Lecture at UniS (2/12/09)MSc Enterprise Systems Development Guest Lecture at UniS (2/12/09)
MSc Enterprise Systems Development Guest Lecture at UniS (2/12/09)Daniel Bryant
 
App Grid Dev With Coherence
App Grid Dev With CoherenceApp Grid Dev With Coherence
App Grid Dev With CoherenceJames Bayer
 
Java IO, Serialization
Java IO, Serialization Java IO, Serialization
Java IO, Serialization Hitesh-Java
 
Spring Batch Workshop (advanced)
Spring Batch Workshop (advanced)Spring Batch Workshop (advanced)
Spring Batch Workshop (advanced)lyonjug
 
ORM, JPA, & Hibernate Overview
ORM, JPA, & Hibernate OverviewORM, JPA, & Hibernate Overview
ORM, JPA, & Hibernate OverviewBrett Meyer
 
Build Java Web Application Using Apache Struts
Build Java Web Application Using Apache Struts Build Java Web Application Using Apache Struts
Build Java Web Application Using Apache Struts weili_at_slideshare
 

What's hot (19)

Session 36 - JSP - Part 1
Session 36 - JSP - Part 1Session 36 - JSP - Part 1
Session 36 - JSP - Part 1
 
2015 Java update and roadmap, JUG sevilla
2015  Java update and roadmap, JUG sevilla2015  Java update and roadmap, JUG sevilla
2015 Java update and roadmap, JUG sevilla
 
Hibernate performance tuning
Hibernate performance tuningHibernate performance tuning
Hibernate performance tuning
 
Java EE revisits design patterns
Java EE revisits design patterns Java EE revisits design patterns
Java EE revisits design patterns
 
Parallel batch processing with spring batch slideshare
Parallel batch processing with spring batch   slideshareParallel batch processing with spring batch   slideshare
Parallel batch processing with spring batch slideshare
 
Spring - Part 4 - Spring MVC
Spring - Part 4 - Spring MVCSpring - Part 4 - Spring MVC
Spring - Part 4 - Spring MVC
 
Alfresco Content Modelling and Policy Behaviours
Alfresco Content Modelling and Policy BehavioursAlfresco Content Modelling and Policy Behaviours
Alfresco Content Modelling and Policy Behaviours
 
Java EE 7 Batch processing in the Real World
Java EE 7 Batch processing in the Real WorldJava EE 7 Batch processing in the Real World
Java EE 7 Batch processing in the Real World
 
Drools Happenings 7.0 - Devnation 2016
Drools Happenings 7.0 - Devnation 2016Drools Happenings 7.0 - Devnation 2016
Drools Happenings 7.0 - Devnation 2016
 
Java EE 8 Update
Java EE 8 UpdateJava EE 8 Update
Java EE 8 Update
 
Hibernate - Part 1
Hibernate - Part 1Hibernate - Part 1
Hibernate - Part 1
 
Apache Cayenne: a Java ORM Alternative
Apache Cayenne: a Java ORM AlternativeApache Cayenne: a Java ORM Alternative
Apache Cayenne: a Java ORM Alternative
 
MSc Enterprise Systems Development Guest Lecture at UniS (2/12/09)
MSc Enterprise Systems Development Guest Lecture at UniS (2/12/09)MSc Enterprise Systems Development Guest Lecture at UniS (2/12/09)
MSc Enterprise Systems Development Guest Lecture at UniS (2/12/09)
 
App Grid Dev With Coherence
App Grid Dev With CoherenceApp Grid Dev With Coherence
App Grid Dev With Coherence
 
Java IO, Serialization
Java IO, Serialization Java IO, Serialization
Java IO, Serialization
 
Spring Batch Workshop (advanced)
Spring Batch Workshop (advanced)Spring Batch Workshop (advanced)
Spring Batch Workshop (advanced)
 
Spring framework core
Spring framework coreSpring framework core
Spring framework core
 
ORM, JPA, & Hibernate Overview
ORM, JPA, & Hibernate OverviewORM, JPA, & Hibernate Overview
ORM, JPA, & Hibernate Overview
 
Build Java Web Application Using Apache Struts
Build Java Web Application Using Apache Struts Build Java Web Application Using Apache Struts
Build Java Web Application Using Apache Struts
 

Similar to Struts2-Spring=Hibernate

Strut2-Spring-Hibernate
Strut2-Spring-HibernateStrut2-Spring-Hibernate
Strut2-Spring-HibernateJay Shah
 
Struts 2-overview2
Struts 2-overview2Struts 2-overview2
Struts 2-overview2divzi1913
 
Struts 2-overview2
Struts 2-overview2Struts 2-overview2
Struts 2-overview2Long Nguyen
 
JSP-Servlet.ppt
JSP-Servlet.pptJSP-Servlet.ppt
JSP-Servlet.pptMouDhara1
 
Modern Cloud-Native Jakarta EE Frameworks: tips, challenges, and trends.
Modern Cloud-Native Jakarta EE Frameworks: tips, challenges, and trends.Modern Cloud-Native Jakarta EE Frameworks: tips, challenges, and trends.
Modern Cloud-Native Jakarta EE Frameworks: tips, challenges, and trends.Otávio Santana
 
Struts 2 Overview
Struts 2 OverviewStruts 2 Overview
Struts 2 Overviewskill-guru
 
01 Struts Intro
01 Struts Intro01 Struts Intro
01 Struts Introsdileepec
 
The JAVA Training Workshop in Ahmedabad
The JAVA Training Workshop in AhmedabadThe JAVA Training Workshop in Ahmedabad
The JAVA Training Workshop in AhmedabadTOPS Technologies
 
JavaScript and jQuery for SharePoint Developers
JavaScript and jQuery for SharePoint DevelopersJavaScript and jQuery for SharePoint Developers
JavaScript and jQuery for SharePoint DevelopersRob Windsor
 
BITM3730Week12.pptx
BITM3730Week12.pptxBITM3730Week12.pptx
BITM3730Week12.pptxMattMarino13
 
Advance Java Topics (J2EE)
Advance Java Topics (J2EE)Advance Java Topics (J2EE)
Advance Java Topics (J2EE)slire
 
Struts Interview Questions
Struts Interview QuestionsStruts Interview Questions
Struts Interview Questionsjbashask
 

Similar to Struts2-Spring=Hibernate (20)

Strut2-Spring-Hibernate
Strut2-Spring-HibernateStrut2-Spring-Hibernate
Strut2-Spring-Hibernate
 
Struts 2-overview2
Struts 2-overview2Struts 2-overview2
Struts 2-overview2
 
Struts 2-overview2
Struts 2-overview2Struts 2-overview2
Struts 2-overview2
 
Jsp
JspJsp
Jsp
 
JSP-Servlet.ppt
JSP-Servlet.pptJSP-Servlet.ppt
JSP-Servlet.ppt
 
10 jsp-scripting-elements
10 jsp-scripting-elements10 jsp-scripting-elements
10 jsp-scripting-elements
 
Modern Cloud-Native Jakarta EE Frameworks: tips, challenges, and trends.
Modern Cloud-Native Jakarta EE Frameworks: tips, challenges, and trends.Modern Cloud-Native Jakarta EE Frameworks: tips, challenges, and trends.
Modern Cloud-Native Jakarta EE Frameworks: tips, challenges, and trends.
 
Struts 2 Overview
Struts 2 OverviewStruts 2 Overview
Struts 2 Overview
 
01 Struts Intro
01 Struts Intro01 Struts Intro
01 Struts Intro
 
Struts Into
Struts IntoStruts Into
Struts Into
 
Struts Interceptors
Struts InterceptorsStruts Interceptors
Struts Interceptors
 
The JAVA Training Workshop in Ahmedabad
The JAVA Training Workshop in AhmedabadThe JAVA Training Workshop in Ahmedabad
The JAVA Training Workshop in Ahmedabad
 
AJppt.pptx
AJppt.pptxAJppt.pptx
AJppt.pptx
 
JavaScript and jQuery for SharePoint Developers
JavaScript and jQuery for SharePoint DevelopersJavaScript and jQuery for SharePoint Developers
JavaScript and jQuery for SharePoint Developers
 
Java training in ahmedabad
Java training in ahmedabadJava training in ahmedabad
Java training in ahmedabad
 
BITM3730Week12.pptx
BITM3730Week12.pptxBITM3730Week12.pptx
BITM3730Week12.pptx
 
Advance Java Topics (J2EE)
Advance Java Topics (J2EE)Advance Java Topics (J2EE)
Advance Java Topics (J2EE)
 
JavaScript-Core
JavaScript-CoreJavaScript-Core
JavaScript-Core
 
JavaScript-Core
JavaScript-CoreJavaScript-Core
JavaScript-Core
 
Struts Interview Questions
Struts Interview QuestionsStruts Interview Questions
Struts Interview Questions
 

Recently uploaded

Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantAxelRicardoTrocheRiq
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsArshad QA
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerThousandEyes
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdfWave PLM
 
Test Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and BackendTest Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and BackendArshad QA
 
What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number SystemsJheuzeDellosa
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfkalichargn70th171
 
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfThe Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfkalichargn70th171
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providermohitmore19
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software DevelopersVinodh Ram
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxComplianceQuest1
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...kellynguyen01
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AIABDERRAOUF MEHENNI
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️anilsa9823
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataBradBedford3
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideChristina Lin
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsAndolasoft Inc
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxbodapatigopi8531
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto González Trastoy
 

Recently uploaded (20)

Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service Consultant
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
Test Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and BackendTest Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and Backend
 
What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number Systems
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfThe Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software Developers
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
 
Exploring iOS App Development: Simplifying the Process
Exploring iOS App Development: Simplifying the ProcessExploring iOS App Development: Simplifying the Process
Exploring iOS App Development: Simplifying the Process
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.js
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptx
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 

Struts2-Spring=Hibernate

  • 1.
  • 3. Workshop Agenda Day 1 1.Understanding Struts2 2.Architecture of Struts2 3.Features of Struts2 4.Environment Setup 5.Understanding Configuration of Project
  • 4. Day 1 Continue 6.Practical Lab 7.Introduction to Hibernate 8.Demo of Struts2 Application
  • 5. Understanding Struts2 •Apache Struts 2 is an elegant, extensible framework for creating enterprise-ready Java web applications. •The framework is designed to streamline the full development cycle, from building, to deploying, to maintaining applications over time. •To make web development easier for the developers.
  • 8. What kind of MVC is Struts2 Struts 2 is pull MVC
  • 9. Request Life Cycle • User sends a request to the server for requesting for some resource (i.e pages). • The FilterDispatcher looks at the request and then determines the appropriate Action. • Configured interceptors functionalities applies such as validation, file upload etc.
  • 10. • Selected action is executed to perform the requested operation. • Again, configured interceptors are applied to do any post-processing if required. • Finally the result is prepared by the view and returns the result to the user.
  • 11. Features of Struts2 • POJO forms and POJO actions • Tag Support • AJAX Support • Easy Integration
  • 12. Features continued… • Template Support • Plugin Support • Profiling • Easy to modify tags • Promote less configuration • View Technologies (JSP, Velocity, Freemarker,etc)
  • 13. Environment Setup 4 Simple Steps: •Step 1 - Setup Java Development Kit (JDK) •Step 2 - Setup Apache Tomcat •Step 3 - Setup Eclipse (IDE) •Step 4 - Setup Struts2 Libraries
  • 14. Understand Configuring Project 4 Simple Steps •Create an Action Class •Create a View •Create a launch page •Now configure all of them
  • 15. Create an Action Class public class Student { private String fullName; public String execute() throws Exception { return "success"; } public String getFullName() { return name; } public void setFullName(String name) { this.name = name; } }
  • 16. Create View <%@ page contentType="text/html; charset=UTF-8" %> <%@ taglib prefix="s" uri="/struts-tags" %> <html> <head> <title>Welcome to Team Go Getters</title> </head> <body> Hello, We are glad to have <s:property value=”fullName"/> as our student. </body> </html>
  • 17. Create a launch page <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> <%@ taglib prefix="s" uri="/struts-tags"%> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title>Struts2 Workshop</title> </head> <body> <h1>Welcome to Team Go Getters</h1> <form action=”welcome"> <label for="name">Please enter your name</label><br/> <input type="text" name=”fullName"/> <input type="submit" value=”Enroll"/> </form> </body> </html>
  • 18. Configuration Files Struts.xml file •Mapping between URL ,Action classes and Result Types (View) •Since Struts 2 requires struts.xml to be present in classes folder. • So create struts.xml file under the WebContent/WEB- INF/classes folder.
  • 19. Struts.xml <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN" "http://struts.apache.org/dtds/struts-2.0.dtd"> <struts> <constant name="struts.devMode" value="true" /> <package name=”workshop" extends="struts-default"> <action name=”welcome" class="com.teamgogetters.struts2.Student" method="execute"> <result name="success">/Welcome.jsp</result> </action> </package> </struts>
  • 20. Multiple struts.xml files <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN" "http://struts.apache.org/dtds/struts-2.0.dtd"> <struts> <include file="my-struts1.xml"/> <include file="my-struts2.xml"/> </struts>
  • 21. Web.xml • Entry point for any request to Struts 2 • Mapping FilterDispatcher • Deployment Descriptor • Security Parameters
  • 22. Web.xml <?xml version="1.0" encoding="UTF-8"?> <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0"> <display-name>Struts 2</display-name> <welcome-file-list> <welcome-file>index.jsp</welcome-file> </welcome-file-list> <filter> <filter-name>struts2</filter-name> <filter-class> org.apache.struts2.dispatcher.FilterDispatcher </filter-class> </filter> <filter-mapping> <filter-name>struts2</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> </web-app>
  • 23. Interceptors • Providing preprocessing logic before the action is called. • Providing post-processing logic after the action is called. • Catching exceptions so that alternate processing can be performed.
  • 24. List of Interceptors • timer • params • checkbox • createSession • logger • fileUpload • scope • alias
  • 25. Snippet <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN" "http://struts.apache.org/dtds/struts-2.0.dtd"> <struts> <constant name="struts.devMode" value="true" /> <package name=”workshop" extends="struts-default"> <action name=”welcome" class="com.teamgogetters.struts2.Student" method="execute"> <interceptor-ref name="params"/> <interceptor-ref name="timer" /> <result name="success">/welcome.jsp</result> </action> </package> </struts>
  • 26. Result and Result Types • <results> tag plays the role of a view in the Struts2 MVC framework. The action is responsible for executing the business logic. The next step after executing the business logic is to display the view using the <results> tag. • Struts comes with a number of predefined result types and whatever we've already seen that was the default result type dispatcher, which is used to dispatch to JSP pages. Struts allow you to use other markup languages for the view technology to present the results and popular choices include Velocity, Freemaker, XSLT and Tiles.
  • 27. Snippet <result name="success" type="dispatcher"> <param name="location"> /HelloWorld.jsp </param > </result> <result name="success" type="freemarker"> <param name="location"> /hello.fm </param> </result> <result name="success" type="freemarker"> <param name="location"> /hello.fm </param> </result>
  • 29. JDBC is going obsolete? • Complex if it is used in large projects • Large programming overhead • No encapsulation • Hard to implement MVC concept • Query is DBMS specific
  • 31. Hibernate: ORM • Hibernate is a high-performance Object/Relational persistence and query service • Hibernate takes care of the mapping from Java classes to database tables • Hibernate data query and retrieval facilities
  • 32. ORM New Generation 1. Let business code access objects rather than DB tables. 2. Hides details of SQL queries from OO logic. 3. Based on JDBC 'under the hood’ 4. No need to deal with the database implementation.
  • 33. ORM New Generation… 5. Entities based on business concepts rather than database structure. 6. Transaction management and automatic key generation. 7. Fast development of application.
  • 35. Demo
  • 36. Day 2 Agenda 1.Day 1 Glimpse 2.Architecture of Hibernate 3.Core classes of Hibernate 4.Hibernate configuration 5.States of Persistent Class Instances
  • 37. 7. Overview of Caching in Hibernate 8. Understanding Spring 9. Why Spring? 10. Core Concepts of Spring 11. Spring Architecture 12. Architecture of Live Project
  • 40. Core classes • Configuration : Loads Configuration. • SessionFactory : Only one per database. Thread safe. • Session : Not thread safe. • Transaction : Handle transaction management. • Query : SQL or HQL • Criteria: Object oriented retrieval from database.
  • 42. States of Persistent Class Instance • transient: A new instance of a a persistent class which is not associated with a Session and has no representation in the database and no identifier value is considered transient by Hibernate. • persistent: You can make a transient instance persistent by associating it with a Session. A persistent instance has a representation in the database, an identifier value and is associated with a Session. • detached: Once we close the Hibernate Session, the persistent instance will become a detached instance.
  • 44. Understanding Spring • Spring framework is an open source Java platform that provides comprehensive infrastructure support for developing robust Java applications very easily and very rapidly. • Spring framework is an open source Java platform and it was initially written by Rod Johnson and was first released under the Apache 2.0 license in June 2003. • It is simple because it just requires POJOs
  • 45. Why Spring? • Spring is organized in a modular fashion. • Spring does not reinvent the wheel • Testing an application written with Spring is simple because environment-dependent code is moved into this framework • Spring's web framework is a well-designed web MVC framework • Spring provides a consistent transaction management interface
  • 46. Core Concepts • Dependency Injection • Aspect oriented programming
  • 47. Dependency Injection “Simple. Inject dependent objects.”
  • 48. Aspect Oriented Programming ““Isolate function (cross cutting concerns) from objects they affect””
  • 51. Demo of Live Project
  • 53. Reach Us Name: Jay Shah(Founder of Team Go Getters) Contact No: +918980965112 Personal Email: jay.shahse@gmail.com