Search the Blog

Sunday, July 28, 2019

JAVA CODE FOR UPLOADING THE HOMEWORK MVC SERVELT JSP JSON MYSQL ANDROID

JAVA CODE FOR UPLOADING THE HOMEWORK MVC SERVELT JSP JSON MYSQL ANDROID


package com.sawan;

import java.io.IOException;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Enumeration;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.json.JSONObject;

import com.mysql.jdbc.Statement;

/**
 * Servlet implementation class ClassTecherHomeworkPage
 */
@WebServlet("/ClassTecherHomeworkPage")
public class ClassTecherHomeworkPage extends HttpServlet {
 private static final long serialVersionUID = 1L;
  java.sql.Statement stmt = null;  
    /**
     * @see HttpServlet#HttpServlet()
     */
    public ClassTecherHomeworkPage() {
        super();
        // TODO Auto-generated constructor stub
    }

 /**
  * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
  */
 protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
   JSONObject json = new JSONObject();
   
    Enumeration paramNames = request.getParameterNames();
         String params[] = new String[2];
         int i = 0;
         while (paramNames.hasMoreElements())
         {
             String paramName = (String) paramNames.nextElement();
          System.out.println(".........params[]....................."+paramName);
             System.out.println(paramName);
             String[] paramValues = request.getParameterValues(paramName);
             params[i] = paramValues[0];
          System.out.println(".............+params[i]................."+params[i]);
          System.out.println(".............+params[i]................."+params[i]);
             System.out.println(params[i]);
             i++;
         }
       System.out.println("..1..");
         ResultSet rs;
         String table=params[0]; 
         String cutoff=params[1];
         DataBase  db=new DataBase();
      System.out.println("..2..");
         Connection con=db.getConnection();
         System.out.println("..table name."+table);
         table=table.substring(0, 11);
         String Roll=params[1];
      System.out.println("..3..");
      int roll=Integer.parseInt(Roll);
         System.out.println("rOLL nO............"+roll);
         String sql="SELECT * FROM Attendance."+table+"  WHERE STUDENTBTECH ="+roll; 
         System.out.println(sql);
         try {    
              stmt = con.createStatement();
         rs = stmt.executeQuery(sql); 
          int u=0;
           while (rs.next()) {
              if(rs.getInt("STUDENTBTECH")==roll)
              {
   
                  json.put("home1",rs.getString("SUBJECT1")+".");
                  json.put("home2",rs.getString("SUBJECT2")+".");
                  json.put("home3",rs.getString("SUBJECT3")+".");
                  json.put("home4",rs.getString("SUBJECT4")+".");
                  json.put("home5",rs.getString("SUBJECT5")+".");
                  json.put("home6",rs.getString("SUBJECT6")+".");
                  json.put("home7",rs.getString("SUBJECT7")+".");
                  json.put("home8",rs.getString("SUBJECT8")+".");
                  json.put("home9",rs.getString("SUBJECT9")+".");
                  json.put("home10",rs.getString("SUBJECT10")+".");
                
                  json.put("info","success"); 
                 u=1;
              }
              }
              if(u==0)
              {
                 json.put("info", "fail");
              }
          
          
         }
          catch (Exception e) {
             e.printStackTrace();
         }
      
         System.out.println(json);
         response.setContentType("application/json");
         response.setCharacterEncoding("UTF-8");
         response.getWriter().write(json.toString());
}
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {


}
}

JAVA CODE FOR SETTING THE TRANSPORTER SETTING


package com.sawan;

import java.io.IOException;
import java.sql.Connection;
import java.sql.ResultSet;
import java.util.Enumeration;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.json.JSONObject;

/**
 * Servlet implementation class AdminTransport
 */
@WebServlet("/AdminTransport")
public class AdminTransport extends HttpServlet {
 private static final long serialVersionUID = 1L;
 java.sql.Statement stmt = null;  
    /**
     * @see HttpServlet#HttpServlet()
     */
    public AdminTransport() {
        super();
        // TODO Auto-generated constructor stub
    }

 /**
  * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
  */
 protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
  JSONObject json = new JSONObject();
  Enumeration paramNames = request.getParameterNames();
  String params[] = new String[3];
  int i = 0;
  while (paramNames.hasMoreElements())
  {
   String paramName = (String) paramNames.nextElement();
   System.out.println(".........params[]....................."+paramName);
   System.out.println(paramName);
   String[] paramValues = request.getParameterValues(paramName);
   params[i] = paramValues[0];
   System.out.println(".............+params[i]................."+params[i]);
   System.out.println(".............+params[i]................."+params[i]);
   System.out.println(params[i]);
   i++;
  }
  System.out.println("..1..");
  ResultSet rs;
  String table=params[0]; 
  String cutoff=params[1];
  DataBase  db=new DataBase();
  System.out.println("..2..");
  Connection con=db.getConnection();
  System.out.println("..table name."+table);
  table=table.substring(0, 11);
  String Roll=params[1];
  System.out.println("..3..");
  //int roll=Integer.parseInt(Roll);
  //System.out.println("rOLL nO............"+roll);
  String sql="SELECT * FROM Attendance."+table+"  WHERE STUDENTROLL ='"+Roll+"'"; 
  System.out.println(sql);
  try {    
   stmt = con.createStatement();
   rs = stmt.executeQuery(sql); 
   int u=0;
   while (rs.next()) 
   {
    if(rs.getString("STUDENTROLL").equals(Roll))
    {
     json.put("name",rs.getString("STUDENTNAME"));
        json.put("Roll",rs.getString("STUDENTROLL"));
     json.put("DRIVERNAME",rs.getString("DRIVERNAME"));
     json.put("DRIVERMOB",rs.getString("DRIVERMOB"));
     json.put("DRIVERVECLE",rs.getString("DRIVERVECLE"));
     json.put("TRANSPORTINCHARGE",rs.getString("TRANSPORTINCHARGE"));
     json.put("TRANSPORTINCHARGEMOB",rs.getString("TRANSPORTINCHARGEMOB"));
     json.put("PICT",rs.getString("PICT"));
     json.put("DROPT",rs.getString("DROPT"));
     json.put("PICP",rs.getString("PICP"));
     json.put("DROPP",rs.getString("DROPP"));
     json.put("TRANSPORTFACILITY",rs.getInt("TRANSPORTFACILITY"));

     json.put("info","success"); 
     u=1;
    }
   }
   if(u==0)
   {
    json.put("info", "fail");
   }
  }
  catch (Exception e) {
   e.printStackTrace();
  }

  System.out.println(json);
  response.setContentType("application/json");
  response.setCharacterEncoding("UTF-8");
  response.getWriter().write(json.toString());
 }
 protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {


 }
}


JAVA CODE FOR DELETING THE ADMIN ACCOUNT OF THE APPLICATION

package com.sawan;

import java.io.IOException;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.Enumeration;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.json.JSONException;
import org.json.JSONObject;

/**
 * Servlet implementation class AdminAccountDelete
 */
@WebServlet("/AdminAccountDelete")
public class AdminAccountDelete extends HttpServlet {
 private static final long serialVersionUID = 1L;
 PreparedStatement st=null;
 public AdminAccountDelete() {
  super();
  // TODO Auto-generated constructor stub
 }
 protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
  JSONObject json = new JSONObject();
  System.out.println("................Strating.............");
  Enumeration paramNames = request.getParameterNames();
  String params[] = new String[17];
  int i = 0;
  while (paramNames.hasMoreElements()) {
   String paramName = (String) paramNames.nextElement();
   System.out.println(".........params[]...................."+paramName);
   System.out.println(paramName);
   String[] paramValues = request.getParameterValues(paramName);
   params[i] = paramValues[0];
   System.out.println(".............+params[i]................."+params[i]);
   System.out.println(params[i]);
   System.out.println("...............uPDATE............");
   i++;
  }
  if(params[2].equals("sawan1"))
  {
  String table=params[0]; 
  table=table.substring(0,11);
  table=table+"DI";
  DataBase  db=new DataBase();
  int u=0;
  Connection con=db.getConnection();
  try {
   
   String sql = "DELETE FROM Attendance"
     + "."+table+ "  WHere  STUDENTFNAME=?";
   PreparedStatement preparedStmt = con.prepareStatement(sql);
   preparedStmt.setString(1, params[1]);
   System.out.println("sql query is : "+sql);
   
   
   preparedStmt.execute();
   u=1;
   } catch (SQLException e) {
    u=0;
    // TODO Auto-generated catch block
    e.printStackTrace();
   }
  try
  {
  if(u==0)
  {
   json.put("info", "failure");
   
  }
  else{json.put("info", "success");}
  }catch(Exception e)
  {
   e.printStackTrace();
  }
   System.out.println(json);
   response.setContentType("application/json");
   response.setCharacterEncoding("UTF-8");
   response.getWriter().write(json.toString());
  
  }
  if(params[2].equals("sawan2"))
  {
  String table=params[0]; 
  table=table.substring(0,11);
  table=table+"HO";
  DataBase  db=new DataBase();
  int u=0;
  Connection con=db.getConnection();
  try {
   
   String sql = "DELETE FROM Attendance"
     + "."+table+ "  WHere  STUDENTFNAME=?";
   PreparedStatement preparedStmt = con.prepareStatement(sql);
   preparedStmt.setString(1, params[1]);
   System.out.println("sql query is : "+sql);
   
   
   preparedStmt.execute();
   u=1;
   } catch (SQLException e) {
    u=0;
    // TODO Auto-generated catch block
    e.printStackTrace();
   }
  try
  {
  if(u==0)
  {
   json.put("info", "failure");
   
  }
  else{json.put("info", "success");}
  }catch(Exception e)
  {
   e.printStackTrace();
  }
   System.out.println(json);
   response.setContentType("application/json");
   response.setCharacterEncoding("UTF-8");
   response.getWriter().write(json.toString());
  
  }
  if(params[2].equals("sawan3"))
  {
  String table=params[0]; 
  table=table.substring(0,11);
  table=table+"FA";
  DataBase  db=new DataBase();
  int u=0;
  Connection con=db.getConnection();
  try {
   
   String sql = "DELETE FROM Attendance"
     + "."+table+ "  WHere  STUDENTFNAME=?";
   PreparedStatement preparedStmt = con.prepareStatement(sql);
   preparedStmt.setString(1, params[1]);
   System.out.println("sql query is : "+sql);
   
   
   preparedStmt.execute();
   u=1;
   } catch (SQLException e) {
    u=0;
    // TODO Auto-generated catch block
    e.printStackTrace();
   }
  try
  {
  if(u==0)
  {
   json.put("info", "failure");
   
  }
  else{json.put("info", "success");}
  }catch(Exception e)
  {
   e.printStackTrace();
  }
   System.out.println(json);
   response.setContentType("application/json");
   response.setCharacterEncoding("UTF-8");
   response.getWriter().write(json.toString());
  
  }
  if(params[2].equals("sawan4"))
  {
  String table=params[0]; 
  table=table.substring(0,11);
  
  DataBase  db=new DataBase();
  int u=0;
  Connection con=db.getConnection();
  try {
   
   String sql = "DELETE FROM Attendance"
     + "."+table+ "  WHERE  STUDENTROLL=?";
   PreparedStatement preparedStmt = con.prepareStatement(sql);
   preparedStmt.setString(1, params[1]);
   System.out.println("sql query is : "+sql);
   
   
   preparedStmt.execute();
   u=1;
   } catch (SQLException e) {
    u=0;
    // TODO Auto-generated catch block
    e.printStackTrace();
   }
  try
  {
  if(u==0)
  {
   json.put("info", "failure");
   
  }
  else{json.put("info", "success");}
  }catch(Exception e)
  {
   e.printStackTrace();
  }
   System.out.println(json);
   response.setContentType("application/json");
   response.setCharacterEncoding("UTF-8");
   response.getWriter().write(json.toString());
  
  }
 }

 protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

  doGet(request, response);
 }

}




