Ques: 28 What is an ActionMapping?
Ans: An ActionMapping object
describes an Action instance to the ActionServlet. It represents the
information that uniquely defines an instance of a particular action class. The
values defined by an ActionMapping object are what make a particular
<action> definition unique.
The ActionMapping object also provides useful information to the
Action.execute() method, giving an Action object the ability to alter its
behaviour based on the values describing a particular ActionMapping instance.
The signature of the Action.execute() method:
public ActionForward execute(ActionMapping mapping, ActionForm
form, HttpServletRequest request, HttpServletResponse response){//some code
here}
Ques: 29 How will you create your own ActionMapping?
Ans: To create your own
ActionMapping extention, you have to perform the following steps:
* Create a class that
extends the org.apache.struts.action.ActionMapping class.
* Define the additional
properties that will be used to describe your Action objects.
* Call the super() method,
which calls the ActionMapping's default constructor at the beginning of your
action mapping's contructor.
* Define matching setters
and getters that can be used to modify and retrieve the values of the defined
properties.
Ques: 30 What are the extensions of the ActionMapping provided by
the struts?
Ans: The struts framework
provides two extended ActionMapping classes:
*
org.apache.struts.action.SessionActionMapping
*
org.apache.struts.action.RequestActionMapping.
Ques: 31 What are the two i18n components of a Struts Application?
Ans: The tow main components
packaged with the Struts framework for internationalization of your Struts
application are:
* Message class that
references a resource bundle containing Locale-dependent string and managed by
the application Contorller.
* JSP custom tag,
<bean-message/>, which is used in the view layer to present the actual
string managed by the Contorller.
Ques: 32 Give name of the error management classes provided by the
Struts framework?
Ans: The Struts framework
provides two error management classes:
* ActionError
* ActionErrors
Ques: 33 What is the difference between the ActionError and
ActionErrors class provided by the Struts Framework?
Ans: The
org.apache.struts.action.ActionError class extends the
org.apache.struts.action.ActionMessage class and reresents the single error
message. The key attribute of the ActionError class is used to lookup a
resource from the application resource bundle, "Internationalizing your
struts application".
The org.apache.struts.action.ActionErrors class extends the
org.apache.struts.action.ActionMessage class and represents a collection of
ActionError classes. The ActionErrors class is composed of two contructors and
a single method that allows you to add an ActionError object to the current
collection of ActionErrors.
Ques: 34 What is for <html:errors/> tag provided by Struts
specific JSP tag library.
Ans: The <html:errors/>
tag is used to display the ActionError objects stored in ActionErrors
collection.
Ques: 35 What is the tiles framework in struts?
Ans: The tiles framework
turns the concept of jsp:includes inside out. Developers can build pages by
assembling reusable Tiles. You can think of Tiles as visual components.
A Tile and a Tile layout can be reused on more than one page.
Tiles are other JSP pages or any web resource. Tile layouts dictate how the
Tiles will be laid out on the page.
Ques: 36 How will you create a Tile layout view in your struts
application?
Ans: To create a TIle layout,
you must do the following:
* Import the Tiles taglib
into the JSP by using taglib directive.
* Use string parameters to
display such elements as the title of the page using the tiles:getAsStringTag.
* Insert the Tiles in the
correct regions of the layout using the tiles:insert tag.
* Pass any needed
parameters to the internal Tiles using the sub-tag of tiles:insert called
tiles:put.
0 comments:
Post a Comment