Академический Документы
Профессиональный Документы
Культура Документы
Struts is open framework for building flexible, business oriented, high performance java web applications.
Using struts framework the developers can implement the MVC pattern without separation of the designated
three components.
Advantages:
The following are the different ways that struts allow the user input validation
Validators
Validators handle native and common types. The validations for basic operations are mask, required,
minLength, maxLength, native types, date, email, range etc.
Resource bundle:
These are used to provide the localized labels, messages and share by default the struts messages.
JSP tag
Used and generates the validations for a given form using the java script validations.
ValidatorForm
Used to automatically validate the properties that is based on the form bean’s name.
ValidatorActionForm
The validation takes place automatically on properties which is based on the action path.
Ajax Validations:
Real time data validation is one among the advantages in AJAX. AJAX validation makes the validators
available to the application on server side which can be used without enforcing the reloading the page.
The jsonValidation interceptor performs the validation for AJAX. When it is required to access the action
directly, the normal results such as success pages should be provided for the action, which triggers the
normal validation. The form will be submitted to the action if validation is success. If the request is made
using AJAX, instead of a regular submit, then specify the ajaxAfterValidation attirbute to true in the submit
tag.
Validators
Validators handle native and common types. The validations for basic operations are mask, required,
minLength, maxLength, native types, date, email, range etc.
1
Resource bundle:
These are used to provide the localized labels, messages and share by default the struts messages.
JSP tag
Used and generates the validations for a given form using the java script validations.
ValidatorForm
Used to automatically validate the properties that is based on the form bean’s name.
ValidatorActionForm
The validation takes place automatically on properties which is based on the action path.
Ajax integrates with struts. With the help of sending the request to the specific URL, an AJAX request can
call any struts action. This AJAX request is handled in the same way like the HTTP request. This is because,
AJAX has the access to the validation routines, form beans and actions of Struts and the benefits provided
by each.
A struts application can be extended by specifying some of the AJAX functionality. With this specification
struts and AJAX functions well.
Define Struts.
Answer
Struts is a framework for creating Java web applications. Web applications differ from conventional websites
in that web applications can create a dynamic response. Due to the blend of database, design and control
flow codes of JSP, the larger applications become difficult to maintain.
A "request" handler provided by the application developer that is mapped to a standard URI.
A "response" handler that transfers control to another resource which completes the response.
A tag library that helps developers create interactive form-based applications with server pages.
Struts are an open framework that is used for development of JAVA web application. Struts extend Java
Servlets API that helps developer to use MVP architecture. Struts offer easy solution to the developer to
implement MVP in projects
2
What is Action Class?
Answer
The Action is part of the controller. Action Class is used to translate the HttpServletRequest to the business
logic. To do this we need to overwrite the execute() method.
The ActionServlet (commad) passes the parameterized class to Action Form using the execute() method.
The action should receive the request, call business objects and then determine the further step.
The business objects could be handed to the action at runtime thus removing any dependencies on the
model.
The return type of the execute method is ActionForward. It is used by the Struts Framework to forward the
request to the file as per the value of the returned ActionForward object.
What is ActionServlet?
Answer
It is a class in org.apache.struts.action. It plays the role of a controller in the Jakarta Struts Framework. The
requests to the server go through the controller. The controller is responsible for handling all the requests.
Answer
The validation of data, whether on the Client side browser form or on the server side, can be done with the
help of Struts Validator Framework. It emits the JavaScript from the form and validates only the data. The
server side validation can be accomplished by sub classing your From Bean with DynaValidatorForm class
Answer
3
META-INF: Contains meta information. Used by utilities etc.
WEB-INF/classes: This is where you place you own Java classes.
WEB-INF/classes/ApplicationResources.properties: Contains the messages (fixed texts) of the
application. Error messages are also put here.
WEB-INF/lib/struts.jar:Contains the Struts servlet, helper classes, taglib code etc.
WEB-INF/*.tld: The Struts tag libraries.
WEB-INF/struts-config.xml:A Struts configuration file. More on this later.
WEB-INF/web.xml: The usual configuration file for the servlet container. More on this later.
index.jsp: The jsp-files (and html-files) may be placed in the root of the application directory.
"struts-blank" contains this single jsp-file.
Latest answer: An open source framework for creating web applications. Web applications, some deliver
static content and some create dynamic response. A web application can perform database actions and
perform business logic to make responses customized...........
Read answer
Latest answer: Model Components: Many application’s focus is on the view. The processing required for
each submitted form / request by keeping the model’s perspective in view............
Read answer
No backward flow
Single controller servlet – Only one ActionServlet is available which may be an issue of
scalability..........
Read answer
Latest answer: When an action servlet gets the request, it initiates the servlet-config.xml
It selects an appropriate page as per the mapping..............
Read answer
Latest answer: The Struts design pattern has N-tier architecture. This includes MVC architecture, Web
applications characters, struts framework which includes – architecture, design patterns and coding
idioms.............
Read answer
4
Latest answer: The different kinds of actions are done by the following:
DispatchAction, ActionDispatcher , LookupDispatchAction..............
Read answer
Latest answer: This class is extended by the org.apache.struts.action.Action class. The business logic is
wrapped by the Action class and this class provides an interface to the Model of the application................
Read answer
What is ActionForm?
Latest answer: ActionForm is a Java bean that associates one or more ActionMappings. The bean is
initialized from the corresponding parameters of requests well before the Action.execute method is
invoked............
Read answer
Latest answer: Grouping related actions into one class is possible using DispatchAction class. But in Action
class a group related action into one class is not possible..Several changes need to be done, when one
plans to group the related action using Action class.............
Read answer
Latest answer: A SwitchAction is like an Action which switches between modules and forwards the control
to the URI that is specified in the new module............
Read answer
Latest answer: LookupDispatch is similar to ActionDispatch. It distinguishes the ActionDispatch that uses
the request parameter’s values which performs a reverse lookup from resource bundle which uses the value
of parameters and match it to a method in the class..............
Read answer
Latest answer: Forwarding to a specified URL is provided by the ForwardAction. The mechanism to include
the specified URL contents is proveided by the IncludeAction...........
Read answer
Explain the difference between Html tags and Struts specific HTML Tags.
Latest answer: HTML tags are static and Struts tags are dynamic.
Struts tags can be created by the page authors............
Read answer
What are the contents of web.xml and struts-config.xml? Explain the difference between them.
Latest answer: The web.xml file contains the information that is used by servlets and JSPs. The file
includes the description of the application, information about servlets, mapping information for servlets and
5
URL, JSP configuration information...............
Read answer
Latest answer: web.xml is utilized to make connections between web application and the web container,
where as the struts-config.xml is utilized to establish the connections between the controller and the view of
MVC architecture.............
Read answer
Latest answer: The Struts framework strictly implements MVC pattern. The execute() method of Action
class can be invoked to interact with the Model part of MVC. An EJB may contain a model. The model
methods can be invoked by the execute() method............
Read answer
Define Struts.
Latest answer: Struts is a framework for creating Java web applications. Web applications differ from
conventional websites in that web applications can create a dynamic response. Due to the blend of
database, design and control flow codes of JSP, the larger applications become difficult to maintain.............
Read answer
Latest answer: The Action is part of the controller. Action Class is used to translate the HttpServletRequest
to the business logic. To do this we need to overwrite the execute() method..............
Read answer
What is ActionServlet?
Latest answer: It is a class in org.apache.struts.action. It plays the role of a controller in the Jakarta Struts
Framework..........
Read answer
Latest answer: The validation of data, whether on the Client side browser form or on the server side, can
be done with the help of Struts Validator Framework.............
Read answer