📄 installation-1.0.html
字号:
(including these pages). You can install this web application
on any servlet container compatible with Servlet API 2.2 or later.</li>
<li>
<strong>webapps/struts-example.war</strong> - This is an example
web application that uses a large percentage of Struts features.
You can install this web application on any servlet container
compatible with the Servlet 2.2 (or later) and JSP 1.1 (or later)
specifications. If an XML parser is not made available to web
applications by your container, you will need to add one to the
WEB-INF/lib directory of this web application.</li>
<li>
<strong>webapps/struts-exercise-taglib.war</strong> - This web
application contains test pages for the various custom tags supported
by Struts. It is primarily of use to developers who are enhancing the
Struts custom tag libraries, but may also be useful as simple examples
of the usage of various Struts tags.</li>
<li>
<strong>webapps/struts-template.war</strong> - This web application
both introduces and demonstrates the Struts template tags.</li>
<li>
<strong>webapps/struts-upload.war</strong> - This web application
is a quick example of uploading files using the Struts framework.</li>
</ul>
<p>To use Struts in your own application, you will need to follow
these steps:</p>
<ul>
<li>Copy the file <code>lib/struts.jar</code> from the Struts distribution
into the <code>WEB-INF/lib</code> directory of your web application.
</li>
<li>Copy the all of the files that match <code>lib/struts*.tld</code>
from the Struts distribution into the <code>WEB-INF</code> directory
of your web application.</li>
<li>Modify the <code>WEB-INF/web.xml</code> file for your web application
to include a <code><servlet></code> element to define the
controller servlet, and a <code><servlet-mapping></code> element
to establish which request URIs are mapped to this servlet. Use the
<code>WEB-INF/web.xml</code> file from the Struts example application
for a detailed example of the required syntax.</li>
<li>Modify the <code>WEB-INF/web.xml</code> file of your web application
to include the following tag library declarations:</li>
</ul>
<pre><taglib>
<taglib-uri>/WEB-INF/struts-bean.tld</taglib-uri>
<taglib-location>/WEB-INF/struts-bean.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>/WEB-INF/struts-html.tld</taglib-uri>
<taglib-location>/WEB-INF/struts-html.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>/WEB-INF/struts-logic.tld</taglib-uri>
<taglib-location>/WEB-INF/struts-logic.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>/WEB-INF/struts-template.tld</taglib-uri>
<taglib-location>/WEB-INF/struts-template.tld</taglib-location>
</taglib>
</pre>
<ul>
<li>Create a file <code>WEB-INF/struts-config.xml</code> that defines the
action mappings and other characteristics of your specific application.
You can use the <code>struts-config.xml</code> file from the Struts
example application for a detailed example of the required syntax.</li>
<li>At the top of each JSP page that will use the Struts custom tags,
add line(s) declaring the Struts custom tag libraries used on
this particular page, like this:</li>
</ul>
<pre><%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/struts-template.tld" prefix="template" %>
</pre>
<ul>
<li>When compiling the Java classes that comprise your application, be sure
to include the <code>struts.jar</code> file (copied earlier) on the
CLASSPATH that is submitted to the compiler.</li>
</ul>
</div>
<h2 id="Containers">Installing Struts with your servlet container</h2>
<div class="indent">
<p>
<strong>WARNING</strong> - Do <strong>NOT</strong> add
<code>struts.jar</code> to the classpath of your servlet container in an
attempt to avoid placing it in the <code>/WEB-INF/lib</code> directory of
each individual web app! Doing so will cause problems with
<code>ClassNotFoundException</code> exceptions.</p>
<p>For most containers, you need only to: </p>
<ul>
<li>Copy the WAR files in your Struts <code>/webapp</code> directory to your
containers <code>webapps</code> directory. </li>
<li>In some cases, you may need to restart your container if it is running.</li>
</ul>
<h4>Status of various containers</h4>
<ul>
<li>Bluestone Universal Business Server - <a href="installation-ubs72.html">Additional
steps required.</a>
</li>
<li>Borland Application Server 4.5 -No additional
steps required.</li>
<li>iPlanet Application Server - Service Pack 2 is recommended. Note that the database
object in the Struts-Example application is not compatible with this container.</li>
<li>iPlanet Web Server - <a href="installation-ip.html">Additional steps required.</a>
</li>
<li>iPortal Application Server - <a href="installation-ipas.html">Additional steps required.</a>
</li>
<li>Jetty - <a href="installation-jetty.html">Additional steps required.</a>
</li>
<li>JRun - <a href="installation-jr30.html">Additional steps required.</a>
</li>
<li>Orion Application Server - <a href="installation-oas.html">Additional steps
required.</a>
</li>
<li>Resin 1.2+ "standalone" - No additional steps required.</li>
<li>SilverStream 3.7.1 and later - <a href="installation-sas.html">Additional steps required.</a>
</li>
<li>Tomcat 3.1 and prior - Not recommended. Use Tomcat 3.2.1 or later.</li>
<li>Tomcat 3.2.1 with Apache - <a href="installation-tc.html">Additional steps
required.</a>
</li>
<li>Tomcat 3.2.1+ "standalone" - No additional steps required.</li>
<li>Tomcat 4.0 - No additional steps required.</li>
<li>Weblogic - <a href="installation-wls5.html">Additional steps required.</a>
</li>
<li>WebLogic 6.0+ - No additional steps required.</li>
<li>WebSphere - <a href="installation-was352.html">Additional steps required.</a>
</li>
<li>WebSphere - <a href="installation-was352-x.html">Steps for the Example Application.</a>
</li>
</ul>
</div>
<h2 id="Building">Building Struts From Source</h2>
<div class="indent">
<p>First, download a source distribution of Struts by following the
instructions <a href="../acquiring.html">here</a>. Then, make sure
you have downloaded and installed <strong>all</strong> of the
<a href="#Prerequisites">prerequisite</a> software packages described
above.</p>
<p>To build Struts, you will need to customize the build process to the
details of your development environment as follows:</p>
<ul>
<li>The Struts source distribution uses a file named
<code>build.properties</code> (in the top-level directory of the
distribution) to identify the location of external components
that Struts depends on.</li>
<li>There is no <code>build.properties</code> file included with the
source distribution. However, there is an example file named
<code>build.properties.example</code> that you can copy to
<code>build.properties</code> and then customize.</li>
<li>The properties you must configure in <code>build.properties</code> are:
<ul>
<li>
<strong>catalina.home</strong> - Pathname to the directory of your
binary distribution of Tomcat 4.0 (required only if you wish to
use the <code>deploy.catalina</code> target).</li>
<li>
<strong>servletapi.home</strong> - Pathname to the directory of
your binary distribution of the Servlet API classes.</li>
<li>
<strong>tomcat.home</strong> - Pathname to the directory of your
binary distribution of Tomcat 3.2 (required only if you wish to
use the <code>deploy.tomcat</code> target).</li>
<li>
<strong>xerces.home</strong> - Pathname to the directory of your
binary distribution of the Xerces parser, version 1.2 or 1.3
(required only if you wish to use the <code>deploy.catalina</code>
target).</li>
</ul>
</li>
<li>If you are a Struts developer with write access to the CVS repository,
be sure that you do <strong>NOT</strong> check in a copy of the
<code>build.properties</code> file, since it will be different for
each individual developer.</li>
</ul>
<p>To build a "distribution" version of Struts, first change your current
directory to the directory in which you have unpacked the Struts
source distribution, and (if necessary) create or customize the
<code>build.properties</code> file as described above. Then, type:</p>
<pre>
ant dist
</pre>
<p>This command will create a binary distribution of Struts, in a
directory named <code>dist</code> (relative to where you
are compiling from). This directory contains an exact replica of the
files included in a binary distribution of Struts, as described
in the <a href="#Installing">preceding section</a>.</p>
</div>
</div>
<!--end main-->
</div>
<!--end content-->
<div id="footer">
<img id="powered-logo" alt="Powered by Struts" src="../images/struts-power.gif" />
Copyright (c) 2000-2005, The Apache Software Foundation <span class="noprint">-
<a href="http://wiki.apache.org/struts/StrutsDocComments">Comments?</a>
</span>
</div>
<!--end footer-->
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -