Nearby lessons
5 of 19Hibernate - Integration with MySQL
- Understand Hibernate - Integration with MySQL
- See working code examples
- Learn from common mistakes and Q&A
Learn Hibernate - Integration with MySQL step by step — simple explanations, complete programs with their output, common beginner mistakes, and exam-style MCQs.
Struts Overview
Framework is a semi implemented application, it will be used to design applications in
simplified manner.
Framework is prefabricated software units that programmer can share, customize, reuse in
order to simplify application development.
Framework is the collection of predefined classes and interfaces to simplify application
development.
In general, in Applications development, Frameworks will provide the following advantages.
- Frameworks will provide common implementation in all the projects as predefined
implementation
EX: Controller Servlets and the services like I18N, Exception Handling, Validations ,.....
- Frameworks will provide standard template to design applications.
- Frameworks will provide standard flow of execution between the components.
- Frameworks will reduce application development time.
- Frameworks will reduce application development cost.
- Frameworks will improve productivity.
- Frameworks will provide modularity in application development.
There are two types of Frameworks.
- Web Frameworks
- Application Frameworks
What is the difference between web frameworks and Application Frameworks?
Answer:
Web Frameworks will provide very good environment to prepare and execute web applications
only.
EX: Struts, JSF.
Application Frameworks will provide very good environment to prepare and execute any type of
JAVA/J2EE Applications including Standalone Applications, Web applications, Distributed
Applications,
EX: Spring
Struts is MVC based web framework provided by Apache Software Foundations.
Struts is existed in two versions.
Struts Overview
If we want to prepare Struts applications in Struts1.x version then we have to use the following
components
- View
- Deployment Descriptor
- Controller [ActionServlet]
- Action class
- Action Form
- Struts Configuration File
- View:
In Struts applications, View part is representing presentation part.
In web applications, there are two types of presentation part.
- Informational Presentation part
- Form Based Presentation part
- Informational Presentation part
This type view part is able to provide only information to the user, which includes status of the
server side actions like Success, failure, ... and display a particular database table data,.....
EXAMPLE: success.html
<h1> Login Success </h1>
- Form Based Presentation part:
This type of view part is able to provide a form to collect data from users and to submit data to the
server side applications.
In Struts applications, to prepare Presentation part we are able to use plain HTML tags, but, which
are not suggestible. In Struts applications it is suggestible to use Struts provided tag library.
EX: loginform.html
Struts Overview
The above login form with Struts provided html tag library
EX: loginform.jsp
Struts Overview
Deployment descriptor is web.xml file, it will provide description about our web application which is
required by the container in order to perform server side actions.
In general, in web applications, web.xml file will provide the following configuration details.
- Display names configurations.
- Welcome Files Configurations.
- Servlets configurations
- Filters Configurations
- Listeners Configurations.
- Session time out configurations
- Error Pages Configurations
- Taglib configurations
In Struts based web applications, the main intention of web.xml file is to configure controller
Servlet that is ActionServlet.
EX:
Struts Overview
In Struts Framework, ActionServlet is predefined Controller, it was provided in the form of
org.apache.struts.action.ActionServlet .
In Struts applications, ActionServlet will perform the following actions.
- ActionServlet will take request from Client.
- ActionServlet will identify the names and locations of the ActionForm and Action class
through Struts configuration file.
- ActionServlet will load , instantiate ActionForm class.
- ActionServlet will store form data in ActionForm object.
- ActionServlet will load and instantiation Action class.
- ActionServlet will execute execute(--) method in Action class.
- ActionServlet will identify view page through Struts configuration file.
- ActionServlet will forward request to view page inorder to generate response.
Note: In Struts applications, ActionServlet is performing all the above actions by using
"RequestProcessor" internally.
- Action Class or Controller Component:
In Struts based web applications, the main intention of ActionForm or FormBean component is to
manage a particular form data at Server side inorder to perform Server side data validations, to
transfer data from Controller layer to model layer or Vie layer,.....
To prepare Form Bean components in Struts applications we have to use the following rules and
regulations.
- Declare an user defined class, it must be extended from
org.apache.struts.action.ActionForm .
- Form Bean class must be public, it must not be abstract and final.
- In Form Bean class, we must declare properties with the same names of the form
properties.
- In Form Bean class we must declare all properties as private and all bahaviours as public.
- In FormBean class , we must provide a seperate set of setXXX() and getXXX() methods
for each and every property.
- In FormBean class, if we want to provide any constructor then we can provide constructor
but that constructor must be public and 0-arg constructor.
- In FormBean class, we can override equals(-) method and hashCode() method as per
the requirement.
- Key ideas of Hibernate - Integration with MySQL explained simply
- Ready-to-use code examples
- Exam-style questions at the end