源码: Context initContext = new InitialContext(); Context envContext = (Context)initContext.lookup("java:/comp/env"); DataSource ds = (DataSource)envContext.lookup("jdbc/oracle"); Connection conn = ds.getConnection(); String sqlstr_s = " SELECT comp_short_name FROM comp_store WHERE store_no=" + storeNo + " ORDER BY comp_flag"; Vector list_short_name = new Vector(); PreparedStatement pstmt_s = conn.prepareStatement(sqlstr_s); ResultSet rs_s=pstmt_s.executeQuery(); while(rs_s.next()){ list_short_name.add(rs_s.getString("comp_short_name")); } pstmt_s.close(); String shortname1 = (String)list_short_name.elementAt(0); String shortname2 = (String)list_short_name.elementAt(1); String shortname3 = (String)list_short_name.elementAt(2); --500 错误description The server encountered an internal error () that prevented it from fulfilling this request. exception org.apache.jasper.JasperException: 1 >= 1 org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:346) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236) javax.servlet.http.HttpServlet.service(HttpServlet.java:810) root cause java.lang.ArrayIndexOutOfBoundsException: 1 >= 1 java.util.Vector.elementAt(Vector.java:432) org.apache.jsp.comp_005fgood_005farticle_005fmanage_jsp._jspService(comp_005fgood_005farticle_005fmanage_jsp.java:146) org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94) javax.servlet.http.HttpServlet.service(HttpServlet.java:810) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:298) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236) javax.servlet.http.HttpServlet.service(HttpServlet.java:810) note The full stack trace of the root cause is available in the Apache Tomcat/5.0.25 logs.
数组下标越界啊String shortname1 = (String)list_short_name.elementAt(0);String shortname2 = (String)list_short_name.elementAt(1);String shortname3 = (String)list_short_name.elementAt(2);这里可能没有3个元素吧