JAVA CODE FOR MONTH RETRIAL FROM DATE


package com.sawan;

public class BackGround {

 public String MonthCalculation(String Month,String Day)
 {
  System.out.println("value is..initial.."+Month);
  System.out.println("value is..initial.."+Day);
  String month="0";
  String day="0";
  int dy=Integer.parseInt(Day); 
  System.out.println("value is..initial.."+dy);

  
  switch(Month)
  {
  case "Jan":
   month="01";
   day=31-dy+"";
   month=month+day;
   break;
  case "Feb":
   month="02";
 
   day=28-dy+"";
   month=month+day;
   break;
  case "Mar":
   month="03";
   day=31-dy+"";
   month=month+day;
   break;
  case "Apr":
   month="04";
   day=30-dy+"";
   month=month+day;
   break;
  case "May":
   month="05";
   day=31-dy+"";
   month=month+day;
   break;
  case "Jun":
   month="06";
   day=30-dy+"";
   month=month+day;
   break;
  case "July":
   month="07";
   day=31-dy+"";
   month=month+day;
   break;
  case "Aug":
   month="08";
   day=31-dy+"";
   month=month+day;
   break;
  case "Sept":
   month="09";
   day=30-dy+"";
   month=month+day;
   break;
  case "10":
   month="10";
   System.out.println("value is...."+month);
   day=31-dy+"";
   System.out.println("value is...."+day);

   month=month+day;
   break;
  case "11":
   month="11";
   day=(30-dy)+"";
   month=month+day;
   break;
  case "12":
   month="12";
   day=31-dy+"";
   month=month+day;
   break;
   
  }
  System.out.println("..."+month);
  return month;
 }

 public String MonthCalculation2(String Month,String Day)
 {
  System.out.println("value is..initial.."+Month);
  System.out.println("value is..initial.."+Day);
  String month="0";
  String day="0";
  int dy=Integer.parseInt(Day); 
  System.out.println("value is..initial.."+dy);

  
  switch(Month)
  {
  case "Jan":
   month="01";
   day=dy+"";
   month=month+day;
   break;
  case "Feb":
   month="02";
 
   day=dy+"";
   month=month+day;
   break;
  case "Mar":
   month="03";
   day=dy+"";
   month=month+day;
   break;
  case "Apr":
   month="04";
   day=dy+"";
   month=month+day;
   break;
  case "May":
   month="05";
   day=dy+"";
   month=month+day;
   break;
  case "Jun":
   month="06";
   day=dy+"";
   month=month+day;
   break;
  case "July":
   month="07";
   day=dy+"";
   month=month+day;
   break;
  case "Aug":
   month="08";
   day=dy+"";
   month=month+day;
   break;
  case "Sept":
   month="09";
   day=dy+"";
   month=month+day;
   break;
  case "10":
   month="10";
   System.out.println("value is...."+month);
   day=dy+"";
   System.out.println("value is...."+day);

   month=month+day;
   break;
  case "11":
   month="11";
   day=dy+"";
   System.out.println("value is...."+month);
   month=month+day;
   System.out.println("value is...."+day);
   break;
  case "12":
   month="12";
   day=dy+"";
   month=month+day;
   break;
   
  }
  System.out.println("..."+month);
  return month;
 }
}



JAVA CODE RAED DATA QUERY


package com.sawan;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.Statement;

public class ReadData {
    public  ResultSet getInf(Connection conn,String sql1) throws Exception
     {  
        System.out.println("sql1...faltu........dhanno");
        Statement st=conn.createStatement();
        System.out.println(sql1+"sql1...........dhanno");
        return st.executeQuery(sql1);
         
     }
}



Servlet JDBC Connection and Inserting into MYsql


package com.sawan;

import java.sql.*;

public class TotalLectureCalcultion
{
ResultSet rs=null;
PreparedStatement stmt = null; 
DataBase  db=new DataBase();
public int lectureStrength(String tablename,int br,String sec)
{ int str=0;
 try
{      System.out.println("............0 .............");
     Connection con=db.getConnection(); 
     String table=tablename;
     table=table.substring(0,11)+"MPSS";
 
  String sql="SELECT * FROM Attendance."+table+"  WHERE BRANCHCODE ="+br+" AND SECTION='"+sec+"'";
 
   Statement st=con.createStatement();
  rs=st.executeQuery(sql);
 
   while(rs.next()) 
   {
  int a=  rs.getInt("TOTALLECTURE");
  int b=  rs.getInt("TOTALSTUDENT");
  System.out.println("....a value is...TOTALLECTURE.   :"+a);
  System.out.println("....a value is.TOTALSTUDENT..    :"+b);
  str=str+a;   
     System.out.println("....a value is...str vale is :"+str);
   }
}catch(Exception e)
    {
 e.printStackTrace();
 }
    return str;
}
}
//FACULTYSUBCODE ="+sub+" 



Servlet Request and Response Code Part 1


package com.sawan;

import java.io.IOException;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.Statement;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * Servlet implementation class WenTeacherUpadeFianl
 */
@WebServlet("/WenTeacherUpadeFianl")
public class WenTeacherUpadeFianl extends HttpServlet {
 private static final long serialVersionUID = 1L;
 ResultSet rs=null;
 Connection con=null;
 Statement st=null; 
 String tabltname;
 int sawan=0;
 public WenTeacherUpadeFianl() {
  super();
  // TODO Auto-generated constructor stub
 }

 /**
  * @see HttpServlet#service(HttpServletRequest request, HttpServletResponse response)
  */
 protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

  if((request.getParameter("id").equals("null"))||(request.getParameter("a1").equals("null"))||(request.getParameter("a2").equals("null")))
  {
   getServletContext().getRequestDispatcher("/Administrative.jsp").forward(request, response);
   return;
  }
  else
  {
   DataBase db=new DataBase();
   con=db.getConnection();
   ReadData rd=new ReadData();
   tabltname="MPSS"+request.getParameter("id")+"FA";
   String sql1="Update Attendance."+tabltname+" SET STUDENTNAME='"+request.getParameter("a1")+"',"
     + "STUDENTFNAME='"+request.getParameter("a2")+"',"
     + "STUDENTCODE='"+request.getParameter("a3")+"',"
     + "STUDENTPASS='"+request.getParameter("a4")+"',"
     + "STUDENTMOBILE='"+request.getParameter("a5")+"',"
     + "STUDENTEMAIL='"+request.getParameter("a6")+"',"
     + "DrictorNotice='No Notice',"
     + "HodNotice='NO Notice',"
     + "HodNo=0,"
     + "DRICTORHODNOTICE='No Notice',"
     + "Hodyes=0"
     + " WHERE STUDENTFNAME='"+request.getParameter("a2")+"'";
   try {
    st = con.createStatement();
    st.executeUpdate(sql1);
    System.out.println("sawan............");
    String collegeid=request.getParameter("id");
    request.setAttribute("cid", collegeid);
    getServletContext().getRequestDispatcher("/Adminstrative.jsp").forward(request, response); 
    return; 
   } catch (Exception e) {
    String collegeid=request.getParameter("id");
    request.setAttribute("cid", collegeid);
    getServletContext().getRequestDispatcher("/brns.jsp").forward(request, response); 
    e.printStackTrace();
    System.out.println(e);
    return;
   }    
  }
 }
 protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

  response.getWriter().append("Served at: ").append(request.getContextPath());
 }
 protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

  doGet(request, response);
 }

}


Servlet Code for upload the Teacher data in SQL


package com.sawan;

import java.io.IOException;
import java.sql.Connection;
import java.sql.ResultSet;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * Servlet implementation class WebTeacherUpdate
 */
@WebServlet("/WebTeacherUpdate")
public class WebTeacherUpdate extends HttpServlet {
 private static final long serialVersionUID = 1L;
 ResultSet rs=null;
 int sawan=0;
 Connection con=null;
 String tablename;
    public WebTeacherUpdate() {
        super();
        // TODO Auto-generated constructor stub
    }

 protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
  DataBase db=new DataBase();
  con=db.getConnection();
  ReadData rd=new ReadData();
  tablename="MPSS"+request.getParameter(("id"))+"FA";
  String sql1="select * from Attendance."+tablename+" WHERE STUDENTFNAME='"+request.getParameter(("CODE"))+"'";
  try {
   rs= ((ReadData) rd).getInf(con, sql1);
   rs.next(); 
   String sawan2=request.getParameter(("id"));
   System.out.println(sawan2);
  
   request.setAttribute("name", rs.getString("STUDENTNAME"));
   request.setAttribute("fname", rs.getString("STUDENTFNAME"));
   request.setAttribute("code", rs.getString("STUDENTCODE"));
   request.setAttribute("pass", rs.getString("STUDENTPASS"));
   request.setAttribute("mob", rs.getString("STUDENTMOBILE"));
   request.setAttribute("email", rs.getString("STUDENTEMAIL"));
   System.out.println("sawan.......demo page .....");
   sawan=1;
   if(sawan==1)
   {
    String collegeid=request.getParameter("cid");
    request.setAttribute("cid", sawan2);
    getServletContext().getRequestDispatcher("/TecacherEdit.jsp").forward(request, response); 
    return;

   }
   else
   {
    System.out.println("sawan.faltu...........");

    String collegename=request.getParameter("cname");
    String collegeid=request.getParameter("cid");
    request.setAttribute("cname", collegename);
    request.setAttribute("cid", collegeid);
    getServletContext().getRequestDispatcher("/brans.jsp").forward(request, response); 
    return;
   }
  }
  catch(Exception e)
  {
   e.printStackTrace();
  }

 }

 protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

  doGet(request, response);
 }

}

Home Work Update Complete Code in JAVA With Servlet


