论坛首页 入门讨论版 Spring

STRUTS2.09+HIBERNATE3.2+SPRING2.05 只能访问ACTION不能访问其它文件

浏览 326 次
该帖已经被评为新手帖
作者 正文
最后更新时间:2007-12-06 关键字: STRUTS2.09+HIBERNATE3.2+SPRING2.05
在WEB.XML中的       <welcome-file>   /struts/index.jsp   </welcome-file>       可以正常显示出来,通过该页面也可以执行查询,功能正常。   但是该面面的图片也不能显示。

在地址栏内输入任何文件都不能访问,只能访问ACTION。  
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"   xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"   xsi:schemaLocation="http://java.sun.com/xml/ns/javaee   http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"   id="WebApp_ID"   version="2.5"> 
    <display-name> Search   Order </display-name> 

  <context-param> 
        <param-name> contextConfigLocation </param-name> 
        <param-value> /WEB-INF/classes/beans.xml </param-value> 
        </context-param> 
        <filter> 
                <filter-name> struts </filter-name> 
                <filter-class> org.apache.struts2.dispatcher.FilterDispatcher </filter-class> 
        </filter> 

        <filter-mapping> 
                <filter-name> struts </filter-name> 
                <url-pattern> /* </url-pattern> 
        </filter-mapping> 
          
        <listener> 
        <listener-class> org.springframework.web.context.ContextLoaderListener </listener-class> 
</listener> 
  <welcome-file-list> 
            <welcome-file> /struts/index.jsp </welcome-file> 
  </welcome-file-list> 


</web-app> 

STRUTS.XML配置如下:
<?xml   version="1.0"   encoding="GBK"?> 
<!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.devMode"   value="true"/> 
<constant   name="struts.enable.DynamicMethodInvocation"   value   ="false"/>         
<constant   name="struts.objectFactory"   value="spring"/> 
<include   file="struts-default.xml"/> 
<package   name="net.order.web.struts"   extends="struts-default" 
namespace="/struts"> 
<action   name="Search"   class="results"> 
<result   name="success"> /struts/result.jsp </result> 
<result   name="FAIL"> /struts/error.jsp </result> 
</action> 
</package> 
</struts> 

BEANS配置如下:
<bean   id="results"   scope="prototype"   class="net.order.web.struts.search">   
<property   name="service"   ref="service"   /> 
</bean> 
   
最后更新时间:2007-12-07
spring的配置文件名字不是为:applicationContext.xml吗?没看到啊。另外,在struts.xml中,楼主也没有指名由spring管理action啊,所以,spring在这里并没有起到作用。
   
0 请登录后投票
论坛首页 入门讨论版 Spring

跳转论坛:
JavaEye推荐