|
| |
Configuring
Struts
Struts
framework use two related type of configuration
file, which nust be configured properly before
and application will work correctly. Both configration
files are XML based. The first one is the web
application deployment descriptor web.xml
and the second one the Struts
configuration file, it is comonly named struts-config.xml.
Configuring web.xml
There are few Struts-specific configuration
options that you must configure within this
file when using the struts framework.
Modify the web.xml file in /WEB-INF directory
by adding the .tld file you want to use like
if you are using struts-html.tld then
| <taglib> |
| |
<taglib-uri>/WEB-INF/struts-html.tld</taglib-uri>
<taglib-location>/WEB-INF/struts-html.tld</taglib-location> |
| </taglib>
|
Configure the ActionServlet that will receive
all the incoming request for the appliation.
The two steps involved in configuring the Struts
controller servlet in the web.xml are, first
to use the servlet element to configure the
servlet instance that can be latter mapped in
the servlet mapping element.
Using servlet element to configure the servlet
class in web.xml
| <web-app> |
| |
<sertvlet> |
| |
|
|
<servlet-name>some
name</servlet-name> |
| |
|
|
<servlet-class>the
class name</servlet-class> |
| |
|
</sertvlet> |
| </web-app> |
| |
|
|
|
Configure servlet mapping
| <web-app> |
| |
<sertvlet> |
| |
|
|
<servlet-name>some
name</servlet-name> |
| |
|
|
<servlet-class>the
class name</servlet-class> |
| |
|
</sertvlet> |
| |
|
<sertvlet-mapping> |
| |
|
|
<servlet-name>some
name</servlet-name> |
| |
|
|
<url-pattern>*.do
</url-pattern> |
| |
|
</sertvlet-mapping> |
| </web-app> |
| |
|
|
|
|
|