-2

ArrayIndexOutOfBounds を取得しています。理由を教えてください。

    <%@page contentType="text/html" pageEncoding="UTF-8"%>
    <%@page import="java.sql.ResultSet"%>
    <%@page import="java.sql.Statement"%>
    <%@page import="java.sql.DriverManager"%>
    <%@page import="java.sql.PreparedStatement"%>
    <%@page import="java.sql.Connection"%>        
    <% String x=session.getAttribute("userid").toString();
    try{
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    Connection cn=DriverManager.getConnection("jdbc:odbc:college");
    //i have other fields which i dont want ot update they are
    //enrollment,name,password,father,dob,course,address,mobile,email(all
    //are in series of database) 
    PreparedStatement pst = cn.prepareStatement("update Student set 
    Father=?,Address=?,Mobile=?,Email=? where SID='"+x+"' ");
    pst.setString(4,request.getParameter("t1"));
    pst.setString(7,request.getParameter("t2"));
    pst.setString(8,request.getParameter("t3"));
    pst.setString(10,request.getParameter("t4")); 
    int y=pst.executeUpdate();
    if(y>0)
    {
    out.println("Record Updated Successfully");    
    %>
    <%@include file="Student.jsp" %> <%    } else
    out.println("Updation unsuccessfull");
    }catch(Exception ee) {
    out.print(ee);%>
4

1 に答える 1