2013-09-01 68 views
1

我想用Jboss AS 7服务器构建我的第一个struts应用程序。 我有以下的错误后部署:请求的资源(/ StrutsHelloWorld /)不可用。 Jboss AS7服务器

HTTP Status 404 - /StrutsHelloWorld/ 

type Status report 

message /StrutsHelloWorld/ 

description The requested resource (/StrutsHelloWorld/) is not available. 
JBoss Web/7.0.13.Final 

我跟着向导从http://viralpatel.net/blogs/tutorial-create-struts-2-application-eclipse-example/和变化对

<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class> 

web.xml文件我没有部署错误。

下面是我的文件:

web.xml

<?xml version="1.0" encoding="UTF-8"?> 
<web-app id="WebApp_9" version="2.4" 
    xmlns="http://java.sun.com/xml/ns/j2ee" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"> 

    <display-name>Struts2 Application</display-name> 
    <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> 
    </filter-mapping> 
    <welcome-file-list> 
     <welcome-file>Login.jsp</welcome-file> 
    </welcome-file-list> 

</web-app> 

struts.xml

<?xml version="1.0" encoding="UTF-8" ?> 
<!DOCTYPE struts PUBLIC 
    "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN" 
    "http://struts.apache.org/dtds/struts-2.0.dtd"> 

<struts> 
    <constant name="struts.enable.DynamicMethodInvocation" 
     value="false" /> 
    <constant name="struts.devMode" value="false" /> 
    <constant name="struts.custom.i18n.resources" 
     value="ApplicationResources" /> 

    <package name="default" extends="struts-default" namespace="/"> 
     <action name="login" 
      class="net.viralpatel.struts2.LoginAction"> 
      <result name="success">Welcome.jsp</result> 
      <result name="error">Login.jsp</result> 
     </action> 
    </package> 
</struts> 

JAR文件:

公地文件上传-1.3.jar,公地-IO-2.0.1.jar, 共享记录-1.1.3.jar,共享记录-API-1.1.jar, freemarker的-2.3.19的.jar,OGNL-3.0.6.jar,Struts的核心2.3.15.1.jar, XWork的核心 - 2.3.15.1.jar

回答

0

以下配置添加到您的"/"

<action name=""> 
    <result>/Login.jsp</result> 
</action> 

并删除

<welcome-file-list> 
    <welcome-file>Login.jsp</welcome-file> 
</welcome-file-list> 
+0

我也跟着,但仍然没有工作.. HTTP状态404 -/StrutsHelloWorld/ 类型状态报告 消息/ StrutsHelloWorld/ 描述所请求的资源(/ StrutsHelloWorld /)不可用。 JBoss Web/7.0.13.Final 我从web.xml中删除,并在struts.xml中添加了“ – John

+0

有什么不起作用? 404由于添加了默认操作并删除了欢迎文件而解决,您是否在Web内容根文件夹中有“Login.jsp”?它对我很好。你确定你在url中有正确的上下文路径吗? –

+0

或者您错误地部署了您的web应用程序,您正在运行哪个服务器实例,请将'.war'文件部署到部署位置。在使用JBoss之前,您是否尝试将它部署到Tomcat? –