|
Strutsフレームワーク
|
| Installing Struts with your servlet container |
|
| サーブレットコンテナにStrutsをインストールする |
- These instructions assume you have successfully integrated Tomcat with Apache
according to the Tomcat documentation.
- Copy "struts-documentation.war" and "struts-example.war" to your $TOMCAT_HOME/webapps
directory
- Restart Tomcat if it is already running
- Tomcat will generate a file "$TOMCAT_HOME/conf/tomcat-apache.conf" that
will be used by Apache. This file is regenerated every time you start Tomcat,
so copy this file to a safe place (such as your Apache configuration directory;
on Unix systems this is usually
/usr/local/apache/conf.
- If you are running Tomcat 3.1, Tomcat will not have generated the entries
for your new applications. Add the following lines to the
tomcat-apache.conf
file that you have saved, replacing $TOMCAT_HOME with the path to your Tomcat
home directory:
- この手引きは、あなたが Tomcat ドキュメントに沿って Tomcat と Apache を連携できていることを想定しています。
- "struts-documentation.war" と "struts-example.war" を、 $TOMCAT_HOME/webapps
ディレクトリにコピーしてください。
- Tomcat が実行中ならば再起動します。
- Tomcat は "$TOMCAT_HOME/conf/tomcat-apache.conf" ファイルを生成し、生成されたファイルは
Apache により使用されます。このファイルは Tomcat を開始するたびに再生成されますので、
このファイルを安全な場所にコピーしてください。 (例えば Apache の設定ディレクトリ;
Unix システム上では通常
/usr/local/apache/confです。
- Tomcat 3.1 の場合、Tomcat は新しいアプリケーションのエントリを追加しないでしょう。
以下の行を保存した
tomcat-apache.conf ファイルに追加し、
$TOMCAT_HOME をあなたの Tomcat ホーム・ディレクトリに変更します:
Alias /struts-documentation "$TOMCAT_HOME/webapps/struts-documentation
<Directory "$TOMCAT_HOME/webapps/struts-documentation>
Options Indexes FollowSymLinks
</Directory>
ApJServMount /struts-documentation/servlet /struts-documentation
<Location "/struts-documentation/WEB-INF/">
AllowOverride None
deny from all
</Location>
Alias /struts-example "$TOMCAT_HOME/webapps/struts-example"
<Directory "$TOMCAT_HOME/webapps/struts-example>
Options Indexes FollowSymLinks
</Directory>
ApJServMount /struts-example/servlet /struts-example
<Location "/struts-example/WEB-INF/">
AllowOverride None
deny from all
</Location>
- On all versions of Tomcat, the generated file above does not know anything
about extension mappings defined in a web.xml file, so the "*.do" URIs that
go to the controller servlet will not be recognized. To fix this, add the
following line to the saved version of "tomcat-apache.conf", after the corresponding
line for the .jsp extension:
AddHandler jserv-servlet .do
- Ensure that the saved version of "tomcat-apache.conf" is referenced in your
Apache "httpd.conf" configuration file. A typical use would have the following
line at the bottom of "httpd.conf":
Include /usr/local/apache/conf/tomcat-apache.conf
- In order to recognize "index.jsp" as a default page for web applications,
search in your "httpd.conf" for a "DirectoryIndex" directive. If you have
one, add "index.jsp" to the end of the list, so that it might look like this:
DirectoryIndex index.html index.jsp
If you do not have such an entry, add one like this:
DirectoryIndex index.jsp
- Restart Apache to make it aware of the new applications. You should now
be able to access the applications from a browser like this:
http://localhost/struts-documentation
http://localhost/struts-example
- 全てのバージョンの Tomcat 上で、上述の生成されたファイルは、 web.xml ファイルで
定義された拡張子マッピングについては何も知りませんので、コントローラ・サーブレットへ
転送される"*.do" の URI は認識されません。
これを修正するには、保存された "tomcat-apache.conf"の.jsp 拡張子の該当行の後に、
以下の行を追加してください:
AddHandler jserv-servlet .do
- 保存された "tomcat-apache.conf" があなたの Apache の "httpd.conf" 設定ファイルで
参照されていることを確認してください。 典型的な使用法では、以下の行が
"httpd.conf" の末尾に存在します:
Include /usr/local/apache/conf/tomcat-apache.conf
- index.jsp" をウェブ・アプリケーションのデフォルトページとして認識させるは、
"httpd.conf" 中で "DirectoryIndex" ディレクティブを探してください。見つかったならば、
"index.jsp" をリストの末尾に追加します。結果、このようになるでしょう:
DirectoryIndex index.html index.jsp
そのようなエントリがないならば、このようなエントリを追加してください:
DirectoryIndex index.jsp
- Apache を再起動することで、新しいアプリケーションを認識させます。 これで
ブラウザからアプリケーションにアクセスできるようになったはずです:
http://localhost/struts-documentation
http://localhost/struts-example
- Author: Craig R. McClanahan
Back to Installation
インストールへ戻る
|
|