日期:2014-05-17  浏览次数:20854 次

Parameter index out of bounds. 10 is not between valid values of 1 and 9
public void insert(Articles articles) throws Exception {
DBConnection dbc = new DBConnection();
sql = "insert into articles(title,date,hit,content,aclassify1,aclassify2,aclassify1name,aclassify2name,isparticles,istop) values(?,?,0,?,?,?,?,?,?,?)";
String sub = "";
try {
if (articles.getIsparticles() == 1) {
sub = this.subString(articles.getContent());
}// 处理图片新闻
pstm = dbc.getConnection().prepareStatement(sql);
pstm.setString(1, articles.getTitle());
pstm.setString(2, articles.getDate());
pstm.setString(3, articles.getContent());
pstm.setInt(4, articles.getAclassify1());
pstm.setInt(5, articles.getAclassify2());
pstm.setString(6, articles.getAclassify1name());
pstm.setString(7, articles.getAclassify2name());
pstm.setInt(8, articles.getIsparticles());
if (articles.getIsparticles() == 1) {
articles.setPhotourl(sub);
}// 处理图片新闻
pstm.setString(9, articles.getPhotourl());
pstm.setInt(10, articles.getIstop());
pstm.executeUpdate();
pstm.close();
} catch (Exception e) {
e.printStackTrace();
} finally {
// dbc.close();
}
}

<%@ page language="java" pageEncoding="utf-8"  import="java.util.*,net.fckeditor.*"%>
<%@ include file="/inc/taglib.jsp" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    <title>My JSP 'articles_add.jsp' starting page</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">    
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<script type="text/javascript" src="js/getType.js"></script>
<script  type="text/javascript" src="js/calendar.js"></script>
<script  type="text/javascript" src="ckeditor/cheditor.js"></script>
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->

<script language = "JavaScript">
 var onecount;
 subcat = new Array();
 function changelocation(locationid)
    {
    document.addARTICLES.SmallClassName.length = 1; 
    var locationid=locationid;
    var i;
    for (i=0;i < onecount; i++)
        {
    &nb