Struts Intro Course
-
Upload
ashishr570 -
Category
Documents
-
view
229 -
download
0
Transcript of Struts Intro Course
-
8/14/2019 Struts Intro Course
1/77
Project Refinery, Inc. 1
STRUTSPart of the Jakarta Project
Sponsored by the
Apache Software Foundation
Developed by: Roger W Barnes of Project Refinery, Inc.
Introduction to Struts
-
8/14/2019 Struts Intro Course
2/77
Project Refinery, Inc. 2
STRUTS Objectives
Course Overview
Unit 1 - Model-View-Controller Design
PatternUnit 2 - Model Components
Unit 3 - View Components
Unit 4 - Controller ComponentsUnit 5 - Tag Libraries
-
8/14/2019 Struts Intro Course
3/77
Project Refinery, Inc. 3
STRUTS Objectives
Unit 6 - STRUTS Configuration File
Unit 7 - Web Application Descriptor File
Unit 8 - Application Resources FileUnit 9 Resources
-
8/14/2019 Struts Intro Course
4/77
Project Refinery, Inc. 4
Model-View-Controller DesignPattern
Unit 1
-
8/14/2019 Struts Intro Course
5/77
Project Refinery, Inc. 5
STRUTS MVC Design Pattern
Central controller mediates application flow
Controller delegates to appropriate handler
Handlers are tied to model componentsModel encapsulates business logic
Control forwarded back through the
Controller to the appropriate View
-
8/14/2019 Struts Intro Course
6/77
Project Refinery, Inc. 6
STRUTS MVC Design Pattern
-
8/14/2019 Struts Intro Course
7/77
-
8/14/2019 Struts Intro Course
8/77Project Refinery, Inc. 8
STRUTS MVC Design Pattern
Configuration file contains action
mappings (determines navigation)
Controller uses mappings to turn HTTPrequests into application actions
Mapping must specify
A request pathObject type to act upon the request
-
8/14/2019 Struts Intro Course
9/77
Project Refinery, Inc. 9
Model Components
Unit 2
-
8/14/2019 Struts Intro Course
10/77Project Refinery, Inc. 10
STRUTS Model Components
Model divided into concepts Internal state of the system
Actions that can change that state Internal state of system represented by JavaBeans
Enterprise JavaBeans
-
8/14/2019 Struts Intro Course
11/77Project Refinery, Inc. 11
STRUTS Model Components
JavaBeans and Scope Page visible within a single JSP page, for the
lifetime of the current request
Request visible within a single JSP page, as wellas to any page or servlet that is included in thispage, or forwarded to by this page
Session visible to all JSP pages and servletsthat participate in a particular user session, across
one or more requests Application - visible to all JSP pages and servlets
that are part of a web application
-
8/14/2019 Struts Intro Course
12/77Project Refinery, Inc. 12
STRUTS Model Components
ActionForm Beans Extends the ActionForm class Create one for each input form in the application If defined in the ActionMapping configuration file, the
Controller Servlet will perform the following: Check session for instance of bean of appropriate class If no session bean exists, one is created automatically For every request parameter whose name corresponds to the
name of a property in the bean, the corresponding setter
method will be called The updated ActionForm bean will be passed to the Action
Class perform() method when it is called, making these valuesimmediately available
-
8/14/2019 Struts Intro Course
13/77
Project Refinery, Inc. 13
STRUTS Model Components
When coding ActionForm beans consider: The ActionForm class itself requires no specific
methods to be implemented. It is used to identify therole these particular beans play in the overall
architecture. Typically, an ActionForm bean will haveonly property getter and property setter methods,with no business logic
The ActionForm object also offers a standardvalidation mechanism. If you override a "stub"
method, and provide error messages in the standardapplication resource, Struts will automaticallyvalidate the input from the form
-
8/14/2019 Struts Intro Course
14/77
Project Refinery, Inc. 14
STRUTS Model Components
Continued Define a property (with associated getXxx() and setXxx()
methods) for each field that is present in the form. The fieldname and property name must match according to the usualJavaBeans conventions
Place a bean instance on your form, and use nested propertyreferences. For example, you have a "customer" bean on yourAction Form, and then refer to the property "customer.name"in your JSP view. This would correspond to the methodscustomer.getName() and customer.setName(string
Name) on your customer bean
-
8/14/2019 Struts Intro Course
15/77
Project Refinery, Inc. 15
STRUTS Model Components
System State Beans Actual state of a system is normally represented
as a set of one or more JavaBeans classes,
whose properties define the current state A shopping cart system, for example, will include a
bean that represents the cart being maintained for
each individual shopper, and will (among other
things) include the set of items that the shopperhas currently selected for purchase
-
8/14/2019 Struts Intro Course
16/77
Project Refinery, Inc. 16
STRUTS Model Components Business Logic Beans
Should encapsulate the functional logic of your application asmethod calls on JavaBeans designed for this purpose
For maximum code re-use, business logic beans should bedesigned and implemented so that they do not know they arebeing executed in a web application environment
For small to medium sized applications, business logic beansmight be ordinary JavaBeans that interact with system statebeans passed as arguments, or ordinary JavaBeans that accessa database using JDBC calls
-
8/14/2019 Struts Intro Course
17/77
Project Refinery, Inc. 17
STRUTS Model Components
Business Logic Beans - Continued
For larger applications, these beans will
often be stateful or stateless Enterprise
JavaBeans (EJBs)
-
8/14/2019 Struts Intro Course
18/77
Project Refinery, Inc. 18
STRUTS Model Components
Accessing Relational DatabasesStruts can define the datasources for an
application from within its standard
configuration file
A simple JDBC connection pool is also
provided
-
8/14/2019 Struts Intro Course
19/77
Project Refinery, Inc. 19
View Components
Unit 3
-
8/14/2019 Struts Intro Course
20/77
Project Refinery, Inc. 20
STRUTS View Components
Internationalized Messages Struts builds upon Java platform to provide assistance for
building internationalized and localized applications Locale - fundamental Java class that supports internationalization
ResourceBundle - supports messages in multiple languages PropertyResourceBundle - standard implementation of
ResourceBundle that allows you to define resources using the same"name=value" syntax used to initialize properties files
MessageFormat - allows you to replace portions of a message stringwith arguments specified at run time
MessageResources - lets you treat a set of resource bundles like adatabase, and allows you to request a particular message string for aparticular Locale
-
8/14/2019 Struts Intro Course
21/77
Project Refinery, Inc. 21
STRUTS View Components
ApplicationResources.propertiesContains the messages in the default language
for your server. If your default language is
English, you might have an entry like this:prompt.hello=Hello
ApplicationResources_xx.propertiesContains the same messages in the language
whose ISO language code is "xx"
-
8/14/2019 Struts Intro Course
22/77
Project Refinery, Inc. 22
STRUTS View Components
Forms and FormBean interactionsHTML Forms and their limitations
Errors not easily handled
-
8/14/2019 Struts Intro Course
23/77
Project Refinery, Inc. 23
STRUTS View Components
-
8/14/2019 Struts Intro Course
24/77
Project Refinery, Inc. 24
STRUTS View Components
Building Forms with Struts The taglib directive tells the JSP page compiler where
to find the tag library descriptorfor the Struts tag library
message tag is used to look up internationalized
message strings from a MessageResources objectcontaining all the resources for this application
The errors tag displays any error messages that have
been stored by a business logic component, or nothing if
no errors have been stored
-
8/14/2019 Struts Intro Course
25/77
-
8/14/2019 Struts Intro Course
26/77
-
8/14/2019 Struts Intro Course
27/77
Project Refinery, Inc. 27
STRUTS View Components
Useful Presentation Tags [logic] iterate repeats its tag body once for each element of
a specified collection (which can be an Enumeration, aHashtable, a Vector, or an array of objects)
[logic] present depending on which attribute is specified,this tag checks the current request, and evaluates thenested body content of this tag only if the specified value ispresent
[logic] notPresent the companion tag to present, notPresentprovides the same functionality when the specified attribute
is not present
http://../Java%20Docs/STRUTS/Docs/struts-logic.htmlhttp://../Java%20Docs/STRUTS/Docs/struts-logic.htmlhttp://../Java%20Docs/STRUTS/Docs/struts-logic.htmlhttp://../Java%20Docs/STRUTS/Docs/struts-logic.htmlhttp://../Java%20Docs/STRUTS/Docs/struts-logic.htmlhttp://../Java%20Docs/STRUTS/Docs/struts-logic.html -
8/14/2019 Struts Intro Course
28/77
Project Refinery, Inc. 28
STRUTS View Components
Useful Presentation Tags continued [html] link generates a HTML element as an anchor
definition or a hyperlink to the specified URL, and automaticallyapplies URL encoding to maintain session state in the absenceof cookie support
[html] img generates a HTML element with the ability todynamically modify the URLs specified by the "src" and"lowsrc" attributes in the same manner that can
[bean] parameterretrieves the value of the specified requestparameter, and defines the result as a page scope attribute of
type String or String
http://../Java%20Docs/STRUTS/Docs/struts-html.htmlhttp://../Java%20Docs/STRUTS/Docs/struts-html.htmlhttp://../Java%20Docs/STRUTS/Docs/struts-bean.htmlhttp://../Java%20Docs/STRUTS/Docs/struts-bean.htmlhttp://../Java%20Docs/STRUTS/Docs/struts-html.htmlhttp://../Java%20Docs/STRUTS/Docs/struts-html.html -
8/14/2019 Struts Intro Course
29/77
Project Refinery, Inc. 29
STRUTS View Components
Automatic Form Validation Struts offers an additional facility to validate the input
fields it has received
To utilize this feature, override the validate() method in
your ActionForm class
The validate() method is called by the controller servlet
after the bean properties have been populated, but
before the corresponding action class's perform()
method is invoked
-
8/14/2019 Struts Intro Course
30/77
Project Refinery, Inc. 30
STRUTS View Components
Page Composition with IncludesThe development of the various segments of a site
is easier if you can divide up the work, and assigndifferent developers to the different segments
Use the include capability of JavaServer Pagestechnology to combine the results into a singleresult page, or use the include tag provided withStruts
-
8/14/2019 Struts Intro Course
31/77
Project Refinery, Inc. 31
STRUTS View Components
Page Composition with Includes continued There are three types ofinclude available, depending on
when you want the combination of output to occur: An directive can include a file
that contains java code or jsp tags The include action () is processed at request time, and is handledtransparently by the server
The bean:include tag takes either a an argument "forward"representing a logical name mapped to the jsp to include, or the"id" argument, which represents a page context String variable toprint out to the jsp page
http://../Java%20Docs/STRUTS/Docs/struts-bean.htmlhttp://../Java%20Docs/STRUTS/Docs/struts-bean.html -
8/14/2019 Struts Intro Course
32/77
Project Refinery, Inc. 32
Controller Components
Unit 4
-
8/14/2019 Struts Intro Course
33/77
Project Refinery, Inc. 33
STRUTS Controller Components
Struts includes a Servlet that
implements the primary function of
mapping a request URI to an Actionclass (ActionServlet)
-
8/14/2019 Struts Intro Course
34/77
Project Refinery, Inc. 34
STRUTS Controller Components
Your primary responsibilities are: Write an Action class (that is, an extension of the Action
class) for each logical request that may be received
Write the action mapping configuration file (in XML) that is
used to configure the controller servlet (struts-config.xml) Update the web application deployment descriptor file (in
XML) for your application to include the necessary Strutscomponents
Add the appropriate Struts components to your application
-
8/14/2019 Struts Intro Course
35/77
Project Refinery, Inc. 35
STRUTS Controller Components
Action Classes:The Action class defines a perform
method that you override public ActionForward
perform(ActionMapping mapping,ActionForm form, HttpServletRequestrequest, HttpServletResponse response)
throws IOException, ServletException;
-
8/14/2019 Struts Intro Course
36/77
Project Refinery, Inc. 36
STRUTS Controller Components
The goal of an Action class is toprocess this request, and then to return
an ActionForward object that identifiesthe JSP page (if any) to which control
should be forwarded to generate the
corresponding response
-
8/14/2019 Struts Intro Course
37/77
Project Refinery, Inc. 37
STRUTS Controller Components
A typical Action class will implement the following logicin its perform() method Validate the current state of the user's session
If validation has not yet occurred, validate the form beanproperties as necessary
Perform the processing required to deal with this request
Update the server-side objects that will be used to create thenext page of the user interface
Return an appropriate ActionForward object that identifies theJSP page to be used to generate this response, based on the
newly updated beans
-
8/14/2019 Struts Intro Course
38/77
Project Refinery, Inc. 38
STRUTS Controller Components
Design issues to remember when coding Actionclasses include the following The controller Servlet creates only one instance of
yourAction class, and uses it for all requests. Thus,
you need to code yourAction class so that it operatescorrectly in a multi-threaded environment, just as youmust code a Servlet's service() method safely
The most important principle that aids in thread-safecoding is to use only local variables, not instance
variables, in yourAction class
-
8/14/2019 Struts Intro Course
39/77
Project Refinery, Inc. 39
STRUTS Controller Components
Design issues to remember when coding Action classesinclude the following continued The beans that represent the Model of your system may throw
exceptions due to problems accessing databases or otherresources. You should trap all such exceptions in the logic of
yourperform() method, and log them to the application logfile As a general rule, allocating scarce resources and keeping them
across requests from the same user (in the user's session) cancause scalability problems
-
8/14/2019 Struts Intro Course
40/77
Project Refinery, Inc. 40
STRUTS Controller Components
The ActionMapping Implementation type - Fully qualified Java class name of the Action
implementation class used by this mapping. name - The name of the form bean defined in the config file
that this action will use path - The request URI path that is matched to select this
mapping. See below for examples of how matching works. unknown - Set to true if this action should be configured as
the default for this application, to handle all requests nothandled by another action. Only one action can be defined asa default within a single application.
validate - Set to true if the validate() method of the actionassociated with this mapping should be called.
-
8/14/2019 Struts Intro Course
41/77
Project Refinery, Inc. 41
STRUTS Controller Components
The Actions Mapping Configuration File The developer's responsibility is to create an XML
file named struts-config.xml, and place it in the
WEB-INF directory of your application The outermost XML element must be
Inside of the element, there two
important elements that you use to describe youractions:
-
8/14/2019 Struts Intro Course
42/77
Project Refinery, Inc. 42
STRUTS Controller Components
This section contains your form bean
definitions. You use a element for
each form bean, which has the following
important attributes: name: The name of the request or session level
attribute that this form bean will be stored as
type: The fully-qualified Java classname of your form
bean
-
8/14/2019 Struts Intro Course
43/77
Project Refinery, Inc. 43
STRUTS Controller Components
This section contains your action definitions. You
use an element for each of your actions
you would like to define. Each action element has
requires the following attributes to be defined: path: The application context-relative path to the action
type: The fully qualified java classname of your Action
class
name: The name of your element to usewith this action
-
8/14/2019 Struts Intro Course
44/77
Project Refinery, Inc. 44
STRUTS Controller Components One more section of good use is the
section, which specifies data sources that your applicationcan use.This is how you would specify a basic data sourcefor your application inside of struts-config.xml:
-
8/14/2019 Struts Intro Course
45/77
Project Refinery, Inc. 45
STRUTS Controller Components
The Web Application Deployment
DescriptorThe final step in setting up the application
is to configure the application deployment
descriptor (stored in file WEB-INF/web.xml) to include all the Struts
components that are required
-
8/14/2019 Struts Intro Course
46/77
Project Refinery, Inc. 46
Tag Libraries
Unit 5
-
8/14/2019 Struts Intro Course
47/77
Project Refinery, Inc. 47
STRUTS Tag Libraries
HTML Tags
Bean Tags
Logic TagsTemplate Tags
Custom Tags
-
8/14/2019 Struts Intro Course
48/77
Project Refinery, Inc. 48
HTML Tags
The tags in the Struts HTML library form a bridgebetween a JSP view and the other componentsof a Web application. Since a dynamic Webapplication often depends on gathering data froma user, input forms play an important role in the
Struts framework. Consequently, the majority ofthe HTML tags involve HTML forms. Otherimportant issues addressed by the Struts-HTMLtags are messages, error messages, hyperlinking
and internationalization.
-
8/14/2019 Struts Intro Course
49/77
Project Refinery, Inc. 49
HTML Tags
HTML "form" tags button
cancel
checkboxes
file
hidden
image
multibox
password input fields radio buttons
reset buttons
HTML "form" tags select lists with
embedded
option
options submit buttons
text input fields
textareas
HTML Tags T i l HTML F
-
8/14/2019 Struts Intro Course
50/77
Project Refinery, Inc. 50
HTML Tags Typical HTML Form
First Name
Street Address
City
State
Postal Code
HTML Tags T i l St t F
-
8/14/2019 Struts Intro Course
51/77
Project Refinery, Inc. 51
HTML Tags Typical Struts Form
B T
-
8/14/2019 Struts Intro Course
52/77
Project Refinery, Inc. 52
Bean Tags The "struts-bean" tag library provides substantial enhancements to
the basic capability provided by , as discussed inthe following sections: Bean Properties - Extended syntax to refer to JavaBean properties with
simple names (same as the standard JSP tags and), nested names (a property named address.cityreturns the value retrieved by the Java expression
getAddress().getCity()), and indexed names (a property namedaddress[3] retrieves the fourth address from the indexed "address"property of a bean).
Bean Creation - New JSP beans, in any scope, can be created from a
variety of objects and APIs associated with the current request, or with
the servlet container in which this page is running.
Bean Output - Supports the rendering of textual output from a bean (or
bean property), which will be included in the response being created by
your JSP page.
Bean Tags
-
8/14/2019 Struts Intro Course
53/77
Project Refinery, Inc. 53
Bean TagsTag Name Description
cookie Define a scripting variable based on the value(s) of the specified request cookie.
define Define a scripting variable based on the value(s) of the specified bean property.
header Define a scripting variable based on the value(s) of the specified request header.
include Load the response from a dynamic application request and make it available as a bean.
message Render an internationalized message string to the response.
page Expose a specified item from the page context as a bean.
parameter Define a scripting variable based on the value(s) of the specified request parameter.
resource Load a web application resource and make it available as a bean.
size Define a bean containing the number of elements in a Collection or Map.
struts Expose a named Struts internal configuration object as a bean.
write Render the value of the specified bean property to the current JspWriter.
Bean Tag Example
-
8/14/2019 Struts Intro Course
54/77
Project Refinery, Inc. 54
Bean Tag Example
Logic Tags
-
8/14/2019 Struts Intro Course
55/77
Project Refinery, Inc. 55
Logic Tags
The Logic tag library contains tags that are
useful in managing conditional generation
of output text, looping over object
collections for repetitive generation of
output text, and application flowmanagement.
Logic Tags
-
8/14/2019 Struts Intro Course
56/77
Project Refinery, Inc. 56
Logic Tags For tags that do value comparisons (equal,
greaterEqual, greaterThan, lessEqual, lessThan,notEqual), the following rules apply: The specified value is examined. If it can be converted
successfully to a double or a long, it is assumed that theultimate comparison will be numeric (either floating point or
integer). Otherwise, a String comparison will be performed. The variable to be compared to is retrieved, based on the
selector attribute(s) (cookie, header, name, parameter,property) present on this tag. It will be converted to theappropriate type for the comparison, as determined above.
A request time exception will be thrown if the specified variablecannot be retrieved, or has a null value.
The specific comparison for this tag will be performed, and the
nested body content of this tag will be evaluated if the
comparison returns a true result.
Logic Tags
-
8/14/2019 Struts Intro Course
57/77
Project Refinery, Inc. 57
Logic Tags For tags that do substring matching (match,
notMatch), the following rules apply: The specified variable is retrieved, based on theselector attribute(s) (cookie, header, name,parameter, property) present on this tag. Thevariable is converted to a String, if necessary.
A request time exception will be thrown if the specified
variable cannot be retrieved, or has a null value.
The specified value is checked for existence as a
substring of the variable, in the position specified by
the location attribute, as follows: at the beginning (iflocation is set to start), at the end (if location is set toend), or anywhere (if location is not specified).
Logic Tags
-
8/14/2019 Struts Intro Course
58/77
Project Refinery, Inc. 58
Logic TagsTag Name Description
emptyEvaluate the nested body content of this tag if the requested variable is eithernull or an empty string.
equalEvaluate the nested body content of this tag if the requested variable is equal
to the specified value.forward Forward control to the page specified by the specified ActionForward entry.
greaterEqualEvaluate the nested body content of this tag if requested variable is greaterthan or equal to specified value.
greaterThanEvaluate the nested body content of this tag if the requested variable is greaterthan the specified value.
iterate Repeat the nested body content of this tag over a specified collection.
lessEqualEvaluate the nested body content of this tag if requested variable is greater
than or equal to specified value.lessThan
Evaluate the nested body content of this tag if the requested variable is lessthan the specified value.
matchEvaluate the nested body content of this tag if specified value is an appropriatesubstring of requested variable.
messagesNotPresent
Generate the nested body content of this tag if the specified message is notpresent in this request.
messagesPresentGenerate the nested body content of this tag if the specified message is presentin this request.
notEmptyEvaluate the nested body content of this tag if the requested variable is neither
null nor an empty string.notEqual
Evaluate the nested body content of this tag if the requested variable is notequal to the specified value.
notMatchEvaluate the nested body content of tag if specified value not an appropriatesubstring of requested variable.
notPresentGenerate the nested body content of this tag if the specified value is notpresent in this request.
presentGenerate the nested body content of this tag if the specified value is present inthis request.
redirect Render an HTTP Redirect
Logic Tags Example
-
8/14/2019 Struts Intro Course
59/77
Project Refinery, Inc. 59
Logic Tags - Example
Template Tags
-
8/14/2019 Struts Intro Course
60/77
Project Refinery, Inc. 60
Template Tags
The Template tag library contains three
tags: put, get, and insert. Put tags put
content into request scope, which is
retrieved by a get tag in a different JSPpage (the template). That template is
included with the insert tag.
Template Tags
-
8/14/2019 Struts Intro Course
61/77
Project Refinery, Inc. 61
Template Tags Insert Inserts (includes, actually) a
template. Templates are JSP pages thatinclude parameterized content. That
content comes from put tags that are
children of insert tags.Put Puts content into request scope.
Get Gets the content from request scope
that was put there by a put tag.
Custom Tags
-
8/14/2019 Struts Intro Course
62/77
Project Refinery, Inc. 62
Custom Tags
Image Broker Link Test
Custom Tags tld File
-
8/14/2019 Struts Intro Course
63/77
Project Refinery, Inc. 63
Custom Tags tld File
doctype
com.pri.brokertag.ImageBrokerDoctype
value
true
true
Custom Tags Tag Class
-
8/14/2019 Struts Intro Course
64/77
Project Refinery, Inc. 64
Custom Tags Tag Classpublic class ImageBrokerDoctype extends TagSupport {
private String value = null;
public int doStartTag() throws JspException{
Hashtable ht = null;
String keyword_count = null;
int iCnt = 0;
HttpServletRequest request = (HttpServletRequest)pageContext.getRequest();
ht = (Hashtable) request.getAttribute("keyword_parms");
keyword_count = (String)
request.getAttribute("queryobject_count");
iCnt ++;
ht.put("QueryObject" + iCnt, value);
request.setAttribute("keyword_parms", ht);
request.setAttribute("queryobject_count", new String(new
Integer(iCnt).toString()));
return EVAL_PAGE; }
}
-
8/14/2019 Struts Intro Course
65/77
Project Refinery, Inc. 65
STRUTS Configuration File
Unit 6
STRUTS Configuration File
-
8/14/2019 Struts Intro Course
66/77
Project Refinery, Inc. 66
STRUTS Configuration FileThe developer's responsibility is to
create an XML file named struts-config.xml, and place it in the WEB-INF directory of your application. This
format of this document is constrainedby it's definition in "struts-
config_1_0.dtd". The outermost XML
element must be .
-
8/14/2019 Struts Intro Course
67/77
Project Refinery, Inc. 67
STRUTS Configuration File Inside of the element, there are two important elements
that are used to describe your actions:This section contains your form bean definitions. You use a element for each form bean, which has the following important attributes: name: A unique identifier for this bean, which will be used to
reference it in corresponding action mappings. Usually, this is also thename of the request or session attribute under which this form beanwill be stored.
type: The fully-qualified Java classname of your form bean.This section contains your action definitions. You use an element for each of your actions you would like to define. Each action
element requires the following attributes to be defined: path: The application context-relative path to the action type: The fully qualified java classname of your Action class name: The name of your element to use with this action
Struts-config.xml
-
8/14/2019 Struts Intro Course
68/77
Project Refinery, Inc. 68
Struts config.xml
-
8/14/2019 Struts Intro Course
69/77
Project Refinery, Inc. 69
Web Application Descriptor
File
Unit 7
-
8/14/2019 Struts Intro Course
70/77
Project Refinery, Inc. 70
Web.xml File
The final step in setting up the application isto configure the application deploymentdescriptor (stored in file WEB-INF/web.xml)to include all the Struts components that arerequired. Using the deployment descriptor forthe example application as a guide, we seethat the following entries need to be createdor modified.
Web xml File
-
8/14/2019 Struts Intro Course
71/77
Project Refinery, Inc. 71
Web.xml File
imagebrokerWeb
action
org.apache.struts.action.ActionServlet
applicationimagebrokerWeb
configWEB-INF/struts-config.xml
Web.xml File - continued
-
8/14/2019 Struts Intro Course
72/77
Project Refinery, Inc. 72
Web.xml File continued
action
*.do
index.html
Web xml File - continued
-
8/14/2019 Struts Intro Course
73/77
Project Refinery, Inc. 73
Web.xml File continued
WEB-INF/struts-bean.tld
/WEB-INF/struts-bean.tld
WEB-INF/struts-html.tld
/WEB-INF/struts-html.tld
WEB-INF/struts-logic.tld
/WEB-INF/struts-logic.tld
-
8/14/2019 Struts Intro Course
74/77
Project Refinery, Inc. 74
Application Resources File
Unit 8
Application.properties File
-
8/14/2019 Struts Intro Course
75/77
Project Refinery, Inc. 75
Application.properties File
error.cryptvalue.required=You must enter some text.
error.lob.required=You must enter the Line of Business.
error.unitnbr.required=You must enter the Unit Number.
error.onbase_dns.required=You must enter the OnBase DNS.
imagebroker.linkname=Project Refinery, Inc.
imagebroker.title=pri Image Brokerimagebrokerlink.title=pri Image Broker Link Test
imagelocationlist.title=Image Location List
imagelocationdetail.title=Image Location Detail
imagelocationinsert.title=Image Location Insert
errors.header=
errors.footer=
-
8/14/2019 Struts Intro Course
76/77
Project Refinery, Inc. 76
Resources
Unit 9
Resources
-
8/14/2019 Struts Intro Course
77/77
Resources
Main Struts Web Site http://jakarta.apache.org/struts/index.html
Struts User Guide
http://jakarta.apache.org/struts/userGuide/index.html
Various Struts Resources http://jakarta.apache.org/struts/resources.html
Ted Husted Web Site http://www.husted.com/struts/