Struct Architecture
Defination:
In computer programming, a "struct" (short for "structure") is a user-defined
data type that groups related variables of different data types into a single
unit. This allows for data to be organized and accessed collectively, like a
blueprint for creating a custom data structure.
Key aspects of structs:
Grouping related data:
Structs are used to group data that logically belongs together, such as a
customer's name, address, and phone number.
User-defined data type:
Structs provide a way to create custom data types beyond the built-in types
(like int, float, char).
Contiguous memory:
Structs occupy a block of memory, with each member located at a fixed
offset from the beginning of the block.
Members:
The individual data items within a struct are called members or
fields. These can be of various data types.
Accessing members:
Members are accessed using the dot operator (.) or arrow operator (->) with
a pointer to the struct.
Features of Struts
Struts have the following features:
● Struts encourages good design practices and modeling because the
framework is designed with "time-proven" design patterns.
● Struts is almost simple, so easy to learn and use.
● It supports many convenient features such as input validation and
internationalization.
● It takes much of the complexity out as instead of building your own
MVC framework, you can use struts.
● Struts is very well integrated with J2EE.
● Struts has large user community.
● It is flexible and extensible; it is easy for the existing web
applications to adapt the struts framework.
● Struts provide good tag libraries.
● It allows capturing input form data into JavaBean objects called
Action forms.
● It also hands over standard error handling both programmatically
and declaratively.
● Working of Struts:
Step-by-Step Implementation of Struts
Step 1: Initialization Phase
● In initial phase, the controller rectifies a configuration file.
● This configuration file is like the manual for initialization and is used
to deploy the controller layer objects.
Step 2: Composition of Configuration file
● Config file's core is formed by all the objects defined inside it.
● These objects include action mapping which plays in defining the
behavior of application.
● Furthermore, it also contains the definition of these action
mappings.
● Action mappings are the key aspects in instructing the servlet
controllers for handling the HTTP Requests.
Step 3: Routing of HTTP Requests & process flow
● Initially, the requests are directed towards the action and then JSP.
● JSP does further processing and rendering the view page.
Step 4: Action object request handling
● Action objects handle all the requests of client.
● These objects have access to the servlet controller of our
application, and they can execute specific actions defined inside
controllers.
The action object can indirectly forward one or more shared objects, these
shared objects can be JavaBeans, and are typically shared in shared
context which is established using Java Servlets.