package com.sawan;
import java.io.IOException;
import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Statement;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Enumeration;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.json.JSONException;
import org.json.JSONObject;
@WebServlet("/AdminHomeWorkUpdate")
public class AdminHomeWorkUpdate extends HttpServlet {
private static final long serialVersionUID = 1L;
 Statement st=null;
 String dayss,monss,yearss;
public AdminHomeWorkUpdate() {
super();
// TODO Auto-generated constructor stub
}
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
JSONObject json = new JSONObject();
Enumeration paramNames = request.getParameterNames();
String params[] = new String[13];
int i = 0;
while (paramNames.hasMoreElements()) {
String paramName = (String) paramNames.nextElement();
String[] paramValues = request.getParameterValues(paramName);
params[i] = paramValues[0];
i++;
}
 String datesawan = new SimpleDateFormat("yyyyMMdd_HHmmss").format(Calendar.getInstance().getTime());
        String redate2[] = datesawan.split("_");
        char[] chsawan = redate2[0].toCharArray();
        String date3sawan = chsawan.toString();
        yearss= redate2[0].substring(0, 4);
        monss = redate2[0].substring(4, 6);
        dayss = redate2[0].substring(6);
        String classnamecolumn1 = "null";
String classnamecolumn2 = "null";
String classnamecolumn3 = "null";
String classnamecolumn4 = "null";
String classnamecolumn5 = "null";
String classnamecolumn6 = "null";
String classnamecolumn7 = "null";
String classnamecolumn8 = "null";
String classnamecolumn9 = "null";
String classnamecolumn10 = "null";
String classnamecolumn = "null";
int classvalue=Integer.parseInt(params[1]);
switch (classvalue) {
case 22:
//classvalue = 22;
classnamecolumn = "Nur";
if (params[2].equals("A")) {
classnamecolumn1 = "A221";
classnamecolumn2 = "A222";
classnamecolumn3 = "A223";
classnamecolumn4 = "A224";
classnamecolumn5 = "A225";
classnamecolumn6 = "A226";
classnamecolumn7 = "A227";
classnamecolumn8 = "A228";
classnamecolumn9 = "A229";
classnamecolumn10 = "A2210";
} else if (params[2].equals("B")) {
classnamecolumn1 = "B221";
classnamecolumn2 = "B222";
classnamecolumn3 = "B223";
classnamecolumn4 = "B224";
classnamecolumn5 = "B225";
classnamecolumn6 = "B226";
classnamecolumn7 = "B227";
classnamecolumn8 = "B228";
classnamecolumn9 = "B229";
classnamecolumn10 = "B2210";
} else if (params[2].equals("C")) {
classnamecolumn1 = "C221";
classnamecolumn2 = "C222";
classnamecolumn3 = "C223";
classnamecolumn4 = "C224";
classnamecolumn5 = "C225";
classnamecolumn6 = "C226";
classnamecolumn7 = "C227";
classnamecolumn8 = "C228";
classnamecolumn9 = "C229";
classnamecolumn10 = "C2210";
} else if (params[2].equals("D")) {
classnamecolumn1 = "D221";
classnamecolumn2 = "D222";
classnamecolumn3 = "D223";
classnamecolumn4 = "D224";
classnamecolumn5 = "D225";
classnamecolumn6 = "D226";
classnamecolumn7 = "D227";
classnamecolumn8 = "D228";
classnamecolumn9 = "D229";
classnamecolumn10 = "D2210";
} else if (params[2].equals("E")) {
classnamecolumn1 = "E221";
classnamecolumn2 = "E222";
classnamecolumn3 = "E223";
classnamecolumn4 = "E224";
classnamecolumn5 = "E225";
classnamecolumn6 = "E226";
classnamecolumn7 = "E227";
classnamecolumn8 = "E228";
classnamecolumn9 = "E229";
classnamecolumn10 = "E2210";
} else {
classnamecolumn1 = "F221";
classnamecolumn2 = "F222";
classnamecolumn3 = "F223";
classnamecolumn4 = "F224";
classnamecolumn5 = "F225";
classnamecolumn6 = "F226";
classnamecolumn7 = "F227";
classnamecolumn8 = "F228";
classnamecolumn9 = "F229";
classnamecolumn10 = "F2210";
}
break;
case 23:
//classvalue = 23;
classnamecolumn = "LKG";
if (params[2].equals("A")) {
classnamecolumn1 = "A231";
classnamecolumn2 = "A232";
classnamecolumn3 = "A233";
classnamecolumn4 = "A234";
classnamecolumn5 = "A235";
classnamecolumn6 = "A236";
classnamecolumn7 = "A237";
classnamecolumn8 = "A238";
classnamecolumn9 = "A239";
classnamecolumn10 = "A2310";
} else if (params[2].equals("B")) {
classnamecolumn1 = "B231";
classnamecolumn2 = "B232";
classnamecolumn3 = "B233";
classnamecolumn4 = "B234";
classnamecolumn5 = "B235";
classnamecolumn6 = "B236";
classnamecolumn7 = "B237";
classnamecolumn8 = "B238";
classnamecolumn9 = "B239";
classnamecolumn10 = "B2310";
} else if (params[2].equals("C")) {
classnamecolumn1 = "C231";
classnamecolumn2 = "C232";
classnamecolumn3 = "C233";
classnamecolumn4 = "C234";
classnamecolumn5 = "C235";
classnamecolumn6 = "C236";
classnamecolumn7 = "C237";
classnamecolumn8 = "C238";
classnamecolumn9 = "C239";
classnamecolumn10 = "C2310";
} else if (params[2].equals("D")) {
classnamecolumn1 = "D231";
classnamecolumn2 = "D232";
classnamecolumn3 = "D233";
classnamecolumn4 = "D234";
classnamecolumn5 = "D235";
classnamecolumn6 = "D236";
classnamecolumn7 = "D237";
classnamecolumn8 = "D238";
classnamecolumn9 = "D239";
classnamecolumn10 = "D2310";
} else if (params[2].equals("E")) {
classnamecolumn1 = "E231";
classnamecolumn2 = "E232";
classnamecolumn3 = "E233";
classnamecolumn4 = "E234";
classnamecolumn5 = "E235";
classnamecolumn6 = "E236";
classnamecolumn7 = "E237";
classnamecolumn8 = "E238";
classnamecolumn9 = "E239";
classnamecolumn10 = "E2310";
} else {
classnamecolumn1 = "F231";
classnamecolumn2 = "F232";
classnamecolumn3 = "F233";
classnamecolumn4 = "F234";
classnamecolumn5 = "F235";
classnamecolumn6 = "F236";
classnamecolumn7 = "F237";
classnamecolumn8 = "F238";
classnamecolumn9 = "F239";
classnamecolumn10 = "F2310";
}
break;
case 24:
//classvalue = 24;
classnamecolumn = "UKG";
if (params[2].equals("A")) {
classnamecolumn1 = "A241";
classnamecolumn2 = "A242";
classnamecolumn3 = "A243";
classnamecolumn4 = "A244";
classnamecolumn5 = "A245";
classnamecolumn6 = "A246";
classnamecolumn7 = "A247";
classnamecolumn8 = "A248";
classnamecolumn9 = "A249";
classnamecolumn10 = "A2410";
} else if (params[2].equals("B")) {
classnamecolumn1 = "B241";
classnamecolumn2 = "B242";
classnamecolumn3 = "B243";
classnamecolumn4 = "B244";
classnamecolumn5 = "B245";
classnamecolumn6 = "B246";
classnamecolumn7 = "B247";
classnamecolumn8 = "B248";
classnamecolumn9 = "B249";
classnamecolumn10 = "B2410";
} else if (params[2].equals("C")) {
classnamecolumn1 = "C241";
classnamecolumn2 = "C242";
classnamecolumn3 = "C243";
classnamecolumn4 = "C244";
classnamecolumn5 = "C245";
classnamecolumn6 = "C246";
classnamecolumn7 = "C247";
classnamecolumn8 = "C248";
classnamecolumn9 = "C249";
classnamecolumn10 = "C2410";
} else if (params[2].equals("D")) {
classnamecolumn1 = "D241";
classnamecolumn2 = "D242";
classnamecolumn3 = "D243";
classnamecolumn4 = "D244";
classnamecolumn5 = "D245";
classnamecolumn6 = "D246";
classnamecolumn7 = "D247";
classnamecolumn8 = "D248";
classnamecolumn9 = "D249";
classnamecolumn10 = "D2410";
} else if (params[2].equals("E")) {
classnamecolumn1 = "E241";
classnamecolumn2 = "E242";
classnamecolumn3 = "E243";
classnamecolumn4 = "E244";
classnamecolumn5 = "E245";
classnamecolumn6 = "E246";
classnamecolumn7 = "E247";
classnamecolumn8 = "E248";
classnamecolumn9 = "E249";
classnamecolumn10 = "E2410";
} else {
classnamecolumn1 = "F241";
classnamecolumn2 = "F242";
classnamecolumn3 = "F243";
classnamecolumn4 = "F244";
classnamecolumn5 = "F245";
classnamecolumn6 = "F246";
classnamecolumn7 = "F247";
classnamecolumn8 = "F248";
classnamecolumn9 = "F249";
classnamecolumn10 = "F2410";
}
break;
case 21:
//classvalue = 21;
classnamecolumn = "Play";
if (params[2].equals("A")) {
classnamecolumn1 = "A211";
classnamecolumn2 = "A212";
classnamecolumn3 = "A213";
classnamecolumn4 = "A214";
classnamecolumn5 = "A215";
classnamecolumn6 = "A216";
classnamecolumn7 = "A217";
classnamecolumn8 = "A218";
classnamecolumn9 = "A219";
classnamecolumn10 = "A2110";
} else if (params[2].equals("B")) {
classnamecolumn1 = "B211";
classnamecolumn2 = "B212";
classnamecolumn3 = "B213";
classnamecolumn4 = "B214";
classnamecolumn5 = "B215";
classnamecolumn6 = "B216";
classnamecolumn7 = "B217";
classnamecolumn8 = "B218";
classnamecolumn9 = "B219";
classnamecolumn10 = "B2110";
} else if (params[2].equals("C")) {
classnamecolumn1 = "C211";
classnamecolumn2 = "C212";
classnamecolumn3 = "C213";
classnamecolumn4 = "C214";
classnamecolumn5 = "C215";
classnamecolumn6 = "C216";
classnamecolumn7 = "C217";
classnamecolumn8 = "C218";
classnamecolumn9 = "C219";
classnamecolumn10 = "C2110";
} else if (params[2].equals("D")) {
classnamecolumn1 = "D211";
classnamecolumn2 = "D212";
classnamecolumn3 = "D213";
classnamecolumn4 = "D214";
classnamecolumn5 = "D215";
classnamecolumn6 = "D216";
classnamecolumn7 = "D217";
classnamecolumn8 = "D218";
classnamecolumn9 = "D219";
classnamecolumn10 = "D2110";
} else if (params[2].equals("E")) {
classnamecolumn1 = "E211";
classnamecolumn2 = "E212";
classnamecolumn3 = "E213";
classnamecolumn4 = "E214";
classnamecolumn5 = "E215";
classnamecolumn6 = "E216";
classnamecolumn7 = "E217";
classnamecolumn8 = "E218";
classnamecolumn9 = "E219";
classnamecolumn10 = "E2110";
} else {
classnamecolumn1 = "F211";
classnamecolumn2 = "F212";
classnamecolumn3 = "F213";
classnamecolumn4 = "F214";
classnamecolumn5 = "F215";
classnamecolumn6 = "F216";
classnamecolumn7 = "F217";
classnamecolumn8 = "F218";
classnamecolumn9 = "F219";
classnamecolumn10 = "F2110";
}
break;
case 1:
classvalue = 1;

classnamecolumn = "FIRSTS";
if (params[2].equals("A")) {
classnamecolumn1 = "A011";
classnamecolumn2 = "A012";
classnamecolumn3 = "A013";
classnamecolumn4 = "A014";
classnamecolumn5 = "A015";
classnamecolumn6 = "A016";
classnamecolumn7 = "A017";
classnamecolumn8 = "A018";
classnamecolumn9 = "A019";
classnamecolumn10 = "A0110";
} else if (params[2].equals("B")) {
classnamecolumn1 = "B011";
classnamecolumn2 = "B012";
classnamecolumn3 = "B013";
classnamecolumn4 = "B014";
classnamecolumn5 = "B015";
classnamecolumn6 = "B016";
classnamecolumn7 = "B017";
classnamecolumn8 = "B018";
classnamecolumn9 = "B019";
classnamecolumn10 = "B0110";
} else if (params[2].equals("C")) {
classnamecolumn1 = "C011";
classnamecolumn2 = "C012";
classnamecolumn3 = "C013";
classnamecolumn4 = "C014";
classnamecolumn5 = "C015";
classnamecolumn6 = "C016";
classnamecolumn7 = "C017";
classnamecolumn8 = "C018";
classnamecolumn9 = "C019";
classnamecolumn10 = "C0110";
} else if (params[2].equals("D")) {
classnamecolumn1 = "D011";
classnamecolumn2 = "D012";
classnamecolumn3 = "D013";
classnamecolumn4 = "D014";
classnamecolumn5 = "D015";
classnamecolumn6 = "D016";
classnamecolumn7 = "D017";
classnamecolumn8 = "D018";
classnamecolumn9 = "D019";
classnamecolumn10 = "D0110";
} else if (params[2].equals("E")) {
classnamecolumn1 = "E011";
classnamecolumn2 = "E012";
classnamecolumn3 = "E013";
classnamecolumn4 = "E014";
classnamecolumn5 = "E015";
classnamecolumn6 = "E016";
classnamecolumn7 = "E017";
classnamecolumn8 = "E018";
classnamecolumn9 = "E019";
classnamecolumn10 = "E0110";
} else {
classnamecolumn1 = "F011";
classnamecolumn2 = "F012";
classnamecolumn3 = "F013";
classnamecolumn4 = "F014";
classnamecolumn5 = "F015";
classnamecolumn6 = "F016";
classnamecolumn7 = "F017";
classnamecolumn8 = "F018";
classnamecolumn9 = "F019";
classnamecolumn10 = "F0110";
}
break;
case 2:
classvalue = 2;
classnamecolumn = "SECONDS";
if (params[2].equals("A")) {
classnamecolumn1 = "A021";
classnamecolumn2 = "A022";
classnamecolumn3 = "A023";
classnamecolumn4 = "A024";
classnamecolumn5 = "A025";
classnamecolumn6 = "A026";
classnamecolumn7 = "A027";
classnamecolumn8 = "A028";
classnamecolumn9 = "A029";
classnamecolumn10 = "A0210";
} else if (params[2].equals("B")) {
classnamecolumn1 = "B021";
classnamecolumn2 = "B022";
classnamecolumn3 = "B023";
classnamecolumn4 = "B024";
classnamecolumn5 = "B025";
classnamecolumn6 = "B026";
classnamecolumn7 = "B027";
classnamecolumn8 = "B028";
classnamecolumn9 = "B029";
classnamecolumn10 = "B0210";
} else if (params[2].equals("C")) {
classnamecolumn1 = "C021";
classnamecolumn2 = "C022";
classnamecolumn3 = "C023";
classnamecolumn4 = "C024";
classnamecolumn5 = "C025";
classnamecolumn6 = "C026";
classnamecolumn7 = "C027";
classnamecolumn8 = "C028";
classnamecolumn9 = "C029";
classnamecolumn10 = "C0210";
} else if (params[2].equals("D")) {
classnamecolumn1 = "D021";
classnamecolumn2 = "D022";
classnamecolumn3 = "D023";
classnamecolumn4 = "D024";
classnamecolumn5 = "D025";
classnamecolumn6 = "D026";
classnamecolumn7 = "D027";
classnamecolumn8 = "D028";
classnamecolumn9 = "D029";
classnamecolumn10 = "D0210";
} else if (params[2].equals("E")) {
classnamecolumn1 = "E021";
classnamecolumn2 = "E022";
classnamecolumn3 = "E023";
classnamecolumn4 = "E024";
classnamecolumn5 = "E025";
classnamecolumn6 = "E026";
classnamecolumn7 = "E027";
classnamecolumn8 = "E028";
classnamecolumn9 = "E029";
classnamecolumn10 = "E0210";
} else {
classnamecolumn1 = "F021";
classnamecolumn2 = "F022";
classnamecolumn3 = "F023";
classnamecolumn4 = "F024";
classnamecolumn5 = "F025";
classnamecolumn6 = "F026";
classnamecolumn7 = "F027";
classnamecolumn8 = "F028";
classnamecolumn9 = "F029";
classnamecolumn10 = "F0210";
}
break;
case 3:
classvalue = 3;
classnamecolumn = "THIRD";
if (params[2].equals("A")) {
classnamecolumn1 = "A031";
classnamecolumn2 = "A032";
classnamecolumn3 = "A033";
classnamecolumn4 = "A034";
classnamecolumn5 = "A035";
classnamecolumn6 = "A036";
classnamecolumn7 = "A037";
classnamecolumn8 = "A038";
classnamecolumn9 = "A039";
classnamecolumn10 = "A0310";
} else if (params[2].equals("B")) {
classnamecolumn1 = "B031";
classnamecolumn2 = "B032";
classnamecolumn3 = "B033";
classnamecolumn4 = "B034";
classnamecolumn5 = "B035";
classnamecolumn6 = "B036";
classnamecolumn7 = "B037";
classnamecolumn8 = "B038";
classnamecolumn9 = "B039";
classnamecolumn10 = "B0310";
} else if (params[2].equals("C")) {
classnamecolumn1 = "C031";
classnamecolumn2 = "C032";
classnamecolumn3 = "C033";
classnamecolumn4 = "C034";
classnamecolumn5 = "C035";
classnamecolumn6 = "C036";
classnamecolumn7 = "C037";
classnamecolumn8 = "C038";
classnamecolumn9 = "C039";
classnamecolumn10 = "C0310";
} else if (params[2].equals("D")) {
classnamecolumn1 = "D031";
classnamecolumn2 = "D032";
classnamecolumn3 = "D033";
classnamecolumn4 = "D034";
classnamecolumn5 = "D035";
classnamecolumn6 = "D036";
classnamecolumn7 = "D037";
classnamecolumn8 = "D038";
classnamecolumn9 = "D039";
classnamecolumn10 = "D0310";
} else if (params[2].equals("E")) {
classnamecolumn1 = "E031";
classnamecolumn2 = "E032";
classnamecolumn3 = "E033";
classnamecolumn4 = "E034";
classnamecolumn5 = "E035";
classnamecolumn6 = "E036";
classnamecolumn7 = "E037";
classnamecolumn8 = "E038";
classnamecolumn9 = "E039";
classnamecolumn10 = "E0310";
} else {
classnamecolumn1 = "F031";
classnamecolumn2 = "F032";
classnamecolumn3 = "F033";
classnamecolumn4 = "F034";
classnamecolumn5 = "F035";
classnamecolumn6 = "F036";
classnamecolumn7 = "F037";
classnamecolumn8 = "F038";
classnamecolumn9 = "F039";
classnamecolumn10 = "F0310";
}
break;
case 4:
classvalue = 4;
classnamecolumn = "FOURTH";
if (params[2].equals("A")) {
classnamecolumn1 = "A041";
classnamecolumn2 = "A042";
classnamecolumn3 = "A043";
classnamecolumn4 = "A044";
classnamecolumn5 = "A045";
classnamecolumn6 = "A046";
classnamecolumn7 = "A047";
classnamecolumn8 = "A048";
classnamecolumn9 = "A049";
classnamecolumn10 = "A0410";
} else if (params[2].equals("B")) {
classnamecolumn1 = "B041";
classnamecolumn2 = "B042";
classnamecolumn3 = "B043";
classnamecolumn4 = "B044";
classnamecolumn5 = "B045";
classnamecolumn6 = "B046";
classnamecolumn7 = "B047";
classnamecolumn8 = "B048";
classnamecolumn9 = "B049";
classnamecolumn10 = "B0410";
} else if (params[2].equals("C")) {
classnamecolumn1 = "C041";
classnamecolumn2 = "C042";
classnamecolumn3 = "C043";
classnamecolumn4 = "C044";
classnamecolumn5 = "C045";
classnamecolumn6 = "C046";
classnamecolumn7 = "C047";
classnamecolumn8 = "C048";
classnamecolumn9 = "C049";
classnamecolumn10 = "C0410";
} else if (params[2].equals("D")) {
classnamecolumn1 = "D041";
classnamecolumn2 = "D042";
classnamecolumn3 = "D043";
classnamecolumn4 = "D044";
classnamecolumn5 = "D045";
classnamecolumn6 = "D046";
classnamecolumn7 = "D047";
classnamecolumn8 = "D048";
classnamecolumn9 = "D049";
classnamecolumn10 = "D0410";
} else if (params[2].equals("E")) {
classnamecolumn1 = "E041";
classnamecolumn2 = "E042";
classnamecolumn3 = "E043";
classnamecolumn4 = "E044";
classnamecolumn5 = "E045";
classnamecolumn6 = "E046";
classnamecolumn7 = "E047";
classnamecolumn8 = "E048";
classnamecolumn9 = "E049";
classnamecolumn10 = "E0410";
} else {
classnamecolumn1 = "F041";
classnamecolumn2 = "F042";
classnamecolumn3 = "F043";
classnamecolumn4 = "F044";
classnamecolumn5 = "F045";
classnamecolumn6 = "F046";
classnamecolumn7 = "F047";
classnamecolumn8 = "F048";
classnamecolumn9 = "F049";
classnamecolumn10 = "F0410";
}
break;
case 5:
classvalue = 5;
classnamecolumn = "FIFTH";
if (params[2].equals("A")) {
classnamecolumn1 = "A051";
classnamecolumn2 = "A052";
classnamecolumn3 = "A053";
classnamecolumn4 = "A054";
classnamecolumn5 = "A055";
classnamecolumn6 = "A056";
classnamecolumn7 = "A057";
classnamecolumn8 = "A058";
classnamecolumn9 = "A059";
classnamecolumn10 = "A0510";
} else if (params[2].equals("B")) {
classnamecolumn1 = "B051";
classnamecolumn2 = "B052";
classnamecolumn3 = "B053";
classnamecolumn4 = "B054";
classnamecolumn5 = "B055";
classnamecolumn6 = "B056";
classnamecolumn7 = "B057";
classnamecolumn8 = "B058";
classnamecolumn9 = "B059";
classnamecolumn10 = "B0510";
} else if (params[2].equals("C")) {
classnamecolumn1 = "C051";
classnamecolumn2 = "C052";
classnamecolumn3 = "C053";
classnamecolumn4 = "C054";
classnamecolumn5 = "C055";
classnamecolumn6 = "C056";
classnamecolumn7 = "C057";
classnamecolumn8 = "C058";
classnamecolumn9 = "C059";
classnamecolumn10 = "C0510";
} else if (params[2].equals("D")) {
classnamecolumn1 = "D051";
classnamecolumn2 = "D052";
classnamecolumn3 = "D053";
classnamecolumn4 = "D054";
classnamecolumn5 = "D055";
classnamecolumn6 = "D056";
classnamecolumn7 = "D057";
classnamecolumn8 = "D058";
classnamecolumn9 = "D059";
classnamecolumn10 = "D0510";
} else if (params[2].equals("E")) {
classnamecolumn1 = "E051";
classnamecolumn2 = "E052";
classnamecolumn3 = "E053";
classnamecolumn4 = "E054";
classnamecolumn5 = "E055";
classnamecolumn6 = "E056";
classnamecolumn7 = "E057";
classnamecolumn8 = "E058";
classnamecolumn9 = "E059";
classnamecolumn10 = "E0510";
} else {
classnamecolumn1 = "F051";
classnamecolumn2 = "F052";
classnamecolumn3 = "F053";
classnamecolumn4 = "F054";
classnamecolumn5 = "F055";
classnamecolumn6 = "F056";
classnamecolumn7 = "F057";
classnamecolumn8 = "F058";
classnamecolumn9 = "F059";
classnamecolumn10 = "F0510";
}
break;
case 6:
classvalue = 6;
classnamecolumn = "SIXTH";
if (params[2].equals("A")) {
classnamecolumn1 = "A061";
classnamecolumn2 = "A062";
classnamecolumn3 = "A063";
classnamecolumn4 = "A064";
classnamecolumn5 = "A065";
classnamecolumn6 = "A066";
classnamecolumn7 = "A067";
classnamecolumn8 = "A068";
classnamecolumn9 = "A069";
classnamecolumn10 = "A0610";
} else if (params[2].equals("B")) {
classnamecolumn1 = "B061";
classnamecolumn2 = "B062";
classnamecolumn3 = "B063";
classnamecolumn4 = "B064";
classnamecolumn5 = "B065";
classnamecolumn6 = "B066";
classnamecolumn7 = "B067";
classnamecolumn8 = "B068";
classnamecolumn9 = "B069";
classnamecolumn10 = "B0610";
} else if (params[2].equals("C")) {
classnamecolumn1 = "C061";
classnamecolumn2 = "C062";
classnamecolumn3 = "C063";
classnamecolumn4 = "C064";
classnamecolumn5 = "C065";
classnamecolumn6 = "C066";
classnamecolumn7 = "C067";
classnamecolumn8 = "C068";
classnamecolumn9 = "C069";
classnamecolumn10 = "C0610";
} else if (params[2].equals("D")) {
classnamecolumn1 = "D061";
classnamecolumn2 = "D062";
classnamecolumn3 = "D063";
classnamecolumn4 = "D064";
classnamecolumn5 = "D065";
classnamecolumn6 = "D066";
classnamecolumn7 = "D067";
classnamecolumn8 = "D068";
classnamecolumn9 = "D069";
classnamecolumn10 = "D0610";
} else if (params[2].equals("E")) {
classnamecolumn1 = "E061";
classnamecolumn2 = "E062";
classnamecolumn3 = "E063";
classnamecolumn4 = "E064";
classnamecolumn5 = "E065";
classnamecolumn6 = "E066";
classnamecolumn7 = "E067";
classnamecolumn8 = "E068";
classnamecolumn9 = "E069";
classnamecolumn10 = "E0610";
} else {
classnamecolumn1 = "F061";
classnamecolumn2 = "F062";
classnamecolumn3 = "F063";
classnamecolumn4 = "F064";
classnamecolumn5 = "F065";
classnamecolumn6 = "F066";
classnamecolumn7 = "F067";
classnamecolumn8 = "F068";
classnamecolumn9 = "F069";
classnamecolumn10 = "F0610";
}
break;
case 7:
classvalue = 7;
classnamecolumn = "SENETH";
if (params[2].equals("A")) {
classnamecolumn1 = "A071";
classnamecolumn2 = "A072";
classnamecolumn3 = "A073";
classnamecolumn4 = "A074";
classnamecolumn5 = "A075";
classnamecolumn6 = "A076";
classnamecolumn7 = "A077";
classnamecolumn8 = "A078";
classnamecolumn9 = "A079";
classnamecolumn10 = "A0710";
} else if (params[2].equals("B")) {
classnamecolumn1 = "B071";
classnamecolumn2 = "B072";
classnamecolumn3 = "B073";
classnamecolumn4 = "B074";
classnamecolumn5 = "B075";
classnamecolumn6 = "B076";
classnamecolumn7 = "B077";
classnamecolumn8 = "B078";
classnamecolumn9 = "B079";
classnamecolumn10 = "B0710";
} else if (params[2].equals("C")) {
classnamecolumn1 = "C071";
classnamecolumn2 = "C072";
classnamecolumn3 = "C073";
classnamecolumn4 = "C074";
classnamecolumn5 = "C075";
classnamecolumn6 = "C076";
classnamecolumn7 = "C077";
classnamecolumn8 = "C078";
classnamecolumn9 = "C079";
classnamecolumn10 = "C0710";
} else if (params[2].equals("D")) {
classnamecolumn1 = "D071";
classnamecolumn2 = "D072";
classnamecolumn3 = "D073";
classnamecolumn4 = "D074";
classnamecolumn5 = "D075";
classnamecolumn6 = "D076";
classnamecolumn7 = "D077";
classnamecolumn8 = "D078";
classnamecolumn9 = "D079";
classnamecolumn10 = "D0710";
} else if (params[2].equals("E")) {
classnamecolumn1 = "E071";
classnamecolumn2 = "E072";
classnamecolumn3 = "E073";
classnamecolumn4 = "E074";
classnamecolumn5 = "E075";
classnamecolumn6 = "E076";
classnamecolumn7 = "E077";
classnamecolumn8 = "E078";
classnamecolumn9 = "E079";
classnamecolumn10 = "E0710";
} else {
classnamecolumn1 = "F071";
classnamecolumn2 = "F072";
classnamecolumn3 = "F073";
classnamecolumn4 = "F074";
classnamecolumn5 = "F075";
classnamecolumn6 = "F076";
classnamecolumn7 = "F077";
classnamecolumn8 = "F078";
classnamecolumn9 = "F079";
classnamecolumn10 = "F0710";
}
break;
case 8:
classvalue = 8;
classnamecolumn = "EIGHT";
if (params[2].equals("A")) {
classnamecolumn1 = "A081";
classnamecolumn2 = "A082";
classnamecolumn3 = "A083";
classnamecolumn4 = "A084";
classnamecolumn5 = "A085";
classnamecolumn6 = "A086";
classnamecolumn7 = "A087";
classnamecolumn8 = "A088";
classnamecolumn9 = "A089";
classnamecolumn10 = "A0810";
} else if (params[2].equals("B")) {
classnamecolumn1 = "B081";
classnamecolumn2 = "B082";
classnamecolumn3 = "B083";
classnamecolumn4 = "B084";
classnamecolumn5 = "B085";
classnamecolumn6 = "B086";
classnamecolumn7 = "B087";
classnamecolumn8 = "B088";
classnamecolumn9 = "B089";
classnamecolumn10 = "B0810";
} else if (params[2].equals("C")) {
classnamecolumn1 = "C081";
classnamecolumn2 = "C082";
classnamecolumn3 = "C083";
classnamecolumn4 = "C084";
classnamecolumn5 = "C085";
classnamecolumn6 = "C086";
classnamecolumn7 = "C087";
classnamecolumn8 = "C088";
classnamecolumn9 = "C089";
classnamecolumn10 = "C0810";
} else if (params[2].equals("D")) {
classnamecolumn1 = "D081";
classnamecolumn2 = "D082";
classnamecolumn3 = "D083";
classnamecolumn4 = "D084";
classnamecolumn5 = "D085";
classnamecolumn6 = "D086";
classnamecolumn7 = "D087";
classnamecolumn8 = "D088";
classnamecolumn9 = "D089";
classnamecolumn10 = "D0810";
} else if (params[2].equals("E")) {
classnamecolumn1 = "E081";
classnamecolumn2 = "E082";
classnamecolumn3 = "E083";
classnamecolumn4 = "E084";
classnamecolumn5 = "E085";
classnamecolumn6 = "E086";
classnamecolumn7 = "E087";
classnamecolumn8 = "E088";
classnamecolumn9 = "E089";
classnamecolumn10 = "E0810";
} else {
classnamecolumn1 = "F081";
classnamecolumn2 = "F082";
classnamecolumn3 = "F083";
classnamecolumn4 = "F084";
classnamecolumn5 = "F085";
classnamecolumn6 = "F086";
classnamecolumn7 = "F087";
classnamecolumn8 = "F088";
classnamecolumn9 = "F089";
classnamecolumn10 = "F0810";
}
break;
case 9:
classvalue = 9;
classnamecolumn = "NINGTH";
if (params[2].equals("A")) {
classnamecolumn1 = "A091";
classnamecolumn2 = "A092";
classnamecolumn3 = "A093";
classnamecolumn4 = "A094";
classnamecolumn5 = "A095";
classnamecolumn6 = "A096";
classnamecolumn7 = "A097";
classnamecolumn8 = "A098";
classnamecolumn9 = "A099";
classnamecolumn10 = "A0910";
} else if (params[2].equals("B")) {
classnamecolumn1 = "B091";
classnamecolumn2 = "B092";
classnamecolumn3 = "B093";
classnamecolumn4 = "B094";
classnamecolumn5 = "B095";
classnamecolumn6 = "B096";
classnamecolumn7 = "B097";
classnamecolumn8 = "B098";
classnamecolumn9 = "B099";
classnamecolumn10 = "B0910";
} else if (params[2].equals("C")) {
classnamecolumn1 = "C091";
classnamecolumn2 = "C092";
classnamecolumn3 = "C093";
classnamecolumn4 = "C094";
classnamecolumn5 = "C095";
classnamecolumn6 = "C096";
classnamecolumn7 = "C097";
classnamecolumn8 = "C098";
classnamecolumn9 = "C099";
classnamecolumn10 = "C0910";
} else if (params[2].equals("D")) {
classnamecolumn1 = "D091";
classnamecolumn2 = "D092";
classnamecolumn3 = "D093";
classnamecolumn4 = "D094";
classnamecolumn5 = "D095";
classnamecolumn6 = "D096";
classnamecolumn7 = "D097";
classnamecolumn8 = "D098";
classnamecolumn9 = "D099";
classnamecolumn10 = "D0910";
} else if (params[2].equals("E")) {
classnamecolumn1 = "E091";
classnamecolumn2 = "E092";
classnamecolumn3 = "E093";
classnamecolumn4 = "E094";
classnamecolumn5 = "E095";
classnamecolumn6 = "E096";
classnamecolumn7 = "E097";
classnamecolumn8 = "E098";
classnamecolumn9 = "E099";
classnamecolumn10 = "E0910";
} else {
classnamecolumn1 = "F091";
classnamecolumn2 = "F092";
classnamecolumn3 = "F093";
classnamecolumn4 = "F094";
classnamecolumn5 = "F095";
classnamecolumn6 = "F096";
classnamecolumn7 = "F097";
classnamecolumn8 = "F098";
classnamecolumn9 = "F099";
classnamecolumn10 = "F0910";
}
break;
case 10:
classvalue = 10;
classnamecolumn = "TENGTH";
if (params[2].equals("A")) {
classnamecolumn1 = "A101";
classnamecolumn2 = "A102";
classnamecolumn3 = "A103";
classnamecolumn4 = "A104";
classnamecolumn5 = "A105";
classnamecolumn6 = "A106";
classnamecolumn7 = "A107";
classnamecolumn8 = "A108";
classnamecolumn9 = "A109";
classnamecolumn10 = "A1010";
} else if (params[2].equals("B")) {
classnamecolumn1 = "B101";
classnamecolumn2 = "B102";
classnamecolumn3 = "B103";
classnamecolumn4 = "B104";
classnamecolumn5 = "B105";
classnamecolumn6 = "B106";
classnamecolumn7 = "B107";
classnamecolumn8 = "B108";
classnamecolumn9 = "B109";
classnamecolumn10 = "B1010";
} else if (params[2].equals("C")) {
classnamecolumn1 = "C101";
classnamecolumn2 = "C102";
classnamecolumn3 = "C103";
classnamecolumn4 = "C104";
classnamecolumn5 = "C105";
classnamecolumn6 = "C106";
classnamecolumn7 = "C107";
classnamecolumn8 = "C108";
classnamecolumn9 = "C109";
classnamecolumn10 = "C1010";
} else if (params[2].equals("D")) {
classnamecolumn1 = "D101";
classnamecolumn2 = "D102";
classnamecolumn3 = "D103";
classnamecolumn4 = "D104";
classnamecolumn5 = "D105";
classnamecolumn6 = "D106";
classnamecolumn7 = "D107";
classnamecolumn8 = "D108";
classnamecolumn9 = "D109";
classnamecolumn10 = "D1010";
} else if (params[2].equals("E")) {
classnamecolumn1 = "E101";
classnamecolumn2 = "E102";
classnamecolumn3 = "E103";
classnamecolumn4 = "E104";
classnamecolumn5 = "E105";
classnamecolumn6 = "E106";
classnamecolumn7 = "E107";
classnamecolumn8 = "E108";
classnamecolumn9 = "E109";
classnamecolumn10 = "E1010";
} else {
classnamecolumn1 = "F101";
classnamecolumn2 = "F102";
classnamecolumn3 = "F103";
classnamecolumn4 = "F104";
classnamecolumn5 = "F105";
classnamecolumn6 = "F106";
classnamecolumn7 = "F107";
classnamecolumn8 = "F108";
classnamecolumn9 = "F109";
classnamecolumn10 = "F1010";
}
break;
case 11:
classvalue = 11;
classnamecolumn = "ELEVENTH";
if (params[2].equals("A")) {
classnamecolumn1 = "A111";
classnamecolumn2 = "A112";
classnamecolumn3 = "A113";
classnamecolumn4 = "A114";
classnamecolumn5 = "A115";
classnamecolumn6 = "A116";
classnamecolumn7 = "A117";
classnamecolumn8 = "A118";
classnamecolumn9 = "A119";
classnamecolumn10 = "A1110";
} else if (params[2].equals("B")) {
classnamecolumn1 = "B111";
classnamecolumn2 = "B112";
classnamecolumn3 = "B113";
classnamecolumn4 = "B114";
classnamecolumn5 = "B115";
classnamecolumn6 = "B116";
classnamecolumn7 = "B117";
classnamecolumn8 = "B118";
classnamecolumn9 = "B119";
classnamecolumn10 = "B1110";
} else if (params[2].equals("C")) {
classnamecolumn1 = "C111";
classnamecolumn2 = "C112";
classnamecolumn3 = "C113";
classnamecolumn4 = "C114";
classnamecolumn5 = "C115";
classnamecolumn6 = "C116";
classnamecolumn7 = "C117";
classnamecolumn8 = "C118";
classnamecolumn9 = "C119";
classnamecolumn10 = "C1110";
} else if (params[2].equals("D")) {
classnamecolumn1 = "D111";
classnamecolumn2 = "D112";
classnamecolumn3 = "D113";
classnamecolumn4 = "D114";
classnamecolumn5 = "D115";
classnamecolumn6 = "D116";
classnamecolumn7 = "D117";
classnamecolumn8 = "D118";
classnamecolumn9 = "D119";
classnamecolumn10 = "D1110";
} else if (params[2].equals("E")) {
classnamecolumn1 = "E111";
classnamecolumn2 = "E112";
classnamecolumn3 = "E113";
classnamecolumn4 = "E114";
classnamecolumn5 = "E115";
classnamecolumn6 = "E116";
classnamecolumn7 = "E117";
classnamecolumn8 = "E118";
classnamecolumn9 = "E119";
classnamecolumn10 = "E1110";
} else {
classnamecolumn1 = "F111";
classnamecolumn2 = "F112";
classnamecolumn3 = "F113";
classnamecolumn4 = "F114";
classnamecolumn5 = "F115";
classnamecolumn6 = "F116";
classnamecolumn7 = "F117";
classnamecolumn8 = "F118";
classnamecolumn9 = "F119";
classnamecolumn10 = "F1110";
}
break;
case 12:
classvalue = 12;
classnamecolumn = "TWELTH";
if (params[2].equals("A")) {
classnamecolumn1 = "A121";
classnamecolumn2 = "A122";
classnamecolumn3 = "A123";
classnamecolumn4 = "A124";
classnamecolumn5 = "A125";
classnamecolumn6 = "A126";
classnamecolumn7 = "A127";
classnamecolumn8 = "A128";
classnamecolumn9 = "A129";
classnamecolumn10 = "A1210";
} else if (params[2].equals("B")) {
classnamecolumn1 = "B121";
classnamecolumn2 = "B122";
classnamecolumn3 = "B123";
classnamecolumn4 = "B124";
classnamecolumn5 = "B125";
classnamecolumn6 = "B126";
classnamecolumn7 = "B127";
classnamecolumn8 = "B128";
classnamecolumn9 = "B129";
classnamecolumn10 = "B1210";
} else if (params[2].equals("C")) {
classnamecolumn1 = "C121";
classnamecolumn2 = "C122";
classnamecolumn3 = "C123";
classnamecolumn4 = "C124";
classnamecolumn5 = "C125";
classnamecolumn6 = "C126";
classnamecolumn7 = "C127";
classnamecolumn8 = "C128";
classnamecolumn9 = "C129";
classnamecolumn10 = "C1210";
} else if (params[2].equals("D")) {
classnamecolumn1 = "D121";
classnamecolumn2 = "D122";
classnamecolumn3 = "D123";
classnamecolumn4 = "D124";
classnamecolumn5 = "D125";
classnamecolumn6 = "D126";
classnamecolumn7 = "D127";
classnamecolumn8 = "D128";
classnamecolumn9 = "D129";
classnamecolumn10 = "D1210";
} else if (params[2].equals("E")) {
classnamecolumn1 = "E121";
classnamecolumn2 = "E122";
classnamecolumn3 = "E123";
classnamecolumn4 = "E124";
classnamecolumn5 = "E125";
classnamecolumn6 = "E126";
classnamecolumn7 = "E127";
classnamecolumn8 = "E128";
classnamecolumn9 = "E129";
classnamecolumn10 = "E1210";
} else {
classnamecolumn1 = "F121";
classnamecolumn2 = "F122";
classnamecolumn3 = "F123";
classnamecolumn4 = "F124";
classnamecolumn5 = "F125";
classnamecolumn6 = "F126";
classnamecolumn7 = "F127";
classnamecolumn8 = "F128";
classnamecolumn9 = "F129";
classnamecolumn10 = "F1210";
}
break;
 default:
classvalue = 50;
classnamecolumn = "Nur";
break;
}
String table=params[0];
int u=0;
table=table.substring(0,11);
DataBase  db=new DataBase();
Connection con=db.getConnection();
int classname=Integer.parseInt(params[1]);
try {
st = con.createStatement();

        String sql = "UPDATE attendance"
+ "."+table+ "  SET  SUBJECT1='"+params[3]+"',"
+ "SUBJECT2='"+params[4]+"',"
+ "SUBJECT3='"+params[5]+"',"
+ "SUBJECT4='"+params[6]+"',"
+ "SUBJECT5='"+params[7]+"',"
+ "SUBJECT6='"+params[8]+"',"
+ "SUBJECT7='"+params[9]+"',"
+ "SUBJECT8='"+params[10]+"',"
+ "SUBJECT9='"+params[11]+"',"
+ "SUBJECT10='"+params[12]+"'"
+" where STUDENTBRANCH="+classname+" AND STUDENTSECTION='"+params[2]+"'";
u = st.executeUpdate(sql);
String sql2 = "Update Attendance." + params[0] + "data SET "+classnamecolumn1+"='" +params[3]  + "', "+classnamecolumn2+"='" + params[4]
+ "',"+classnamecolumn3+"='" + params[5] + "',"+classnamecolumn4+"='" + params[6] + "',"+classnamecolumn5+"='" + params[7] + "',"+classnamecolumn6+"='" + params[8]
+ "',"+classnamecolumn7+"='" + params[9] + "',"+classnamecolumn8+"='" + params[10] + "',"+classnamecolumn9+"='" + params[11] + "',"+classnamecolumn10+"='" + params[12]
+ "' WHERE dated=" + dayss + " AND  monthd="+monss+" AND yeard="+yearss+"";
u = st.executeUpdate(sql2);
}catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
if
(u!=0)
{
try {
json.put("info", "success");
} catch (JSONException e) {
e.printStackTrace();
}
}
else
{
try {
json.put("info", "failure");
} catch (JSONException e) {
e.printStackTrace();
}
}
response.setContentType("application/json");
response.setCharacterEncoding("UTF-8");
response.getWriter().write(json.toString());
}
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
doGet(request, response);
}
}

