jsp页面代码:<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<s:form action="TestAction" >            //************就是这行***************
     Name: <s:textfield name="name" />
     <s:submit label="submit"> </s:submit>
</s:form>
</body>
</html>struts.xml配置文件:
<!DOCTYPE struts PUBLIC
        "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
        "http://struts.apache.org/dtds/struts-2.0.dtd">
<struts>
    <include file="struts-default.xml"/>
    <package name="test" extends="struts-default">
        <action name="TestAction" class="test.MyTest">
            <result>print.jsp</result>
        </action>
    </package>
</struts>问题:
就是打注释的那行有问题(有个红差差),说什么“The value [TestAction] for attribute [action] in tag [form] is not valid.”
在网上查了一下,有人说有个红差不要紧也能跑,我就去试了一下,
结果:
HTTP Status 404 - /myTest/TestAction--------------------------------------------------------------------------------type Status reportmessage /myTest/TestActiondescription The requested resource (/myTest/TestAction) is not available.小弟刚刚才开始学struts2所以遇上这个问题怎么解就解决不了,希望达人们能指点一下,谢了。

解决方案 »

  1.   

    你的struts.xml配置该action了吗??
      

  2.   

    <s:form action="TestAction.action" >这样试一试 
      

  3.   

    试了,不行啊
    The value [TestAction.action] for attribute [action] in tag [form] is not valid.
      

  4.   

     你的struts.xml配置文件让大家看看。
      

  5.   

    <!DOCTYPE struts PUBLIC
            "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
            "http://struts.apache.org/dtds/struts-2.0.dtd">
    <struts>
        <include file="struts-default.xml"/>
        <package name="test" extends="struts-default">
            <action name="TestAction" class="test.MyTest">
                <result>print.jsp</result>
            </action>
        </package>
    </struts>是这个吗?我只想先试一个跳转所以就写了这么多
      

  6.   

    <result>/print.jsp </result> 
      

  7.   


    这位前辈,我已经按你说的改好了,可是运行的时候还是这样的报错:
    HTTP Status 404 - /myTest/TestAction--------------------------------------------------------------------------------type Status reportmessage /myTest/TestActiondescription The requested resource (/myTest/TestAction) is not available.
      

  8.   

    你的web.xml
    配置过滤器没有??
      

  9.   


      <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>
      

  10.   

    这个是我的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>myTest</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>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>
      </welcome-file-list>
    </web-app>
      

  11.   

    我刚把eclipse和服务器都重启了,但还是:
    HTTP Status 404 - /myTest/TestAction--------------------------------------------------------------------------------type Status reportmessage /myTest/TestActiondescription The requested resource (/myTest/TestAction) is not available.这样,对了,标签的版本会不会有问题呢,我的struts2是struts-2.0.9的,开发的IDE是ObjectWeb Lomboz for JavaEE Development Version: 3.3的
      

  12.   

    这个应该不是问题,奇怪了,你的test.MyTest对吗??
      

  13.   

    这是我的test.MyTest文件的代码package test;import com.opensymphony.xwork2.ActionSupport;public class MyTest extends ActionSupport {

    private String name;
        
        public String getName() {
            return name;
        }
        
        public void setName(String name) {
            this.name = name;
        }
        
        public String execute() {
            name = "Hello, " + name + "!"; 
            return SUCCESS;
        }
        }
      

  14.   

    我导的包:
    commons-logging-api-1.1
    freeer-2.3.8
    ognl-2.6.11
    struts2-core-2.0.9
    xwork-2.0.4我的QQ:254728713
      

  15.   

    问题解决了,是我把struts.xml文件放错位置了,我按照我以前的想法把struts.xml文件和web.xml放在同一路径下了,所以一直都找不到,现在我把他放到src目录就行了,谢谢了.
      

  16.   

    俺不小心把web.xml从WEB-INF中拿出来,并改了名,改回去它就不认识了。。
    真可爱。。