全て、
検索して調査しましたが、Tomcat 7.x から WebSphere 8.0 に既存のプロジェクトを移行するために不足しているものを見つけることができません。この問題の回避策を作成しましたが、理由がわからないため、好奇心が勝っています。私の問題は、最初にプロジェクトを WebSphere にロードしたときにThere is no Action mapped for namespace [/] and action name [] associated with context path
. 私は調査し、試してみるべきいくつかのことを見つけました。追加した
com.ibm.ws.webcontainer.removetrailingservletpathslash=true
com.ibm.ws.webcontainer.mapFiltersToAsterisk=true
com.ibm.ws.webcontainer.invokefilterscompatibility=true
役に立たず、最終的にウェルカムページにリダイレクトする空のアクションを追加しましたが、すべてうまくいきました。ただし、個人的にはこれは回避策であり、修正ではないと考えています。では、私の質問は、なぜウェルカム ファイル リストに含まれないのかということだと思います。プロジェクトのセットアップ/転送で何かを見逃していませんか? フィルターの仕組みを誤解していますか?
struts2 の回避策である web.xml とファイル構造を以下に示します。お手伝いできることは何でもありがとう。
JF
web.xml スニピット
<filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>securityContextFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
struts.xml スニピット
<package name="dst" extends="struts-default" namespace="/">
<!-- Added as a workaround to the problem -->
<action name="">
<result>/index.jsp</result>
</action>
</package>
使用中のファイル構造
web
----WEB-INF
--------jsp (Folder holding jsps)
--------lib (Extra jars being used)
--------web.xml
----index.jsp
編集
リクエストに応じて
索引.jsp
<%@ page language="java" import="java.util.*" %>
<%@ include file="/WEB-INF/jsp/include/taglib.jsp" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
</head>
<body>
<div> Test Page</div>
</body>
</html>