JAVA Code for Update of details With SQL CODE AND Responce


package com.sawan;
import java.io.IOException;
import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.Enumeration;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.json.JSONException;
import org.json.JSONObject;
@WebServlet("/Admindetailupdate")
public class Admindetailupdate extends HttpServlet {
private static final long serialVersionUID = 1L;
Statement st;
public Admindetailupdate() {
super();
// TODO Auto-generated constructor stub
}
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
JSONObject json = new JSONObject();
Enumeration paramNames = request.getParameterNames();
String params[] = new String[11];
int i = 0;
while (paramNames.hasMoreElements()) {
String paramName = (String) paramNames.nextElement();
String[] paramValues = request.getParameterValues(paramName);
params[i] = paramValues[0];
i++;
}
String table = params[0];
table = table.substring(0, 11);
DataBase db = new DataBase();
Connection con = db.getConnection();
try {
st = con.createStatement();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
if (true) {
String sql = "UPDATE attendance" + "." + table + "  SET  STUDENTFATHER='" + params[2] + "',"
+ "MotherName='" + params[3] + "',"
+ "DOB='" + params[4] + "'," + "GENDER='" + params[5] + "'," + "STUDENTEMAIL='" + params[6] + "',"
+ "STUDENTFATHERMOB='" + params[7] + "'," + "STUDENTMOB='" + params[8] + "'," + "ADARCARD='"
+ params[9] + "'," + "ADDRESS='" + params[10] + "'"
+ " where STUDENTROLL='" + params[1] + "'";
int u = 0;
try {
u = st.executeUpdate(sql);
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
if (u != 0) {
try {
json.put("info", "success");
} catch (JSONException e) {
e.printStackTrace();
}
} else {
try {
json.put("info", "failure");
} catch (JSONException e) {
e.printStackTrace();
}
}
response.setContentType("application/json");
response.setCharacterEncoding("UTF-8");
response.getWriter().write(json.toString());
} else if (params[16].equals("Student")) {
String sql = "UPDATE attendance" + "." + table + "  SET  STUDENTBRANCH=" + params[3] + ","
+ "STUDENTSECTION='" + params[4] + "'" +
" where STUDENTROLL='" + params[2] + "'";
System.out.println("sql query is : " + sql);
int u = 0;
try {
u = st.executeUpdate(sql);
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
if (u != 0) {
try {
json.put("info", "success");
} catch (JSONException e) {
e.printStackTrace();
}
} else {
try {
json.put("info", "failure");
} catch (JSONException e) {
e.printStackTrace();
}
}

response.setContentType("application/json");
response.setCharacterEncoding("UTF-8");
response.getWriter().write(json.toString());
}
}
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
doGet(request, response);
}
}

JAVA Code Direct Attendance update with Server Response and SQL Update


package com.sawan;
import java.io.IOException;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.Enumeration;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.json.JSONObject;
@WebServlet("/AdminAttendanceStudentList")
public class AdminAttendanceStudentList extends HttpServlet {
private static final long serialVersionUID = 1L;
 Statement stmt = null;
    public AdminAttendanceStudentList() {
        super();
    }
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
    JSONObject json = new JSONObject();

