myeclipse6.0,8.6都测试可以部署struts,并且运行正常,为什么9.0就暴404错误啊,请问哪位大虾知道吗,我是刚学JAVA EE的新手,具体代码如下
index.jsp
Java code<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>My JSP 'index.jsp' starting page</title>
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">    
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="This is my page">
    <!--
    <link rel="stylesheet" type="text/css" href="styles.css">
    -->
  </head>
  
  <body>
    This is my JSP page. <br>
  </body>
</html>
web.xml
Java code
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" 
    xmlns="http://java.sun.com/xml/ns/javaee" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee 
    http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
  <display-name></display-name>    
  <welcome-file-list>
    <welcome-file>index.jsp</welcome-file>
  </welcome-file-list>
  <filter>
      <filter-name>struts2</filter-name>
      <filter-class>
          org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
            org.apache.struts.action.ActionServlet
      </filter-class>
  </filter>
  <filter-mapping>
      <filter-name>struts2</filter-name>
      <url-pattern>/*</url-pattern>
  </filter-mapping></web-app>
struts.xml
Java code
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.1//EN" "http://struts.apache.org/dtds/struts-2.1.dtd">
<struts>    <package name="hello">
    <default-action-ref name="hello" />
        <action name="hello" class="com.helloword.struts.action.HelloAction">
            <result name="input">/index.jsp</result></action></package></struts>    
HelloAction.javapackage com.helloword.struts.action;import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.Result;public class HelloAction extends ActionSupport{
public String execute(){
return "input";
}}
访问地址:
http://localhost:8080/HelloWord
http://localhost:8080/HelloWord/hello
http://localhost:8080/HelloWord/hello.action
都是出错

解决方案 »

  1.   

     <filter-class>
      org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
      org.apache.struts.action.ActionServlet
      </filter-class>
    有问题,你看看
      

  2.   

    <filter-class>
      org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
      org.apache.struts.action.ActionServlet
      </filter-class>有问题,改为:<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>
      

  3.   

    struts.xml有错  是不是没package标签中extends struts-default
      

  4.   

    myeclipse9.0中struts-default提示找不到,所以即使加进去也没用
      

  5.   

    和MYECLIPSE关系不大。是不是你忘了导什么包进去了
      

  6.   

    你自己配一下 ,直接发布 ,不要再myeclipse中启动 ,可以么 ?
      

  7.   

    建议楼主不要用Mycelipse集成Struts2,原因有两个:一:容易jar包冲突;其二:编译时reference没什么问题,但是在部署发布项目的时候,web-inf下面无jar,不能load到web服务器中;其三:自己将所需的jar直接copy到web-inf目录下来部署。就像你说的,提示struts-default.xml有错,这个文件就是struts2-core.jar里面的,jar包引用有问题,所以我建议你自己将框架所需对jarcopy到wen-inf下,hibernate,spring的学习也一样。
      

  8.   

    这样太麻烦了,可能以前用zend studio开发PHP习惯了,离不开基于eclipse的IDE,能帮忙想想办法吗
      

  9.   

    jar导入的问题 你看一下tomcat对应project的WEB-INF的lib文件的jar包  里面估计有冲突的例如两个不同版本的cor包