日期:2014-05-18  浏览次数:20661 次

struts的下拉列表问题,救急!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!11111
我要做的是在一个页面里有一个下拉列表,列表的内容是从数据库中取出,取出数据是在ACTION里,并装入一个ArrayList中,用request.setAttribute发送到JSP页面,但是老是显示org.apache.jasper.JasperException:   Cannot   find   bean   under   name   list错误,我在网上找了二天了,都没解决问题,郁闷死了,请各位大虾帮帮忙吧,代码我贴在下面:

PositionSetAction.java:

//Created   by   MyEclipse   Struts
//   XSL   source   (default):   platform:/plugin/com.genuitec.eclipse.cross.easystruts.eclipse_4.0.0/xslt/JavaClass.xsl

package   com.hrmis.struts.action;

import   java.sql.ResultSet;
import   java.sql.SQLException;
import   java.util.ArrayList;

import   com.hrmis.dbbean.DbConn;
import   com.hrmis.struts.form.PositionSetActionForm;

import   javax.servlet.http.HttpServletRequest;
import   javax.servlet.http.HttpServletResponse;

import   org.apache.struts.action.Action;
import   org.apache.struts.action.ActionForm;
import   org.apache.struts.action.ActionForward;
import   org.apache.struts.action.ActionMapping;
import   org.apache.struts.util.LabelValueBean;

/**  
  *   MyEclipse   Struts
  *   Creation   date:   04-12-2007
  *  
  *   XDoclet   definition:
  *   @struts.action   path= "/position "   name= "positionSetForm "   input= "/positionSet.jsp "   scope= "request "
  */
public   class   PositionSetAction   extends   Action   {

//   ---------------------   Instance   Variables

//   ---------------------   Methods

/**  
  *   Method   execute
  *   @param   mapping
  *   @param   form
  *   @param   request
  *   @param   response  
  *   @return   ActionForward
  */
public   ActionForward   execute(
ActionMapping   mapping,
ActionForm   form,
HttpServletRequest   request,
HttpServletResponse   response)   {
PositionSetActionForm   positionSetForm   =   (PositionSetActionForm)   form;
DbConn conn = new   DbConn();
String   query = "SELECT   *   FROM   `department` ";
System.out.println(query);
ResultSet   rs = conn.executeQuery(query);
ArrayList   departmentList   =   new   ArrayList();
try{
while(rs.next()){
departmentList.add(new   LabelValueBean(rs.getString( "departmentName "),rs.getString( "departmentId ")));
}
request.setAttribute( "list ",departmentList);
}catch(SQLException   e){
System.err.println( "err: "+e.getMessage());
}
//   TODO   Auto-generated   method   stub
return   mapping.findForward( "positionSet ");
}

}

persitionSet.jsp:
 
<%@   page   language= "java "   import= "j