此回复为自动发出,仅用于显示而已,并无任何其他特殊作用
楼主【gpm】截止到2008-06-23 18:37:24的历史汇总数据(不包括此帖):
发帖数:1                  发帖分:100                
结贴数:0                  结贴分:0                  
未结数:1                  未结分:100                
结贴率:0.00  %            结分率:0.00  %            
如何结贴请参考这里:http://topic.csdn.net/u/20080501/09/ef7ba1b3-6466-49f6-9d92-36fe6d471dd1.html

解决方案 »

  1.   

    <package name="MyTest"  extends="struts-default"> 
    这一个地方配置错误,你的login.jsp是放在/WEB-INF/MyTest下的,所以你的package里面应该添加属性namespace="/MyTest"
    你可以试试
      

  2.   

    怀疑是spring的问题,将web.xml贴出来看看.
      

  3.   

    MyTest是工程名吧这样试试<s:form action="login.action"  method="post"> 不过我记得不需要加的,试试吧
      

  4.   

    回zw2455,我的login.jsp是放在web-inf下的,也曾经试过加namespace="/",报的错依旧:(
    回new_bird_0001: 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"> <filter>
    <filter-name>struts-cleanup</filter-name>
    <filter-class>
    org.apache.struts2.dispatcher.ActionContextCleanUp
    </filter-class>
    </filter> <filter>
    <filter-name>struts2</filter-name>
    <filter-class>
    org.apache.struts2.dispatcher.FilterDispatcher
    </filter-class>
    </filter> <filter-mapping>
    <filter-name>struts-cleanup</filter-name>
    <url-pattern>/*</url-pattern>
    </filter-mapping> <filter-mapping>
    <filter-name>struts2</filter-name>
    <url-pattern>/*</url-pattern>
    </filter-mapping> <listener>
    <listener-class>
    org.springframework.web.context.ContextLoaderListener
    </listener-class>
    </listener> <welcome-file-list>
    <welcome-file>index.jsp</welcome-file>
    </welcome-file-list>
    </web-app>
      

  5.   

    回Landor2004,试了改了一下,还是不行,不过错误提示发生变化了,以下是console的报错信息及浏览器的错误提示:HTTP Status 404 - There is no Action mapped for namespace / and action name login.--------------------------------------------------------------------------------type Status reportmessage There is no Action mapped for namespace / and action name login.description The requested resource (There is no Action mapped for namespace / and action name login.) is not available.
    --------------------------------------------------------------------------------Apache Tomcat/6.0.16
    2008-6-23 21:57:33 org.apache.struts2.components.Form evaluateExtraParamsServletRequest
    警告: No configuration found for the specified action: 'login.action' in namespace: ''. Form action defaulting to 'action' attribute's literal value.
    2008-6-23 21:57:35 org.apache.struts2.components.Form evaluateExtraParamsServletRequest
    警告: No configuration found for the specified action: 'login.action' in namespace: ''. Form action defaulting to 'action' attribute's literal value.
    2008-6-23 21:57:41 org.apache.struts2.dispatcher.Dispatcher serviceAction
    严重: Could not find action or result
    There is no Action mapped for namespace / and action name login. - [unknown location]
    at com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:186)
    at org.apache.struts2.impl.StrutsActionProxyFactory.createActionProxy(StrutsActionProxyFactory.java:41)
    at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:494)
    at org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:419)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.struts2.dispatcher.ActionContextCleanUp.doFilter(ActionContextCleanUp.java:99)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
    at java.lang.Thread.run(Unknown Source)
      

  6.   

    根据错误提示来看 ,确实需要配置命名空间,
    另外,你的web.xml可能没有配置如下内容 
        <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>
      

  7.   

    你的applicationContext.xml放在哪个目录里?
      

  8.   

    在你的 struts.xml中,这样: <package name="MyTest" namespace="/MyTest" extends="struts-default"> 
      

  9.   

    回 new_bird_0001: applicationContext.xml发布在WEB-INF/CLASSES下
      

  10.   

    你将他拷贝到WEB-INF下,或者陪一下他的路径
      

  11.   

    回whetu:
    web.xml中已经配了Filter, 也按照你说的加了namespace到sturts.xml中现象依然如故,一点都没变:(
      

  12.   

    回new_bird:放到WEB-INF下之后Tomcat启动时就报错了,
    2008-6-23 22:21:48 org.springframework.web.context.ContextLoader initWebApplicationContext
    严重: Context initialization failed
    org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from ServletContext resource [/WEB-INF/applicationContext.xml]; nested exception is java.io.FileNotFoundException: Could not open ServletContext resource [/WEB-INF/applicationContext.xml]
    Caused by: java.io.FileNotFoundException: Could not open ServletContext resource [/WEB-INF/applicationContext.xml]
      

  13.   

    有种可能是,你的程序根本没找到struts.xml
    你把struts.xml放在什么位置了,这个应该是放在classpath下面,也就是你的src中,或者看看名字写错了没有
      

  14.   

    No configuration found for the specified action: 'login' in namespace: ''. Form action defaulting to 'action' attribute's literal value. 
    他说:在你的配置文件中的 ''命名空间中找不到login这个action。 
    你调用的是/MyTest/login 根据struts2的定义命名空间应该为/MyTest。所以 根据描述,请根据红色部分修改,加入命名空间。 <package name="MyTest"  extends="struts-default" namespace="/MyTest"> 
      <action name="login" class="loginAction"> 
              <result name="success">/ok.jsp </result> 
              <result name="login">/login.jsp </result> 
      </action> 
    </package> 怎么有一个同样的贴出现了?
      

  15.   

    看看哪路径是不是写错了,特别注意 SPRING配置文件里
      

  16.   

     <constant name="struts.objectFactory" value="spring" />在struts.xml里加上这句话,以及struts2 spring 的plugin包,把include struts-default.xml那句话去掉。
      

  17.   

    怎么MyEclipse6.5不支持Struts2捏??
      

  18.   


    异常时这么说的
    message There is no Action mapped for namespace / and action name login. 
    没有找到在 '/'这个命名空间上的login 这个actiondescription The requested resource (There is no Action mapped for namespace / and action name login.) is not available. 
    配置中没有相应的描述。另外
    <action name="login" class="loginAction"> 
    你的loginAction放在default package下面了?
      

  19.   

    多亏Landor2004老兄,我的粗心敲错了struts.xml的文件名导致了这个错,要不是Landor2004的提醒恐怕到现在还没能发现问题的所在。麻烦各位了,谢谢大家的帮助