  Enumeration paramNames = request.getParameterNames();
      String params[] = new String[3];
      int i = 0;
      while (paramNames.hasMoreElements())
      {
          String paramName = (String) paramNames.nextElement();
          String[] paramValues = request.getParameterValues(paramName);
          params[i] = paramValues[0];
          i++;
      }
      ResultSet rs=null;
      String table=params[1];
      String cutoff=params[0];
      DataBase  db=new DataBase();
      Connection con=db.getConnection();
      table=table.substring(0, 11);
      String Roll=params[0];
      int code=Integer.parseInt(params[0]);
      String sql="SELECT * FROM attendance."+table+"  WHERE STUDENTBRANCH ="+code+" AND STUDENTSECTION='"+params[2]+"'";
      try {
       stmt=con.createStatement();
      rs = stmt.executeQuery(sql);
int u=0;
       int s=0;
     while (rs.next()) {
                 json.put("home"+s,rs.getString("STUDENTNAME"));
               json.put("homec"+s,rs.getInt("STUDENTBRANCH"));
               json.put("homes"+s,rs.getString("STUDENTSECTION"));
               json.put("no",s);
              u=1;
              s++;
           }
           if(u==0)
           {
              json.put("info", "fail");
           }
           else
           {
              json.put("info","success");
           }
      } catch (Exception e) {
          e.printStackTrace();
      }
      response.setContentType("application/json");
      response.setCharacterEncoding("UTF-8");
      response.getWriter().write(json.toString());
}
}

