package com.esp.actionform;import org.apache.struts.action.*;
import java.util.*;
import javax.servlet.http.*;public class IndexActionForm
    extends ActionForm
{
  private Vector docTypeIds = new Vector();
  private Vector fieldNames = new Vector();
  private Vector fieldTypeNames = new Vector();
  private String fieldValue = "where [Item No#] like '%C%'";
  private String selectedDocType;
  private Vector docTypeNames = new Vector();
    public Vector getDocTypeIds()
  {
    return docTypeIds;
  }  public void setDocTypeIds(Vector docTypeIds)
  {
    this.docTypeIds = docTypeIds;
  }  public Vector getFieldNames()
  {
    return fieldNames;
  }  public void setFieldNames(Vector fieldNames)
  {
    this.fieldNames = fieldNames;
  }  public void setFieldTypeNames(Vector fieldTypeNames)
  {
    this.fieldTypeNames = fieldTypeNames;
  }  public String getFieldValue()
  {
    return fieldValue;
  }  public void setFieldValue(String fieldValue)
  {
    this.fieldValue = fieldValue;
  }  public String getSelectedDocType()
  {
    return selectedDocType;
  }  public Vector getDocTypeNames()
  {
    return docTypeNames;
  }    public Vector getFieldTypeNames()
  {
    return fieldTypeNames;
  }  public void setSelectedDocType(String selectedDocType)
  {
    this.selectedDocType = selectedDocType;
  }  public void setDocTypeNames(Vector docTypeNames)
  {
    this.docTypeNames = docTypeNames;
  }    public ActionErrors validate(ActionMapping actionMapping,
                               HttpServletRequest httpServletRequest)
  {
    ActionErrors errors = new ActionErrors();    return errors;  }  public void reset(ActionMapping actionMapping,
                    HttpServletRequest httpServletRequest)
  {  }
}

解决方案 »

  1.   

    <%@ page contentType="text/html; charset=utf-8" language="java" import="java.sql.*,java.util.*,com.esp.actionform.IndexActionForm" %>
    <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%>
    <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>
    <%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %>
    <%@ taglib uri="/WEB-INF/struts-nested.tld" prefix="nested" %>
    <%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
    <%@ taglib uri="/WEB-INF/struts-template.tld" prefix="template" %><html:html locale="true">
    <head>
    <title><bean:message key="title"/></title>
    </head>
     <script language="JavaScript" src="js/function.js"> </script><body>
     <html:errors/>
    <html:form action="mainAction.do">
    <center>
      <table border="0">
      <tr>
      <td><bean:message key="index.field"/></td>
      <td>
        <html:select property="fieldNames" size="10" style="width:120px">
         <html:options property="fieldNames" labelProperty="fieldNames"/>
        </html:select>    </td>
      <td><bean:message key="index.fieldtype"/></td>
    <td>
        <html:select property="fieldTypeNames" style="width:120px" size="10">
    <html:options property="fieldTypeNames" labelProperty="fieldTypeNames"></html:options>
        </html:select>
    </td>
    </tr> <tr>
            <td height="18"><bean:message key="index.condition"/></td>
    <td colspan="3">
        <html:text property="fieldValue"  style="width:300px"/>
        </td>
      </tr>  <tr>
        <td><bean:message key="index.doctype"/>
      </td>
      <td>
      <html:select  property="docTypeIds" style="width:120px" size="10">
       <html:options  property="docTypeIds" labelProperty="docTypeNames"></html:options>
      </html:select>
      </td>
      <td>
        <html:button property="select" onclick="javascript:movea('docTypeIds','selectedDocType');"><bean:message key="index.button"/></html:button>
         </td>
    <td>
        <html:select property="selectedDocType" style="width:120px" size="2"></html:select>
    </td>  </tr>  <tr>
      <td colspan="4" align="middle">
        <html:submit>
          <bean:message key="index.submit"/>
        </html:submit>  </td>
      </tr>
    </table>
    </center>
    </html:form></body>
    </html:html>
      

  2.   

    楼主你的ACTION 呢???public void reset(ActionMapping actionMapping,
                        HttpServletRequest httpServletRequest)
      {  }
    }
    中初始化一下啊
      

  3.   

    据我看是类型不匹配出的错.在这句中
    <html:select  property="docTypeIds" style="width:120px" size="10">
       <html:options  property="docTypeIds" labelProperty="docTypeNames"></html:options>
      </html:select>
    select的结果肯定是一个固定值,所以应该返回一个String,而你在property里用的一个vector去接,当然会出错了,你应该在form里定义一个String docTypeid及他们get,set方法,然后
    <html:select  property="docTypeId" style="width:120px" size="10">
       <html:options  property="docTypeIds" labelProperty="docTypeNames"></html:options>
      </html:select>
    这样就对了,其他的html:select也是同样的错误.
    写了一大堆,不知道你明白我的意思没有.