struts 2运行和配置中出现错误

调试struts程序。出现下面错误

错误:

  type Status report 

message /Struts2/ 

description The requested resource (/Struts2/) is not available.

 

其中:web.xml中配置:

<?xml version="1.0" encoding="UTF-8"?>

<web-app id="WebApp_ID" 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>Struts 2.0 StrutsDemo</display-name>
    <filter>
        <filter-name>struts2</filter-name>       
         <filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
    </filter>
    <filter-mapping>
        <filter-name>struts2</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>
    <welcome-file-list>
        <welcome-file>index.html</welcome-file>
    </welcome-file-list>
</web-app>

 

  一开始没有进行web.xml配置时候,可以正常运行建立的jsp文件,但是添加了filter过滤器和过滤器映射后,却不能运行。经过检查,其他action文件,struts.xml文件配置均没有错误。后面着重对web。xml进行分析,觉得问题大致出现的可能性:

 

    首先,看包的导入是否完整。一般需要导入的包有: 
  commons-logging-1.0.4.jar 
  freemarker-2.3.8.jar  
  ognl-2.6.11.jar  
  struts2-core-2.0.6.jar 
  xwork-2.0.1.jar 
  commons-fileupload-1.2.1.jar 
  commons-io-1.32.jar

   其次:就是看你web.xml中是否含有
  <welcome-file>index.html</welcome-file>
  <welcome-file>index.htm</welcome-file>
  <welcome-file>index.jsp</welcome-file>
  <welcome-file>default.html</welcome-file>
  <welcome-file>default.htm</welcome-file>
  <welcome-file>default.jsp</welcome-file>
之类的默认显示界面,其中的页面显示的jsp可以自行定义和配置相应的action用于界面的显示
  
  第三:就是看在web.xml中是否有书写错误:
  <?xml version="1.0" encoding="UTF-8"?>  
<web-app 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">

 第四:可能出现的可能性很小
  就是可能是用的开发环境和平台的问题.最后是重新又写了几遍才好。

 

 

 最后的解决方法,我觉得可能是与他的eclipse环境有关。因为同样的程序在我的机子上运行的很顺畅。

转载于:https://www.cnblogs.com/ttltry-air/archive/2011/03/24/1993353.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值