我是个struts菜鸟.
我在写struts配置文件的时候,在配置文件时候不添加我的ActionForm,整个程序没有错误.但是添加了
<form-beans>项时,就报一个错误:
HTTP Status 404 - Servlet action is not available
求大虾详细解释.
愿意的话就写一个完整的程序.实现在一个表单中输入一个字符串然后在action中显示.

解决方案 »

  1.   

    不知下面的视频演示教程你是否可以下载,是教育网内的:
    ftp://210.36.68.119/temp/demonstrate/
    源程序是:
    ftp://210.36.68.119/temp/source/
      

  2.   

    那位大虾帮个忙搞定一下,小弟在线急等!!!
    20分是少了点.
    Structs这个东西真是让人烦心!!!
      

  3.   

    <struts-config>
      <form-beans>
        <form-bean name="form_001" type="cn.com.form.Form_001" />
        <form-bean name="form_002" type="cn.com.form.Form_002" />
      </form-beans>
    </struts-config>
      

  4.   

    JSP
    <%@ page contentType="text/html; charset=GBK" %>
    <html>
    <head>
    <title>waiting</title>
    </head>
    <body>
    <table width="100%" height="34"  >
    <form name="girlsForm" method="post" action="<%=request.getContextPath()%>/girls/wait/action/noWaitAction.do" >
    <input name="thisParm" type="hidden" value="OK"/>
    <tr>
    <td width="25%">用户名: <input name="userName"  type="text" size="15"></td>
    <td width="25%">密  码: <input name="password" type="password"  size="15"> </td>
    <td width="13%"> <input name="ok" type="submit" class="button-ok" value="登录"></td>
    <td width="17%"><input name="cancle" type="reset" class="button-reset" value="重置"></td>
    </tr>  
    </form>
    </table>
    </body>
    </html>struts-config.xml:
    <form-beans>
        <form-bean name="girlsForm" type="com.girls.wait.form.GirlsForm" />
    </form-beans>
    <action-mappings>
     <action name="girlsForm" path="/girls/wait/action/noWaitAction" type="com.girls.wait..action.NoWaitAction">
        <forward name="noWait" path="/girls/wait/noWait.jsp" />
      </action>
    </action-mappings>
    ...
    action:
    package com.girls.wait..action;import org.apache.struts.action.*;
    import javax.servlet.http.*;
    import com.girls.wait.form.GirlsForm;public class NoWaitAction extends Action {
      public ActionForward execute(ActionMapping actionMapping, ActionForm actionForm, HttpServletRequest request, HttpServletResponse httpServletResponse) {
       
       GirlsForm girlsForm = (GirlsForm)actionForm;   String name = girlsForm.getName();
       String password = girlsForm.getPassword();   String thisParm = request.getRequestParm("thisParm");//通过jsp页面hidden传过来的    System.out.println("=== name = " + name);   return actionMapping.findForward("noWait");
      }
    }