项目是手动建立在tomcatwebapps下的。
目录结构:
Strutss
    ---login.jsp
    ---web-inf
           ---classes
                  ---java
                        ---LoginAction.class
                        struts.xml
           ---lib
           ---src
                ---java
                     ---LoginAction.java
                     struts.xml
           ---web.xml
web.xml代码:
<?xml version="1.0" encoding="GBK"?> 
<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">
  <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>index.html</welcome-file>
    </welcome-file-list>
</web-app>
struts.xml代码:
<?xml version="1.0" encoding="GBK"?> 
<!-- 指定Struts 2 配置文件的DTD 信息 --> 
<!DOCTYPE struts PUBLIC
    "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
    "http://struts.apache.org/dtds/struts-2.0.dtd">
<!-- struts 是Struts 2 配置文件的根元素 --> 
<struts>
  <!-- Struts 2的Action必须放在指定的包空间下定义--> 
  <package name="default" extends="struts-default"> 
  <!--定义login的Action,该Action的实现类为lee.Action 类 --> 
         <action name="Login" class="java.LoginAction" > 
   <!-- 定义处理结果和资源之间的映射关系 --> 
              <result name="error">/error.jsp</result> 
              <result name="success">/welcome.jsp</result>         
         </action> 
</package>
</struts>
login.jsp部分代码:
<form action="Login.action" method="post">
点了登录按钮后一直出现The requested resource (There is no Action mapped for namespace / and action name Login.) is not available.这个错。
求大神指教怎么配置。小弟才学啊

解决方案 »

  1.   

    namespace=""  加上 另外result里不需要/吧 
    如果还有问题 检查url吧
      

  2.   

    默认 命名空间 namespace="/"
    ·
    不然 需要 手动再改路径
      

  3.   

    不行啊。。改了还是提示The requested resource (There is no Action mapped for namespace / and action name Login.) is not available这个错误啊
      

  4.   

    <form action="/Login.action" method="post">
      

  5.   

    <form action="Login.action" method="post">
    在Login.action前加上你的命名空间,默认的话为/
      

  6.   

    <action name="/项目名/Login.action" class="java.LoginAction" >  
      

  7.   

    把struts2的默认拦截器加上:<interceptor-ref name="defaultStack"/>
      

  8.   

    把struts2的默认拦截器加上:<interceptor-ref name="defaultStack"/>