JAVA Code Attendance with Server Response and SQL Update


package com.sawan;
import java.io.IOException;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Enumeration;
import java.util.Iterator;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.json.JSONException;
import org.json.JSONObject;
@WebServlet("/AdminappAttendanceUpdate")
public class AdminappAttendanceUpdate extends HttpServlet {
private static final long serialVersionUID = 1L;
Statement st = null;
ResultSet rs;
JSONObject json = new JSONObject();
public AdminappAttendanceUpdate() {
super();
// TODO Auto-generated constructor stub
}
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
Enumeration paramNames = request.getParameterNames();
ArrayList<String> params = new ArrayList<String>();
int i = 0;
while (paramNames.hasMoreElements()) {
String paramName = (String) paramNames.nextElement();
String[] paramValues = request.getParameterValues(paramName);
params.add(paramValues[0]);
i++;
}
int ror = 0;
int length = 0;
Iterator itr = params.iterator();
Iterator itr2 = params.iterator();
while (itr.hasNext()) {
length++;
itr.next();
}
int m = 0;
String arr[] = new String[length];
while (itr2.hasNext()) {
arr[m] = (String) itr2.next();
m++;
}
String facultyCode = arr[length - 1];
String table = arr[length - 2];
int row = Integer.parseInt(arr[length - 3]);
table = table.substring(0, 11);
DataBase db = new DataBase();
Connection con = db.getConnection();
int u = 0;
try {
st = con.createStatement();
int t = 0;
for (int j = 0; j < row; j++) {
int att = Integer.parseInt(arr[t + 4]);
String sql2 = "select * from attendance." + table + " where STUDENTROLL='" + arr[t + 1] + "'";
PreparedStatement stmt = con.prepareStatement(sql2);
rs = stmt.executeQuery();
rs.next();
int valueattt = 0;
int atte = rs.getInt("STUDENTHIGH");
int atte2 = rs.getInt("STUDENTSEMESTER");
if (Integer.parseInt(arr[t + 4]) == 0) {
atte = atte;
atte2 = atte2 + 1;
} else {
valueattt = 1;
atte = atte + 1;
atte2 = atte2 + 1;
}
String sql = "UPDATE attendance" + "." + table + "  SET STUDENTHIGH=" + atte + " ,STUDENTSEMESTER="
+ atte2 + " WHERE  STUDENTROLL='" + arr[t + 1] + "'";
st.executeUpdate(sql);
String date = new SimpleDateFormat("yyyyMMdd_HHmmss").format(Calendar.getInstance().getTime());
String redate2[] = date.split("_");
char[] ch = redate2[0].toCharArray();
String date3 = ch.toString();
String year = redate2[0].substring(0, 4);
String month = redate2[0].substring(4, 6);
String day = redate2[0].substring(6);
String redate = day + "/" + month + "/" + year;
String sql3 = "INSERT INTO attendance" + "." + table + "record (STUDENTROLL,STUDENTNAME,"
+ "SUBJECTCODE,FACULTYCODE,LACTUREDAY,LACTUREMONTH,LACTUREYEAR,LACTURETIME,LACTUREVARIFICATION) VALUES(?,?,?,?,?,?,?,?,?)";
PreparedStatement pst = con.prepareStatement(sql3);
pst.setString(1, arr[t + 1]);
pst.setString(2, "");
pst.setInt(3, 1);
pst.setInt(4, 1);
pst.setString(5, day);
pst.setString(6, month);
pst.setString(7, year);
pst.setString(8, redate2[1]);
if (valueattt == 0) {
pst.setInt(9, 0);
} else {
pst.setInt(9, 1);
}
pst.execute();
pst.close();
u = 1;
t = t + 5;
}
} catch (SQLException e) {
u = 0;
e.printStackTrace();
}
if (u != 0) {
try {
json.put("info", "success");
} catch (JSONException e) {
e.printStackTrace();
}
} else {
try {
json.put("info", "failure");
} catch (JSONException e) {
e.printStackTrace();
}
}
response.setContentType("application/json");
response.setCharacterEncoding("UTF-8");
response.getWriter().write(json.toString());
}
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
doGet(request, response);
}
}

