我按照书上的例子做个student登录框,但是在运行的时候eclipse出现了
http status 404 Servlet strutsController is not available这个错误!type Status reportmessage Servlet strutsController is not availabledescription The requested resource (Servlet strutsController is not available) is not available.
这是为什么?还有我用的是struts2.0.11版本解压有在lib下没有digester.jar这个文件的!奇怪!

解决方案 »

  1.   

    404一般都是xml没有配置好造成的lz可以仔细检查一下工程下的xml那里有没有配置错的
      

  2.   

    我导入的jar没有这个jar,是不是因为这个,但是我解压的struts包后lib下没有这个jar郁闷!
      

  3.   

    应该是配置问题,没有找到action
      

  4.   

    找了很久都找不到xml文件错在哪里,郁闷谁帮帮我!
    struts-config.xml:
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <struts-config>
        <form-beans>
            <form-bean name="stuForm" type="model.StudentForm"/>
        </form-beans>
        <global-exceptions/>
        <action-mappings>
            <action path="/reg" name="stuForm" type="model.RegAction" scope="request" input="/reg.jsp">
            <forward name="stu_list" path="/stu_list.jsp"/>
        </action>
      </action-mappings>
    </struts-config>
    web.xml:
    <?xml version="1.0" encoding="UTF-8"?>
    <web-app id="WebApp_ID" 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">
    <display-name>Struts</display-name>
    <servlet>
    <servlet-name>action</servlet-name>
    <servlet-class>
        org.apache.struts.action.ActionServlet
    </servlet-class>
    <init-param>
    <param-name>config</param-name>
    <param-value>/WEB-INF/struts-config.xml</param-value>
    </init-param>
    <load-on-startup>2</load-on-startup>
    </servlet>
    <servlet-mapping>
    <servlet-name>action</servlet-name>
    <url-pattern>*.do</url-pattern>
    </servlet-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>
    如果把web.xml中的servlet标签内的servlet内容去掉就可以运行html代码,如果不去掉就出现reg.do) is not available.错误!这两个xml都在WEB-INF文件下!
    还有RegAction在项目包下的src文件夹下的model包中!
    package model;
    /*******************************************************************************
     * Copyright (c) 2005 Eteration A.S. and others. All rights reserved. This
     * program and the accompanying materials are made available under the terms of
     * the Eclipse Public License v1.0 which accompanies this distribution, and is
     * available at http://www.eclipse.org/legal/epl-v10.html
     * 
     * Contributors: Eteration A.S. - initial API and implementation
     ******************************************************************************/
    //default packageimport java.io.IOException;import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    import javax.servlet.ServletException;import org.apache.struts.action.Action;
    import org.apache.struts.action.ActionForm;
    import org.apache.struts.action.ActionForward;
    import org.apache.struts.action.ActionMapping;public class RegAction extends Action
    {
    public ActionForward execute(ActionMapping mapping,ActionForm form,HttpServletRequest request, HttpServletResponse response)throws IOException, ServletException 
       {
    BM.insertStu((StudentForm)form);
    request.setAttribute("list", BM.getAllStu());
    return mapping.findForward("stu_list");
    }
    }