日期:2014-05-20  浏览次数:20807 次

为什么我的Action中的不到对应的ActionForm,请大侠指教!
<?xml version="1.0" encoding="ISO-8859-1" ?>

<!DOCTYPE struts-config PUBLIC
  "-//Apache Software Foundation//DTD Struts Configuration 1.2//EN"
  "http://jakarta.apache.org/struts/dtds/struts-config_1_2.dtd">

<struts-config>
<form-beans>
  <form-bean name="userForm" 
  type="com.struts.ActionForm.UserActionForm" />
</form-beans>
<action-mappings>
  <action path="/display" 
  type="com.struts.Action.DisplayAction" 
  scope="request">
  <forward name="success" path="/manager.jsp"/>
  </action>
   
  <action path="/add"
  type="com.struts.Action.AddAction"
  scope="request">
  <forward name="success" path="/add.jsp"/>
  </action>

  <action path="/doAdd"
  type="com.struts.Action.DoAddAction"
  scope="request" name="userForm">
  <forward name="success" path="/manager.jsp"/>
  </action>
   
  <action path="/del" 
  type="com.struts.Action.DelAction"
  name="userForm"
  scope="request">
  <forward name="success" path="/manager.jsp"/>
  </action>
</action-mappings>
<message-resources parameter="MessageResources" />
</struts-config>

这个配置文件!


页面代码:
<%@ page language="java" contentType="text/html; charset=gbk"
  pageEncoding="gbk"%>
  <%@ taglib prefix="html" uri="http://struts.apache.org/tags-html" %>
  <%@ taglib prefix="logic" uri="http://struts.apache.org/tags-logic" %>
  <%@ taglib prefix="bean" uri="http://struts.apache.org/tags-bean" %>
  <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!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=gbk">
<title>维护页面</title>
<script type="text/javascript">
function getAll()
{
  var cb =document.getElementById("getCB");
  var allcb=document.getElementsByName("selcetFlag");
  if(cb.checked==true)
  {
  for(var i=0;i<allcb.length;i++)
  {
  allcb[i].checked=true;
  }
  }else {
  for(var i=0;i<allcb.length;i++)
  {
  allcb[i].checked=false;
  }
  }
}

function doIt(road)
{
  document.form1.action=road;
  document.form1.submit();
}
</script>
</head>
<body>

<form action="" name="form1" method="post">
<em><strong>系统管理&gt;&gt;用户维护</strong></em><br>
<hr>
<table border="1" width=100%>
<tr align="left"><th colspan="5">列表查询</th></tr>
<tr>
<td align="center">
<input type="checkbox" id="getCB" name="cball" onclick="getAll()"/>