JAVA Code Academic Calendar with Server Response and SQL Update with admin delete authority 


package com.sawan;
import java.io.IOException;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.Enumeration;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.json.JSONException;
import org.json.JSONObject;
/**
 * Servlet implementation class AdminAccountDelete
 */
@WebServlet("/AdminAccountDelete")
public class AdminAccountDelete extends HttpServlet {
private static final long serialVersionUID = 1L;
PreparedStatement st = null;
public AdminAccountDelete() {
super();
// TODO Auto-generated constructor stub
}
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
JSONObject json = new JSONObject();
Enumeration paramNames = request.getParameterNames();
String params[] = new String[17];
int i = 0;
while (paramNames.hasMoreElements()) {
String paramName = (String) paramNames.nextElement();
String[] paramValues = request.getParameterValues(paramName);
params[i] = paramValues[0];
i++;
}
if (params[2].equals("sawan1")) {
String table = params[0];
table = table.substring(0, 11);
table = table + "DI";
DataBase db = new DataBase();
int u = 0;
Connection con = db.getConnection();
try {
String sql = "DELETE FROM attendance" + "." + table + "  WHere  STUDENTFNAME=?";
PreparedStatement preparedStmt = con.prepareStatement(sql);
preparedStmt.setString(1, params[1]);
preparedStmt.execute();
u = 1;
} catch (SQLException e) {
u = 0;
// TODO Auto-generated catch block
e.printStackTrace();
}
try {
if (u == 0) {
json.put("info", "failure");
} else {
json.put("info", "success");
}
} catch (Exception e) {
e.printStackTrace();
}
response.setContentType("application/json");
response.setCharacterEncoding("UTF-8");
response.getWriter().write(json.toString());
}
if (params[2].equals("sawan2")) {
String table = params[0];
table = table.substring(0, 11);
table = table + "HO";
DataBase db = new DataBase();
int u = 0;
Connection con = db.getConnection();
try {
String sql = "DELETE FROM attendance" + "." + table + "  WHere  STUDENTFNAME=?";
PreparedStatement preparedStmt = con.prepareStatement(sql);
preparedStmt.setString(1, params[1]);
preparedStmt.execute();
u = 1;
} catch (SQLException e) {
u = 0;
e.printStackTrace();
}
try {
if (u == 0) {
json.put("info", "failure");
} else {
json.put("info", "success");
}
} catch (Exception e) {
e.printStackTrace();
}
response.setContentType("application/json");
response.setCharacterEncoding("UTF-8");
response.getWriter().write(json.toString());
}
if (params[2].equals("sawan3")) {
String table = params[0];
table = table.substring(0, 11);
table = table + "FA";
DataBase db = new DataBase();
int u = 0;
Connection con = db.getConnection();
try {
String sql = "DELETE FROM attendance" + "." + table + "  WHere  STUDENTFNAME=?";
PreparedStatement preparedStmt = con.prepareStatement(sql);
preparedStmt.setString(1, params[1]);
preparedStmt.execute();
u = 1;
} catch (SQLException e) {
u = 0;
// TODO Auto-generated catch block
e.printStackTrace();
}
try {
if (u == 0) {
json.put("info", "failure");
} else {
json.put("info", "success");
}
} catch (Exception e) {
e.printStackTrace();
}
response.setContentType("application/json");
response.setCharacterEncoding("UTF-8");
response.getWriter().write(json.toString());
}
if (params[2].equals("sawan4")) {
String table = params[0];
table = table.substring(0, 11);
DataBase db = new DataBase();
int u = 0;
Connection con = db.getConnection();
try {
String sql = "DELETE FROM attendance" + "." + table + "  WHERE  STUDENTROLL=?";
PreparedStatement preparedStmt = con.prepareStatement(sql);
preparedStmt.setString(1, params[1]);
preparedStmt.execute();
u = 1;
} catch (SQLException e) {
u = 0;
// TODO Auto-generated catch block
e.printStackTrace();
}
try {
if (u == 0) {
json.put("info", "failure");
} else {
json.put("info", "success");
}
} catch (Exception e) {
e.printStackTrace();
}
response.setContentType("application/json");
response.setCharacterEncoding("UTF-8");
response.getWriter().write(json.toString());
}
}
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
doGet(request, response);
}
}

JAVA Code Academic Calendar with Server Response and SQL Update

package com.sawan;
import java.io.IOException;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
 * Servlet implementation class AcademicCalendar
 */
@WebServlet("/AcademicCalendar")
public class AcademicCalendar extends HttpServlet {
private static final long serialVersionUID = 1L;
String dayss, monss, yearss;
ResultSet rs = null;
Connection con = null;
PreparedStatement stmt = null;
Statement st = null;
int sawan = 0;
public AcademicCalendar() {
super();
// TODO Auto-generated constructor stub
}
/**
 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse
 *      response)
 */
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
DataBase db = new DataBase();
con = db.getConnection();
String datesawan = new SimpleDateFormat("yyyyMMdd_HHmmss").format(Calendar.getInstance().getTime());
String redate2[] = datesawan.split("_");
char[] chsawan = redate2[0].toCharArray();
String date3sawan = chsawan.toString();
yearss = redate2[0].substring(0, 4);
monss = redate2[0].substring(4, 6);
dayss = redate2[0].substring(6);
ReadData rd = new ReadData();
if (request.getParameter("requestcode").equals("insertClassData")) {
try {
String sql2 = "insert into attendance.mpss" + request.getParameter("photo")
+ "cal (content,datee,monthh,yearr,accss) values (?,?,?,?,?)";
PreparedStatement pst = con.prepareStatement(sql2);
for (int j = 1; j <= 30; j++) {
pst.setString(1, "");
pst.setString(2, j + "");
pst.setString(3, 4 + "");
pst.setString(4, yearss);
pst.setInt(5, 0);
pst.execute();
}
for (int j = 1; j <= 31; j++) {
pst.setString(1, "");
pst.setString(2, j + "");
pst.setString(3, 5 + "");
pst.setString(4, yearss);
pst.setInt(5, 0);
pst.execute();
}
for (int j = 1; j <= 30; j++) {
pst.setString(1, "");
pst.setString(2, j + "");
pst.setString(3, 6 + "");
pst.setString(4, yearss);
pst.setInt(5, 0);
pst.execute();
}
for (int j = 1; j <= 31; j++) {
pst.setString(1, "");
pst.setString(2, j + "");
pst.setString(3, 7 + "");
pst.setString(4, yearss);
pst.setInt(5, 0);
pst.execute();
}
for (int j = 1; j <= 31; j++) {
pst.setString(1, "");
pst.setString(2, j + "");
pst.setString(3, 8 + "");
pst.setString(4, yearss);
pst.setInt(5, 0);
pst.execute();
}
for (int j = 1; j <= 30; j++) {
pst.setString(1, "");
pst.setString(2, j + "");
pst.setString(3, 9 + "");
pst.setString(4, yearss);
pst.setInt(5, 0);
pst.execute();
}
for (int j = 1; j <= 31; j++) {
pst.setString(1, "");
pst.setString(2, j + "");
pst.setString(3, 10 + "");
pst.setString(4, yearss);
pst.setInt(5, 0);
pst.execute();
}
for (int j = 1; j <= 30; j++) {
pst.setString(1, "");
pst.setString(2, j + "");
pst.setString(3, 11 + "");
pst.setString(4, yearss);
pst.setInt(5, 0);
pst.execute();
}
for (int j = 1; j <= 31; j++) {
pst.setString(1, "");
pst.setString(2, j + "");
pst.setString(3, 12 + "");
pst.setString(4, yearss);
pst.setInt(5, 0);
pst.execute();
}
for (int j = 1; j <= 31; j++) {
pst.setString(1, "");
pst.setString(2, j + "");
pst.setString(3, 1 + "");
pst.setString(4, (Integer.parseInt(yearss) + 1) + "");
pst.setInt(5, 0);
pst.execute();
}
for (int j = 1; j <= 29; j++) {
pst.setString(1, "");
pst.setString(2, j + "");
pst.setString(3, 2 + "");
pst.setString(4, (Integer.parseInt(yearss) + 1) + "");
pst.setInt(5, 0);
pst.execute();
}
for (int j = 1; j <= 31; j++) {
pst.setString(1, "");
pst.setString(2, j + "");
pst.setString(3, 3 + "");
pst.setString(4, (Integer.parseInt(yearss) + 1) + "");
pst.setInt(5, 0);
pst.execute();
}
pst.close();
request.setAttribute("roll", request.getParameter("WebStudentDetailForfeeSubmition"));
} catch (SQLException e) {
e.printStackTrace();
}
getServletContext().getRequestDispatcher("/Adminstrative.jsp").forward(request, response);
return;
} else if (request.getParameter("requestcode").equals("studentsubject")) {
String sql1 = "select * from Attendance.mpss" + request.getParameter("cid") + "cal";
try {
stmt = con.prepareStatement(sql1);
rs = stmt.executeQuery();
int calcultor = 0;
while (rs.next()) {
{
request.setAttribute("tc1" + calcultor, rs.getString("content"));
request.setAttribute("tc2" + calcultor, rs.getString("datee"));
request.setAttribute("tc3" + calcultor, rs.getString("monthh"));
request.setAttribute("tc4" + calcultor, rs.getString("yearr"));
request.setAttribute("tc5" + calcultor, rs.getString("noo"));
request.setAttribute("tc6" + calcultor, rs.getString("accss"));
calcultor++;
sawan++;
}
}
request.setAttribute("total", calcultor + "");
request.setAttribute("cid", request.getParameter("cid"));
} catch (SQLException e) {
e.printStackTrace();
}
getServletContext().getRequestDispatcher("/AcademicCalendarDataFilling.jsp").forward(request, response);
return;
} else if (request.getParameter("requestcode").equals("sawancha")) {
String sql1 = "select * from Attendance.mpss" + request.getParameter("cid") + "cal where noo="
+ Integer.parseInt(request.getParameter("seq")) + "";
try {
stmt = con.prepareStatement(sql1);
rs = stmt.executeQuery();
rs.next();
request.setAttribute("tc1", rs.getString("content"));
request.setAttribute("tc2", request.getParameter("seq"));
request.setAttribute("tc3", rs.getInt("accss"));
request.setAttribute("cid", request.getParameter("cid"));
} catch (SQLException e) {
e.printStackTrace();
}
getServletContext().getRequestDispatcher("/AcademicDataUpdation.jsp").forward(request, response);
return;
} else if (request.getParameter("requestcode").equals("schoolnoticeupdate")) {
String sql1 = "update  Attendance.mpss" + request.getParameter("cid") + "cal set content='"
+ request.getParameter("PreviousMessegePaarameter") + "',accss=1 where noo="
+ Integer.parseInt(request.getParameter("seq")) + "";
try {
st = con.createStatement();
st.executeUpdate(sql1);
request.setAttribute("cid", request.getParameter("cid"));
} catch (SQLException e) {
e.printStackTrace();
}
getServletContext().getRequestDispatcher("/Adminstrative.jsp").forward(request, response);
return;
}
}
}

