Вы находитесь на странице: 1из 2

What is Struts?

The core of the Struts framework is a flexible control layer based on standard technologies like Java Servlets,
JavaBeans, ResourceBundles, and XML, as well as various Jakarta Commons packages. Struts encourages
application architectures based on the Model 2 approach, a variation of the classic Model-View-Controller
(MVC) design paradigm.

Struts provides its own Controller component and integrates with other technologies to provide the Model
and the View. For the Model, Struts can interact with standard data access technologies, like JDBC and EJB,
as well as most any third-party packages, like Hibernate, iBATIS, or Object Relational Bridge. For the View,
Struts works well with JavaServer Pages, including JSTL and JSF, as well as Velocity Templates, XSLT, and
other presentation systems.

The Struts framework provides the invisible underpinnings every professional web application needs to
survive. Struts helps you create an extensible development environment for your application, based on
published standards and proven design patterns.

What is Jakarta Struts Framework?


Jakarta Struts is open source implementation of MVC (Model-View-Controller) pattern for the development
of web based applications. Jakarta Struts is robust architecture and can be used for the development of
application of any size. Struts framework makes it much easier to design scalable, reliable Web applications
with Java.
In Struts Programming which is the controller,which is the model?
In Struts programming ActionServlet is the controller.
* Action class also part of the controller only.
We have a Business layer/data or business service in between the session facade and data access object
(DAO) is called the Model.
What is MVC Architecture?
MVC stands for Model(bean,EJB),View(Html,Jsp),Controller (Servlet).MVC pattern is a collabartion of
three components model,view,controller.MVC pattern is a sequence of action interactions starting with
view,then controller and then to model based on the data persistence.
MVC is an approach for developing interactive application ie it results in events through user
interactions.Model is responsible for holding the application state,View is for displaying the current model
and controller handles the event.
In MVC1 web compoent is responsible for handling request and sending response using helper. where as in
MVC2 web component is responsible for handling requst and another web component is responsible for
sending response using helper.
What is difference between perform() used in struts1.0 and execute() used in 1.1 ?
Using perform() u have throw IOException,ServletException. But where as execute() method throws Generic
Exception.
what is the purpose of action servlet and action?
Action Servlet is backbone of struts Framework.It is the main ControllerComponent
Action class contain userlogic .It return the next View to the Framework
What is difference between Html tags and Struts tags...
Html tags are static Struts tags are Dynamic( At the run-time struts tags are called)2. Another diff is U create
ur own Struts tags
What are the contents of web.xml and struts-config...
web.xml is used for the deployment descriptor for web applications where struts-config.xme is used for
deployment descripror for struts application.

Struts-config.xml is used for making connection between view & controller where as web.xml is used for
making connection between web container & web application
What are the various Struts tag libraries?
Struts is very rich framework and it provides very good and user friendly way to develop web application
forms. Struts provide many tag libraries to ease the development of web applications. These tag libraries are:
* Bean tag library - Tags for accessing JavaBeans and their properties.
* HTML tag library - Tags to output standard HTML, including forms, text boxes, checkboxes, radio buttons
etc..
* Logic tag library - Tags for generating conditional output, iteration capabilities and flow management
* Tiles or Template tag library - For the application using tiles
* Nested tag library - For using the nested beans in the application
What are difference between ActionErrors and ActionMessage?
ActionMessage: A class that encapsulates messages. Messages can be either global or they are specific to a
particular bean property.
Each individual message is described by an ActionMessage object, which contains a message key (to be
looked up in an appropriate message resources database), and up to four placeholder arguments used for
parametric substitution in the resulting message.

ActionErrors: A class that encapsulates the error messages being reported by the validate() method of an
ActionForm. Validation errors are either global to the entire ActionForm bean they are associated with, or
they are specific to a particular bean property (and, therefore, a particular input field on the corresponding
form).
What is the difference between <jsp:include page = ... > and <%@ include file = ... .
Both the tag includes the information from one page in another. The differences are as follows:
<jsp:include page = ... >: This is like a function call from one jsp to another jsp. It is executed ( the included
page is executed and the generated html content is included in the content of calling jsp) each time the client
page is accessed by the client. This approach is useful to for modularizing the web application. If the
included file changed then the new content will be included in the output.

<%@ include file = ... >: In this case the content of the included file is textually embedded in the page that
have <%@ include file=".."> directive. In this case in the included file changes, the changed content will not
included in the output. This approach is used when the code from one jsp file required to include in multiple
jsp files.

What is the difference between <jsp:forward page = ... > and


response.sendRedirect(url),?.
Answer: The <jsp:forward> element forwards the request object containing the client request information
from one JSP file to another file. The target file can be an HTML file, another JSP file, or a servlet, as long as
it is in the same application context as the forwarding JSP file.
sendRedirect sends HTTP temporary redirect response to the browser, and browser creates a new request to
go the redirected page. The response.sendRedirect kills the session variables.

Вам также может понравиться