目录结构如下: 
根目录在 D:/Tomcat 6.0/webapps/Struts2 
index.jsp:              D:/Tomcat 6.0/webapps/Struts2/index.jsp 
web.xml:                D:/Tomcat 6.0/webapps/Struts2/WEB-INF/web.xml 
struts.xml:              D:/Tomcat 6.0/webapps/Struts2/WEB-INF/classes/struts.xml 
TestAction.class  D:/Tomcat 6.0/webapps/Struts2/WEB-INF/classes/TestAction.class web.xml: 
<?xml version="1.0" encoding="GBK"?>
<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">
<!-- 定义Struts2的FilterDispathcer的Filter -->
    <filter>
        <filter-name>struts2</filter-name>
        <filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
    </filter> <!-- FilterDispatcher用来初始化struts2并且处理所有的WEB请求。 -->
    <filter-mapping>
        <filter-name>struts2</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping></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>
    <package name="lee" extends="struts-default">
        <action name="Test" class="TestAction">
         <result name="success">welcome.jsp</result>
        </action>
    </package>
</struts>
************************************************************************************** index.jsp <%@ page language="java" contentType="text/html; charset=GBK"%>
<html>
<head>
<title>登录页面</title>
</head>
<body>
<form action="Test" method="get">
<input type="submit" value="Test"/>
</form>
</body>
</html>index.jsp可以正常显示,但是点击Test按钮会出现错误: 
type Status reportmessage /struts2qs/Testdescription The requested resource (/struts2qs/Test) is not available.

解决方案 »

  1.   

    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> 
        <package name="lee" extends="struts-default"> 
            <action name="Test" class="TestAction"> 
            <result name="success">welcome.jsp </result> 
            </action> 
        </package> 
    </struts> 
    配置中class需要加上包名的啊
      

  2.   


    没写包名是跟Spring结合的写法,你没结合Spring所以要把包名写完整
      

  3.   

    你的action路径错了
    把你那个package的name属性去掉就ok了
    action后面加上.action
      

  4.   

    我直接把类放在classes目录下了,这个TestAction没有依赖任何的包。
      

  5.   


    我去掉package的name属性后,都无法通过tomcat启动这个工程了,必须得加上的吧?
    此外,我试验了添加.action,也不奏效,哭死。
      

  6.   

    楼主没有理解我的意思
    我是说把name的值去掉
    需要加我QQ:492236022
    给你满意答案
      

  7.   


    非常感谢。
    这个问题我解决了,就是在jsp页面的form的action属性中调用action时,加上.action后缀就好使了。
    至于package定义时的name字段,我的理解是name到底起什么名字,没有什么关系,它只是在当你想extends某个package时才被使用到。
      

  8.   


    这个问题我解决了,就是在jsp页面的form的action属性中调用action时,加上.action后缀就好使了。
    至于package定义时的name字段,我的理解是name到底起什么名字,没有什么关系,它只是在当你……
    [/Quote]我也是这个问题,找了好多地方,都没说清楚,现在终于解决了,谢谢