Code for Server  Response with SQL Update  Programming Logic and Code with Syntax 

package com.sawan;
import java.io.IOException;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Enumeration;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.json.JSONException;
import org.json.JSONObject;
/**
 * Servlet implementation class Academic
 */
@WebServlet("/Academic")
public class Academic extends HttpServlet {
private static final long serialVersionUID = 1L;
   
String dayss, monss, yearss;
PreparedStatement stmt = null;
ResultSet rs;
JSONObject json = new JSONObject();
    public Academic() {
        super();
        // TODO Auto-generated constructor stub
    }
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
JSONObject json = new JSONObject();
Enumeration paramNames = request.getParameterNames();
String params[] = new String[1];
int i = 0;
while (paramNames.hasMoreElements()) {
String paramName = (String) paramNames.nextElement();
String[] paramValues = request.getParameterValues(paramName);
params[i] = paramValues[0];
i++;
}

String table = params[0];
table = table.substring(0, 11);
DataBase db = new DataBase();
int clsstrength = 0;
Connection con = db.getConnection();
String date = new SimpleDateFormat("yyyyMMdd_HHmmss").format(Calendar.getInstance().getTime());
String redate2[] = date.split("_");
char[] ch = redate2[0].toCharArray();
String date3 = ch.toString();
yearss = redate2[0].substring(0, 4);
monss = redate2[0].substring(4, 6);
dayss = redate2[0].substring(6);
String redate = dayss + "/" + dayss + "/" + dayss;
int monthsss=Integer.parseInt(monss);
int daysss=Integer.parseInt(dayss);
monss=monthsss+"";
dayss=daysss+"";
String sql = "SELECT * FROM attendance." + table + "cal  WHERE datee='" + dayss
+ "' AND monthh='" + monss + "' AND yearr='" + yearss + "'";
try {
stmt = con.prepareStatement(sql);
rs = stmt.executeQuery();
int totalattendance = 1;
rs.next();
int noo1=rs.getInt("noo");
String sql2 = "SELECT * FROM attendance." + table + "cal  WHERE datee='30' AND monthh='03' AND yearr='" + (Integer.parseInt(yearss)+1)+"" + "'";
stmt = con.prepareStatement(sql2);
rs = stmt.executeQuery();
rs.next();
int j = 0;
String sql3 = "SELECT * FROM attendance." + table + "cal  WHERE noo >= "+noo1+" and accss=1 ";
stmt = con.prepareStatement(sql3);
rs = stmt.executeQuery();
while (rs.next()) {
String datee=rs.getString("datee");
String monthh=rs.getString("monthh");
String yearrr=rs.getString("yearr");
json.put("name" + j, datee+"-"+monthh+"-"+yearrr);
json.put("branch" + j, rs.getString("content"));
j++;
}
json.put("absent", j + "");
json.put("info", "success");
} catch (JSONException e1) {
try {
json.put("info", "failure");
} catch (JSONException e) {
e.printStackTrace();
}
e1.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
}
try {
response.setContentType("application/json");
response.setCharacterEncoding("UTF-8");
response.getWriter().write(json.toString());
} catch (Exception e) {
System.out.println(e);
}

}
}

Java Code for Request and Response for android application from MYSQL Database  Programming Logic and Code with Syntax 

package com.sawan;
import java.io.IOException;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Enumeration;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.json.JSONException;
import org.json.JSONObject;
/**
 * Servlet implementation class AbesentData
 */
@WebServlet("/AbesentData")
public class AbesentData extends HttpServlet {
private static final long serialVersionUID = 1L;
String dayss, monss, yearss;
PreparedStatement stmt = null;
ResultSet rs;
JSONObject json = new JSONObject();
public AbesentData() {
super();
}
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
JSONObject json = new JSONObject();
Enumeration paramNames = request.getParameterNames();
String params[] = new String[3];
int i = 0;
while (paramNames.hasMoreElements()) {
String paramName = (String) paramNames.nextElement();
String[] paramValues = request.getParameterValues(paramName);
params[i] = paramValues[0];
i++;
}
if (params[1].equals("AbsentStudent")) {
String table = params[0];
table = table.substring(0, 11);
DataBase db = new DataBase();
int clsstrength = 0;
Connection con = db.getConnection();
String date = new SimpleDateFormat("yyyyMMdd_HHmmss").format(Calendar.getInstance().getTime());
String redate2[] = date.split("_");
char[] ch = redate2[0].toCharArray();
String date3 = ch.toString();
yearss = redate2[0].substring(0, 4);
monss = redate2[0].substring(4, 6);
dayss = redate2[0].substring(6);
String redate = dayss + "/" + dayss + "/" + dayss;
String sql = "SELECT STUDENTNAME FROM attendance." + table + "record  WHERE LACTUREDAY='" + dayss
+ "' AND LACTUREMonth='" + monss + "' AND LACTUREyear='" + yearss + "'";
String sql2 = "SELECT STUDENTNAME FROM attendance." + table + "record  WHERE LACTUREDAY='" + dayss
+ "' AND LACTUREMonth='" + monss + "' AND LACTUREyear='" + yearss + "' AND LactureVarification=0";

try {
stmt = con.prepareStatement(sql);
rs = stmt.executeQuery();
int totalattendance = 1;
while (rs.next()) {
totalattendance++;
}
stmt = con.prepareStatement(sql2);
rs = stmt.executeQuery();
int j = 0;
while (rs.next()) {
String sql3 = "SELECT STUDENTNAME,STUDENTBRANCH,STUDENTSECTION FROM attendance." + table
+ "  WHERE STUDENTROLL='" + rs.getString("STUDENTNAME") + "'";
stmt = con.prepareStatement(sql3);
ResultSet rs3 = stmt.executeQuery();
rs3.next();
json.put("name" + j, rs3.getString("STUDENTNAME"));
json.put("branch" + j, rs3.getInt("STUDENTBRANCH") + "");
json.put("Section" + j, rs3.getString("STUDENTSECTION"));
j++;
}
json.put("absent", j + "");
json.put("totalll", totalattendance + "");
json.put("info", "success");
} catch (JSONException e1) {
try {
json.put("info", "failure");
} catch (JSONException e) {
e.printStackTrace();
}
e1.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
}
try {
response.setContentType("application/json");
response.setCharacterEncoding("UTF-8");
response.getWriter().write(json.toString());
} catch (Exception e) {

}
} else if (params[1].equals("AbsentStudent2")) {
String table = params[0];
table = table.substring(0, 11);
DataBase db = new DataBase();
int clsstrength = 0;
Connection con = db.getConnection();
String date = new SimpleDateFormat("yyyyMMdd_HHmmss").format(Calendar.getInstance().getTime());
String redate2[] = date.split("_");
char[] ch = redate2[0].toCharArray();
String date3 = ch.toString();
yearss = redate2[0].substring(0, 4);
monss = redate2[0].substring(4, 6);
dayss = redate2[0].substring(6);
String redate = dayss + "/" + dayss + "/" + dayss;
int saw = Integer.parseInt(dayss);
try {
int j = 0;
int totalattendance = 1;
for (int sa = 1; sa <= saw; sa++) {
String sql = "SELECT STUDENTNAME FROM attendance." + table + "record  WHERE LACTUREDAY='" + sa
+ "' AND LACTUREMonth='" + monss + "' AND LACTUREyear='" + yearss + "'";
String sql2 = "SELECT STUDENTNAME FROM attendance." + table + "record  WHERE LACTUREDAY='" + sa
+ "' AND LACTUREMonth='" + monss + "' AND LACTUREyear='" + yearss
+ "' AND LactureVarification=0";
stmt = con.prepareStatement(sql);
rs = stmt.executeQuery();
while (rs.next()) {
totalattendance++;
}
stmt = con.prepareStatement(sql2);
rs = stmt.executeQuery();
while (rs.next()) {
String sql3 = "SELECT * FROM attendance." + table + "  WHERE STUDENTROLL='"
+ rs.getString("STUDENTNAME") + "'";
stmt = con.prepareStatement(sql3);
ResultSet rs3 = stmt.executeQuery();
rs3.next();
json.put("name" + j, rs3.getString("STUDENTNAME"));
json.put("name2" + j, rs3.getString("STUDENTROLL"));
json.put("branch" + j, rs3.getInt("STUDENTBRANCH") + "");
json.put("Section" + j, rs3.getString("STUDENTSECTION"));
json.put("sawan1" + j, 1 + "");
json.put("sawan2" + j, 1 + " ");
json.put("sawan3" + j, 1 + "");
j++;
}
}
json.put("absent", j + "");
json.put("totalll", totalattendance + "");
json.put("info", "success");
} catch (JSONException e1) {
try {
json.put("info", "failure");
} catch (JSONException e) {
e.printStackTrace();
}
e1.printStackTrace();
}
catch (Exception e) {
e.printStackTrace();
}
try {
response.setContentType("application/json");
response.setCharacterEncoding("UTF-8");
response.getWriter().write(json.toString());
} catch (Exception e) {
System.out.println(e);
}
}
}
}

Translate