我已经在 jboss 上部署了我的 struts 2 应用程序作为 7 和 eclipse。控制台没有显示错误,但是当我尝试打开“localhost:8080/site”时,出现 404 页面错误。我试图从我的浏览器访问一些资源,例如 localhost:8080/site/img/logo.png 并且它运行良好,所以服务器运行正常,应用程序实际上已部署,但似乎我无法访问任何 jsp 文件. 有任何想法吗?相同的应用程序在 Tomcat 7 上运行良好。
这是 web.xml
<?xml version="1.0" encoding="UTF-8"?><web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">
<display-name>versus</display-name>
<session-config>
<session-timeout>240</session-timeout>
<tracking-mode>COOKIE</tracking-mode>
</session-config>
<security-role>
<role-name>Denied</role-name>
</security-role>
<security-constraint>
<web-resource-collection>
<web-resource-name>Deny Direct Access</web-resource-name>
<url-pattern>*.pdf</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>Denied</role-name>
</auth-constraint>
</security-constraint>
<filter>
<filter-name>UrlRewriteFilter</filter-name>
<filter-class>org.tuckey.web.filters.urlrewrite.UrlRewriteFilter</filter-class>
<init-param>
<param-name>logLevel</param-name>
<param-value>WARN</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>UrlRewriteFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
<dispatcher>FORWARD</dispatcher>
<dispatcher>REQUEST</dispatcher>
</filter-mapping>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
这是 index.jsp
<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%><%@ taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Versus</title>
<meta http-equiv="refresh" content="0;url=home?request_locale=en">
</head>
<body>
</body>
</html>
这是 struts.xml 的片段
<struts>
<constant name="struts.enable.DynamicMethodInvocation" value="false" />
<constant name="struts.devMode" value="false" />
<constant name="struts.custom.i18n.resources" value="resources.ApplicationResources" />
<constant name="struts.locale" value="en" />
<constant name="struts.multipart.maxSize" value="10000000" />
<constant name="struts.i18n.encoding" value="ISO-8859-1" />
<package name="default" extends="struts-default">
<!-- INTERCEPTOR -->
<interceptors>
<interceptor name="mobile" class="utils.MobileInterceptor" />
<interceptor-stack name="myStack">
<interceptor-ref name="mobile" />
<interceptor-ref name="defaultStack" />
</interceptor-stack>
</interceptors>
<default-interceptor-ref name="myStack" />
<global-results>
<result name="success">/jsp/template.jsp</result>
<result name="input">/jsp/template.jsp</result>
<result name="error">/jsp/error.jsp</result>
<result name="none">/jsp/error.jsp</result>
</global-results>
<!-- GENERAL -->
<action name="index" class="controller.ActionIndex" method="execute" />
<action name="redirect" class="controller.ActionRedirect"
method="execute" />
<action name="login" class="controller.ActionLogin" method="login">
<result name="logged" type="redirectAction">redirect?request_locale=it&page=${page}&l4vUserLat=${l4vUserLat}&l4vUserLon=${l4vUserLon}
</result>
</action>
<action name="logout" class="controller.ActionLogin" method="logout" />