解决方案 »

  1.   

    struts.xml的内容
    <?xml version="1.0" encoding="UTF-8" ?>
    <!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
     "http://struts.apache.org/dtds/struts-2.3.dtd">
    <struts>
    <package name="itcast" namespace="/test" extends="struts-default">
    <action name="helloworld" class="cn.itcast.action.HelloWorldAction">
    <!-- 定义逻辑视图和物理资源之间的映射 -->  
                <result name="error">index.jsp</result>
    <result name="success">/WEB-INF/page/hello.jsp</result>
    </action>
    </package>
    </struts>
      

  2.   

    namespace="/test" 将设置为 namespace="/" 试试看
      

  3.   

    Action找不到 你确定地址没写错吗
    应该是           项目名/test/helloword
      

  4.   

    HelloWorldAction.java的内容
    package cn.itcast.action;import com.opensymphony.xwork2.ActionSupport;public class HelloWorldAction extends ActionSupport {
    private String msg;

    public String getMessage() {
    return msg;
    } public String execute(){
    msg ="我的第一个struts应用";
    return "success";
    }
    }
      

  5.   

    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" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">
    <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>hello.jsp</welcome-file>
      </welcome-file-list>
    </web-app>   
      

  6.   

    看看是否缓存的影响,把tomcat缓存清理下,把浏览器缓存清理下,然后重新发布项目,重启tomcat。
    还有问题的话,楼主把你的页面贴出来吧。
      

  7.   


    清了crhrome的缓存,还是一样的
      

  8.   


    这个是hello.jsp:
    <%@ page language="java" contentType="text/html; charset=UTF-8"
        pageEncoding="UTF-8"%>
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <meta http-equiv="Expires" content="0">
    <meta http-equiv="kiben" content="no-cache">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>Insert title here</title>
    </head>
    <body>
    ${message }
    </body>
    </html>
      

  9.   

    楼主贴错了,要的是index.jsp ,请求的配置在index.jsp里面 把index.jsp贴出来
      

  10.   

    楼主,你访问地址出错了,因为你在配置文件中配置的是/test,所以访问的时候地址应该是:
    http://localhost:8080/Struts2/test/
    这个才是正确的访问地址
    你原先访问的是:
    http://localhost:8080/Struts2/,服务器会默认找/下面的应用,找不到肯定给你报错呀
      

  11.   

    项目启动后手动输入http://localhost:8080/Struts2/test/hello
      

  12.   

    http://localhost:8080/Struts2/test/helloworld
      

  13.   

    这个访问路径http://localhost:8080/Struts2/test/helloworld 没有错的,代码处看也没什么错,楼主,把配置的Tomcat服务器删除了,重新建一个,清空浏览器缓存再试试