Jump to content

User:Sunalika.sahoo

From Wikipedia, the free encyclopedia

///////////////////////////DBHandler/////////////////////////////


package dbopr; import java.sql.*; public class DBHandler { Connection con; Statement st; ResultSet rs; public boolean establishConnection() { boolean connect=false; try { Class.forName("oracle.jdbc.driver.OracleDriver"); System.out.println("loaded Driver"); con=DriverManager.getConnection("jdbc:oracle:thin:@192.168.40.6:1521:oracle","c3112","tcs"); System.out.println("Connection established"); st=con.createStatement(); System.out.println("Statement created"); connect=true; }catch(ClassNotFoundException cfe) { System.out.println("No Driver"+cfe); } catch(Exception e) { System.out.println(e); } System.out.println("Connection Status:"+connect); return connect; } public int executeDMLOperation(String query) { System.out.println("query"); int cnt=0; try { cnt=st.executeUpdate(query); System.out.println(cnt); } catch(Exception e) { System.out.println("executeDML exp"); System.out.println(e); } return cnt; }

public ResultSet executeDRLOperation(String query) { System.out.println(query); try { rs=st.executeQuery(query); System.out.println("rs done"); } catch(Exception e) { System.out.println("DRL expception"+e); System.out.println(e); } return rs; }

public void closeConnection() { try { if(rs!=null) rs.close(); if(st!=null) st.close(); if(con!=null) con.close(); } catch(Exception e) { System.out.println(e); } } }





///////////////////////////////////LogIN FORM////////////////////////////////


/**

  Created By:-
  Team No:B-4
  Emp Id:478514
  Emp Name:Sameer Kalra
  Project Name:SABA ITP Learning Automation
  • /

package model.form;

import java.io.Serializable;

import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpSession;

import org.apache.struts.action.*;

public class Login extends ActionForm implements Serializable{

private String userid; private String pwd; private String type; private String name;

public String getName() { return name; } public void setName(String name) { this.name = name; } public String getType() { return type; } public void setType(String type) { this.type = type; } public String getPwd() { return pwd; } public void setPwd(String pwd) { this.pwd = pwd; } public String getUserid() { return userid; } public void setUserid(String userid) { this.userid = userid; }

public void reset(ActionMapping map,HttpServletRequest req) { this.userid=null; this.pwd=null; } public ActionErrors validate(ActionMapping map,HttpServletRequest req) { ActionErrors ae=new ActionErrors(); if(userid.trim().length()<=0) { System.out.println("Blk 1"); ae.add("userid_req", new ActionMessage("userid_required")); } if(pwd.length()<=0) { System.out.println("Blk 2"); ae.add("pass_req",new ActionMessage("password_info")); } HttpSession hs=req.getSession(true); hs.setAttribute("userid",userid); return ae; }


}


//////////////////////////////ASSOCIATE FORM//////////////////////////


/**

  Created By:-
  Team No:B-4
  Emp Id:478454
  Emp Name:Geeta Pargai
  Project Name:SABA ITP Learning Automation
    • /

package model.form;

import java.io.Serializable; import java.util.ArrayList;

import javax.servlet.http.HttpServletRequest;

import org.apache.struts.action.*;

import java.util.*;

public class Associate extends ActionForm implements Serializable{ private String userid; private String topic; private String course; private Date reg_date; private Date completed_date; private double wbt_mark; private double class_mark; private double total_mark; private String status; private int reg_id;

   private String mode;

public String getMode() { return mode; } public void setMode(String mode) { this.mode = mode; }

public double getClass_mark() { return class_mark; } public void setClass_mark(double class_mark) { this.class_mark = class_mark; } public Date getCompleted_date() { return completed_date; } public void setCompleted_date(Date completed_date) { this.completed_date = completed_date; } public String getCourse() { return course; } public void setCourse(String course) { this.course = course; } public Date getReg_date() { return reg_date; } public void setReg_date(Date reg_date) { this.reg_date = reg_date; } public int getReg_id() { return reg_id; } public void setReg_id(int reg_id) { this.reg_id = reg_id; } public String getStatus() { return status; } public void setStatus(String status) { this.status = status; } public String getTopic() { return topic; } public void setTopic(String topic) { this.topic = topic; } public double getTotal_mark() { return total_mark; } public void setTotal_mark(double total_mark) { this.total_mark = total_mark; } public String getUserid() { return userid; } public void setUserid(String userid) { this.userid = userid; } public double getWbt_mark() { return wbt_mark; } public void setWbt_mark(double wbt_mark) { this.wbt_mark = wbt_mark; } public void reset(ActionMapping map,HttpServletRequest req) { this.mode=null; }

/* public void reset(ActionMapping map,HttpServletRequest req) {

this.userid=null; this.topic=null; this.course=null; this.reg_date=null; this.completed_date=null; this.wbt_mark=Double.parseDouble(null); this.class_mark=Double.parseDouble(null); this.total_mark=Double.parseDouble(null); this.status=null; this.reg_id=Integer.parseInt(null);

   }

public ActionErrors validate(ActionMapping map,HttpServletRequest req) { ActionErrors ae=new ActionErrors();

if(userid.trim().length()<=0) { ae.add("userid_req", new ActionMessage("userid_required")); } if(topic.trim().length()<=0) { ae.add("topic_req", new ActionMessage("topic_required")); } if(course.trim().length()<=0) { ae.add("course_req", new ActionMessage("course_required")); } if(reg_date==null) { ae.add("reg_date_req", new ActionMessage("reg_date_required")); } if(completed_date==null) { ae.add("completed_date_req", new ActionMessage("completed_date_required")); } if(wbt_mark<=0||wbt_mark==Double.parseDouble(null)) { ae.add("wbt_mark_req", new ActionMessage("wbt_mark_required")); } if(class_mark<=0||class_mark==Double.parseDouble(null)) { ae.add("class_mark_req", new ActionMessage("class_mark_required")); } if(total_mark<=0||total_mark==Double.parseDouble(null)) { ae.add("total_mark_req", new ActionMessage("total_mark_required")); } if(status.trim().length()<=0) { ae.add("status_req", new ActionMessage("status_required")); } if(reg_id<=0||reg_id==Integer.parseInt(null)) { ae.add("reg_id", new ActionMessage("reg_id_required")); }

return ae; }*/ public ActionErrors validate(ActionMapping map,HttpServletRequest req){ ActionErrors ae=new ActionErrors();

if(mode==null) { ae.add("mode_err", new ActionMessage("mode_required")); } return ae; } }

////////////////////////////////ASSOCIATE UTILITY////////////////////////////


package model.form; import java.util.*;

import java.io.Serializable; import java.sql.ResultSet; import java.sql.SQLException; import java.util.Date;

import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpSession;

import org.apache.struts.action.ActionErrors; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionMapping; import org.apache.struts.action.ActionMessage;

import model.form.Associate; import dbopr.DBHandler;

public class AssociateUtility extends ActionForm implements Serializable{ private ArrayList<Associate> aslist=new ArrayList<Associate>(); private String userid; private String course; private double mark; private int chk; private ArrayList<String> topiclist=new ArrayList<String>(); private ArrayList<String> courselist=new ArrayList<String>();


public int getChk() { return chk; } public void setChk(int chk) { this.chk = chk; } public ArrayList<Associate> getAslist() { return aslist; } public void setAslist(ArrayList<Associate> aslist) { this.aslist = aslist; }

public String getUserid() { return userid; } public void setUserid(String userid) { this.userid = userid; }

public ArrayList<String> getCourselist() { return courselist; } public void setCourselist(ArrayList<String> courselist) { this.courselist = courselist; } public ArrayList<String> getTopiclist() { return topiclist; } public void setTopiclist(ArrayList<String> topiclist) { this.topiclist = topiclist; } public String getCourse() { return course; } public void setCourse(String course) { this.course = course; } public double getMark() { return mark; } public void setMark(double mark) { this.mark = mark; } public ActionErrors validate(ActionMapping map,HttpServletRequest req) { ActionErrors ae=new ActionErrors(); HttpSession hs = req.getSession(); if(hs.getAttribute("name").toString().equals("Admin")) { if(userid.trim().length()<=0 || userid.trim().equals("none")) { ae.add("userid_req", new ActionMessage("userid_required")); } System.out.println("Mark value is:"+mark); if(mark<=0) { System.out.println("Recognized mark error!!!!"); ae.add("mark_req", new ActionMessage("mark_required")); } if(mark>100) { ae.add("mark_inv", new ActionMessage("mark_invalid")); } }


return ae; }


public ArrayList<Associate> showDetails(){ try{ DBHandler db=new DBHandler(); boolean stat=db.establishConnection();

if(stat){ String query="select * from associate where userid='"+this.getUserid()+"'"; System.out.println(query); ResultSet res=db.executeDRLOperation(query);

while(res.next())

{ Associate ascObj=new Associate(); ascObj.setUserid(res.getString(1)); ascObj.setTopic(res.getString(2)); ascObj.setCourse(res.getString(3)); ascObj.setReg_date(res.getDate(4)); System.out.println(ascObj.getReg_date()); ascObj.setCompleted_date(res.getDate(5)); ascObj.setClass_mark(res.getDouble(6)); ascObj.setWbt_mark(res.getDouble(7)); ascObj.setStatus(res.getString(8)); aslist.add(ascObj); } } db.closeConnection(); }

catch(SQLException e) { System.out.println(e); } catch(Exception e) { System.out.println(e); } return aslist; }


public AssociateUtility addmark(AssociateUtility assutl) throws SQLException { DBHandler db = new DBHandler(); boolean conExists = db.establishConnection(); if(conExists) { String query = "select course_name from associate where userId='"+userid.trim()+"' and wbt_mark = -1 and status='registered'"; ResultSet rs = db.executeDRLOperation(query); courselist.clear(); while(rs.next()) { Associate a = new Associate(); //a.setTopic(rs.getString(1)); //a.setCourse(rs.getString(2)); //aslist.add(a); //topiclist.add(rs.getString(1)); System.out.println(rs.getString(1)); courselist.add(rs.getString(1)); } } return assutl; }


public AssociateUtility addmark1(AssociateUtility au) { DBHandler db = new DBHandler(); boolean conExists = db.establishConnection(); if(conExists) { if(mark>=75) { String query = "update associate set classroom_mark="+mark+", status = 'completed', com_date=sysdate where userId='"+userid.trim()+"'and course_name='"+course.trim().toUpperCase()+"'"; System.out.println(query); chk = db.executeDMLOperation(query); System.out.println("chk "+chk); au.setChk(chk); } else { String query = "update associate set classroom_mark="+mark+" where userId='"+userid.trim()+"'and course_name='"+course.trim().toUpperCase()+"'"; System.out.println(query); chk = db.executeDMLOperation(query); System.out.println("chk "+chk); au.setChk(chk); }

} return au; }

}

/////////////////////////////TOPIC CATALOG/////////////////////////


/**

  Created By:-
  Team No:B-4
  Emp Id:478549
  Emp Name:Sarpharaaj Alam Sarkar
  Project Name:SABA ITP Learning Automation
    • /

package model.form;

import java.io.Serializable; import javax.servlet.http.HttpServletRequest; import org.apache.struts.action.*;

public class TopicCatalog extends ActionForm implements Serializable{ private String topic; private String course; private int chk; private int topicExistChk; private int courseExistChk;

public int getChk() { return chk; } public void setChk(int chk) { this.chk = chk; } public int getCourseExistChk() { return courseExistChk; } public void setCourseExistChk(int courseExistChk) { this.courseExistChk = courseExistChk; } public int getTopicExistChk() { return topicExistChk; } public void setTopicExistChk(int topicExistChk) { this.topicExistChk = topicExistChk; } public String getCourse() { return course; } public void setCourse(String course) { this.course = course; } public String getTopic() { return topic; } public void setTopic(String topic) { this.topic = topic; } public void reset(ActionMapping map,HttpServletRequest req) { this.topic=null; this.course = null; } public ActionErrors validate(ActionMapping map,HttpServletRequest req) { ActionErrors ae=new ActionErrors(); if(topic.trim().length()<=0) { ae.add("topic_req", new ActionMessage("topic_required")); } if(course.trim().length()<=0) { ae.add("course_req", new ActionMessage("course.required")); } return ae; } }


////////////////////////////////TOPIC CATALOGUTILITY/////////////////////////


package model.form;

import java.io.Serializable; import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; import java.util.HashSet;

import javax.servlet.http.HttpServletRequest;

import org.apache.struts.action.ActionErrors; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionMapping; import org.apache.struts.action.ActionMessage;

import dbopr.DBHandler; import model.form.TopicCatalog;

public class TopicCatalogUtility extends ActionForm implements Serializable{ //private String srchcriteria1; private String topic; private HashSet<String> courselist=new HashSet<String>();


public HashSet<String> getCourselist() { return courselist; } public void setCourselist(HashSet<String> courselist) { this.courselist = courselist; }

public TopicCatalogUtility searchCourse(TopicCatalogUtility tobj){ DBHandler db=new DBHandler(); boolean constatus=db.establishConnection(); if(constatus){ try{ String query="select course_name from topic where topic_name='"+topic.toUpperCase()+"'"; ResultSet rs=db.executeDRLOperation(query); courselist.clear(); while(rs.next()){ //TopicCatalog cobj=new TopicCatalog(); //cobj.setTopic(rs.getString(1)); //cobj.setCourse(rs.getString(2)); //topiclist.add(rs.getString(1)); courselist.add(rs.getString(1));


} } catch(SQLException e){ System.out.println("search course exception"+e); } } System.out.println("in utility array size"+courselist.size()); return tobj; } public ActionErrors validate(ActionMapping map,HttpServletRequest req){ ActionErrors ae=new ActionErrors(); topic=topic.trim(); if(topic.length()<=0){ ae.add("topic_err", new ActionMessage("topic.required")); } return ae; }

/*public String getSrchcriteria1() { return srchcriteria1; }

public void setSrchcriteria1(String srchcriteria1) { this.srchcriteria1 = srchcriteria1; }

public ArrayList<String> getTopiclist() { return topiclist; }

public void setTopiclist(ArrayList<String> topiclist) { this.topiclist = topiclist; }*/

public String getTopic() { return topic; }

public void setTopic(String topic) { this.topic = topic; }



}


//////////////////////////////TEST FORM////////////////////////////////


package model.form; //import java.util.ArrayList;

import java.io.Serializable;

import org.apache.struts.action.*;

public class Test extends ActionForm implements Serializable {


//private ArrayList<String> alist;

private String quest1;

   private String quest2;

private String quest3; private String quest4; private String quest5; private String topic; private String course;

   private int result;



public String getQuest1() { return quest1; } public void setQuest1(String quest1) { this.quest1 = quest1; }

public String getQuest2() { return quest2; }

public void setQuest2(String quest2) { this.quest2 = quest2; }

public String getQuest3() { return quest3; }

public void setQuest3(String quest3) { this.quest3 = quest3; }

public String getQuest4() { return quest4; }

public void setQuest4(String quest4) { this.quest4 = quest4; }

public String getQuest5() { return quest5; }

public void setQuest5(String quest5) { this.quest5 = quest5; }

public int getResult() { return result; }

public void setResult(int result) { this.result = result; }

public String getCourse() { return course; } public void setCourse(String course) { this.course = course; } public String getTopic() { return topic; } public void setTopic(String topic) { this.topic = topic; System.out.println("current topic "+this.topic); }

// public ArrayList<String> getAlist() { // return alist; // } // // public void setAlist(ArrayList<String> alist) { // this.alist = alist; // } //




}


///////////////////////////////////////TOPIC CATALOG///////////////////


/**

  Created By:-
  Team No:B-4
  Emp Id:478549
  Emp Name:Sarpharaaj Alam Sarkar
  Project Name:SABA ITP Learning Automation
    • /

package model.form;

import java.io.Serializable; import javax.servlet.http.HttpServletRequest; import org.apache.struts.action.*;

public class TopicCatalog extends ActionForm implements Serializable{ private String topic; private String course; private int chk; private int topicExistChk; private int courseExistChk;

public int getChk() { return chk; } public void setChk(int chk) { this.chk = chk; } public int getCourseExistChk() { return courseExistChk; } public void setCourseExistChk(int courseExistChk) { this.courseExistChk = courseExistChk; } public int getTopicExistChk() { return topicExistChk; } public void setTopicExistChk(int topicExistChk) { this.topicExistChk = topicExistChk; } public String getCourse() { return course; } public void setCourse(String course) { this.course = course; } public String getTopic() { return topic; } public void setTopic(String topic) { this.topic = topic; } public void reset(ActionMapping map,HttpServletRequest req) { this.topic=null; this.course = null; } public ActionErrors validate(ActionMapping map,HttpServletRequest req) { ActionErrors ae=new ActionErrors(); if(topic.trim().length()<=0) { ae.add("topic_req", new ActionMessage("topic_required")); } if(course.trim().length()<=0) { ae.add("course_req", new ActionMessage("course_required")); } return ae; } }


////////////////////////////TOPIC CATLOGUTILITY////////////////////


/**

  Created By:-
  Team No:B-4
  Emp Id:478715
  Emp Name:Sunalika Sahoo
  Project Name:SABA ITP Learning Automation
  Method:searchCourse
  Purpose:To search courses in a particular topic
  
  
    • /


package model.form;

import java.io.Serializable; import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; import java.util.HashSet;

import javax.servlet.http.HttpServletRequest;

import org.apache.struts.action.ActionErrors; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionMapping; import org.apache.struts.action.ActionMessage;

import dbopr.DBHandler; import model.form.TopicCatalog;

public class TopicCatalogUtility extends ActionForm implements Serializable{ //private String srchcriteria1; private String topic; private HashSet<String> courselist=new HashSet<String>();


public HashSet<String> getCourselist() { return courselist; } public void setCourselist(HashSet<String> courselist) { this.courselist = courselist; }

public TopicCatalogUtility searchCourse(TopicCatalogUtility tobj){ DBHandler db=new DBHandler(); boolean constatus=db.establishConnection(); if(constatus){ try{ String query="select course_name from topic where topic_name='"+topic.trim().toUpperCase()+"'"; ResultSet rs=db.executeDRLOperation(query); courselist.clear(); while(rs.next()){ //TopicCatalog cobj=new TopicCatalog(); //cobj.setTopic(rs.getString(1)); //cobj.setCourse(rs.getString(2)); //topiclist.add(rs.getString(1)); courselist.add(rs.getString(1));


} } catch(SQLException e){ System.out.println("search course exception"+e); } } System.out.println("in utility array size"+courselist.size()); return tobj; } public ActionErrors validate(ActionMapping map,HttpServletRequest req){ ActionErrors ae=new ActionErrors(); topic=topic.trim(); if(topic.equals("none")){ ae.add("topic_err", new ActionMessage("topic_required")); } return ae; }

/*public String getSrchcriteria1() { return srchcriteria1; }

public void setSrchcriteria1(String srchcriteria1) { this.srchcriteria1 = srchcriteria1; }

public ArrayList<String> getTopiclist() { return topiclist; }

public void setTopiclist(ArrayList<String> topiclist) { this.topiclist = topiclist; }*/

public String getTopic() { return topic; }

public void setTopic(String topic) { this.topic = topic; }



}



/////////////////////TOPIC LIST UTILITY/////////////////////////


/**

  Created By:-
  Team No:B-4
  Emp Id:478715
  Emp Name:Sunalika Sahoo
  Project Name:SABA ITP Learning Automation
  Method:getTopic_list
  Purpose:To retrieve Topic list from database
  
  
    • /

package model.form;

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

import org.apache.struts.action.ActionForm;

import dbopr.DBHandler;

public class TopicListUtility extends ActionForm implements Serializable{

private ArrayList<String> topicList = new ArrayList<String>();


public ArrayList<String> getTopicList() { return topicList; }


public void setTopicList(ArrayList<String> topicList) { this.topicList = topicList; }


public ArrayList<String> getTopic_list() throws SQLException { topicList.clear(); DBHandler db = new DBHandler(); boolean conExists = db.establishConnection(); String user=""; if(conExists) { String query = "select distinct topic_name from topic"; ResultSet rs = db.executeDRLOperation(query);

while(rs.next()) { user = rs.getString(1); System.out.println(user); topicList.add(user); } } return topicList; }


}



/////////////////////////REPORT UTILITY/////////////////


/**

  Created By:-
  Team No:B-4
  Emp Id:478514
  Emp Name:Sameer Kalra
  Project Name:SABA ITP Learning Automation
  Method:viewTopicReport
  Purpose:To Display the Topic-Wise Report
  • /

package model.form;

import java.io.Serializable; import java.sql.ResultSet; import java.util.ArrayList; import java.util.Date;

import javax.servlet.http.HttpServletRequest;

import org.apache.struts.action.*;

import dbopr.DBHandler;

import java.util.*;

public class TopicReport extends ActionForm implements Serializable{

private String topic; private String month; private String print; private ArrayList<Associate> alist=new ArrayList<Associate>();


public String getPrint() { return print; }

public void setPrint(String print) { this.print = print; }

   public ArrayList<Associate> getAlist() {

return alist; }

public void setAlist(ArrayList<Associate> alist) { this.alist = alist; }

public String getTopic() { return topic; }

public void setTopic(String topic) { this.topic = topic; }

public String getMonth() { return month; }

public void setMonth(String month) { this.month = month; }

public void reset(ActionMapping map,HttpServletRequest req) { this.topic=null; this.month=null; } public ActionErrors validate(ActionMapping map,HttpServletRequest req) { ActionErrors ae=new ActionErrors(); if(topic.trim().length()<=0) { ae.add("topic_req", new ActionMessage("topic_required")); } if(month.trim().length()<=0 || month.trim().equals("none")) { ae.add("month_req", new ActionMessage("month_required")); } return ae; }

public ArrayList<Associate> viewTopicReport() { DBHandler db=new DBHandler(); boolean connstatus=db.establishConnection(); if(connstatus) { String query="select * from associate,dual where topic_name = '"+topic.trim().toUpperCase()+"' and (to_char(reg_date,'mm')='"+month+"' or to_char(com_date,'mm')='"+month+"' ) and (to_char(reg_date,'yyyy')='"+(new Date().getYear() + 1900)+"' or to_char(com_date,'yyyy')='"+(new Date().getYear()+ 1900)+"')"; try{ ResultSet rs=db.executeDRLOperation(query); while(rs.next()) { Associate as=new Associate(); as.setUserid(rs.getString(1)); as.setTopic(rs.getString(2)); as.setCourse(rs.getString(3)); as.setReg_date(rs.getDate(4)); as.setCompleted_date(rs.getDate(5)); as.setClass_mark(rs.getDouble(6)); as.setWbt_mark(rs.getDouble(7)); as.setStatus(rs.getString(8)); alist.add(as); } }catch(Exception e) { System.out.println("Exception in viewTopicReport:"+e); } }

return alist;

        }

}


////////////////////////model.utility/////////////////


///////////////////ASSOCIATE UTILITY////////////////////////


/**

  Created By:-
  Team No:B-4
  Emp Id:478715
  Emp Name:Sunalika Sahoo
  Project Name:SABA ITP Learning Automation
  Method:regAssociateInfo
  Purpose:To Register Associate details related to topic registered
    • /


package model.utility;

import java.sql.ResultSet; import java.sql.SQLException;

import model.form.Associate; import dbopr.DBHandler;

public class AssociateUtility { public Associate regAssociateInfo(Associate asObj){ DBHandler db=new DBHandler(); boolean constatus=db.establishConnection(); if(constatus){ String query1=""; if(asObj.getMode().equals("wbt")){ asObj.setClass_mark(-1); query1="insert into associate values('"+asObj.getUserid().trim()+"','"+asObj.getTopic().trim().toUpperCase()+"','"+asObj.getCourse().trim().toUpperCase()+"',sysdate,default,-1,default,default)"; } else if(asObj.getMode().equals("class")) { asObj.setWbt_mark(-1); query1="insert into associate values('"+asObj.getUserid().trim()+"','"+asObj.getTopic().trim().toUpperCase()+"','"+asObj.getCourse().trim().toUpperCase()+"',sysdate,default,default,-1,default)"; }

System.out.println("reg query chkd here:"+query1); int cnt=db.executeDMLOperation(query1); System.out.println("Reg cnt is as follows:"+cnt);

if(cnt>0) { asObj.setReg_id(cnt); asObj.setStatus("Registered"); } else { //if(asObj.getMode().equals("wbt")) //{ //asObj.setStatus("wbt_Not Completed");

try{

String query2="select status,classroom_mark,wbt_mark from associate where userid='"+asObj.getUserid().trim()+"' and topic_name='"+asObj.getTopic().trim().toUpperCase()+"' and course_name='"+asObj.getCourse().trim().toUpperCase()+"'"; System.out.println("Retrieval query is:"+query2); ResultSet rs=db.executeDRLOperation(query2); while(rs.next()){ asObj.setStatus(rs.getString(1)); asObj.setClass_mark(rs.getDouble(2)); //asObj.setWbt_mark(rs.getDouble(3)); System.out.println("Registration status is:"+asObj.getStatus()); //Re } } catch(SQLException e){ System.out.println(e); }

/*} else { asObj.setStatus("cbt_Not Completed"); }*/ } System.out.println("Reg cnt set as follwos:"+asObj.getReg_id());

/*try{

String query2="select status,class_mark,wbt_mark from associate where userid='"+asObj.getUserid()+"' and topic_name='"+asObj.getTopic().toUpperCase()+"' and course_name='"+asObj.getCourse().toUpperCase()+"'"; System.out.println("Retrieval query is:"+query2); ResultSet rs=db.executeDRLOperation(query2); while(rs.next()){ asObj.setStatus(rs.getString(1)); //asObj.setClass_mark(rs.getDouble(2)); //asObj.setWbt_mark(rs.getDouble(3)); System.out.println("Registration status is:"+asObj.getStatus()); //Re } } catch(SQLException e){ System.out.println(e); }*/


} db.closeConnection(); return asObj; }


}


////////////////////////LOGIN UTILITY////////////////////////


/**

  Created By:-
  Team No:B-4
  Emp Id:478514
  Emp Name:Sameer Kalra
  Project Name:SABA ITP Learning Automation
  Method:isValid
  Purpose:To Check if the user is valid or not 
  • /

package model.utility;

import java.sql.ResultSet;

import dbopr.*; import model.form.*;

public class LoginUtility {

public boolean isValid(Login lf) { boolean flag=false;

       DBHandler db=new DBHandler();

boolean connstatus=db.establishConnection(); if(connstatus) { String query="select userid,password,name,type from login_details where userid='"+lf.getUserid().trim().toUpperCase()+"'"; try{ ResultSet rs=db.executeDRLOperation(query); if(rs.next()) { String dbuserid=rs.getString(1); String dbpwd=rs.getString(2); String dbname=rs.getString(3); String dbtype=rs.getString(4); if(dbpwd.equals(lf.getPwd())) { System.out.println(lf.getPwd()); lf.setName(dbname); lf.setType(dbtype); flag=true; } } if(flag==false) { lf.setType("unauthorized"); System.out.println("set value as unautorized chk point- "+lf.getType()); } db.closeConnection(); }catch(Exception e){System.out.println("Error in isValid "+e);} }

return flag; }

}


//////////////REPORT UTILITY//////////////////////


package model.utility;

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

import dbopr.*; import model.form.*;

public class ReportUtility {

private ArrayList<Associate> alist=new ArrayList<Associate>();

public ArrayList<Associate> getAlist() { return alist; }

public void setAlist(ArrayList<Associate> alist) { this.alist = alist; }

public ArrayList<Associate> viewAssociateReport(AssociateReport ar) { DBHandler db=new DBHandler(); boolean connstatus=db.establishConnection(); if(connstatus) { String query="select * from associate,dual where userid = '"+ar.getUserid().trim()+"' and (to_char(reg_date,'mm')='"+ar.getMonth()+"' or to_char(com_date,'mm')='"+ar.getMonth()+"' ) and to_char(sysdate,'yyyy')='"+(new java.util.Date().getYear()+ 1900); try{ ResultSet rs=db.executeDRLOperation(query); while(rs.next()) { Associate as=new Associate(); as.setUserid(rs.getString(1)); as.setTopic(rs.getString(2)); as.setCourse(rs.getString(3)); as.setReg_date(rs.getDate(4)); as.setCompleted_date(rs.getDate(5)); as.setClass_mark(rs.getDouble(6)); as.setWbt_mark(rs.getDouble(7)); as.setTotal_mark(rs.getDouble(8)); as.setStatus(rs.getString(9)); alist.add(as); } }catch(Exception e) { System.out.println("Exception in viewWordList:"+e); } }

return alist;

        }

}


////////////////////////TOPIC CATALOG UTILITY////////////////////


package model.utility;

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

import dbopr.*; import model.form.*;

public class TopicCatalogUtility {

   private ArrayList<TopicCatalog> tclist=new ArrayList<TopicCatalog>();


public ArrayList<TopicCatalog> getTc() { return tclist; } public void setTc(ArrayList<TopicCatalog> tclist) { this.tclist = tclist; }

/** Created By:- Team No:B-4 Emp Id:478715 Emp Name:Sunalika Sahoo Project Name:SABA ITP Learning Automation Method:searchCourse Purpose:To search courses in a particular topic


**/

public ArrayList<TopicCatalog> searchTopic(TopicCatalog tc) { DBHandler db=new DBHandler(); boolean connstatus=db.establishConnection(); if(connstatus) { String query="select * from topic where topic_name='"+tc.getTopic().trim().toUpperCase()+"'"; try{ ResultSet rs=db.executeDRLOperation(query); while(rs.next()) { TopicCatalog tc1=new TopicCatalog(); tc1.setTopic(rs.getString(1)); tc1.setCourse(rs.getString(2)); tclist.add(tc1);

} }catch(Exception e) { System.out.println("Exception in viewWordList:"+e); }


}

        return tclist; 

} /** Created By:- Team No:B-4 Emp Id:478596 Emp Name:Partha Ghosh Project Name:SABA ITP Learning Automation Method:addNew Purpose:To add new Course/Topic */ public TopicCatalog addNew(TopicCatalog tc) { String query = "insert into topic values('"+tc.getTopic().trim().toUpperCase()+"','"+tc.getCourse().trim().toUpperCase()+"')"; DBHandler db = new DBHandler(); boolean conExists = db.establishConnection(); if(conExists) { int chk = db.executeDMLOperation(query); tc.setChk(chk); } db.closeConnection(); return tc; } /** Created By:- Team No:B-4 Emp Id:478549 Emp Name:Sarpharaaj Alam Sarkar Project Name:SABA ITP Learning Automation Method:deleteTopic Purpose:To delete existing Topic */

   public TopicCatalog deleteTopic(TopicCatalog tcobj)throws SQLException

{ int cnt=0; String tname=tcobj.getTopic().trim().toUpperCase(); System.out.println(tname); DBHandler db=new DBHandler(); boolean connstatus=db.establishConnection(); if(connstatus) { String q = "select count(*) from topic where topic_name='"+tname+"'"; ResultSet rs = db.executeDRLOperation(q); int c=0; while(rs.next()) { c = rs.getInt(1); } tcobj.setTopicExistChk(c); if(c>0) { String query="delete from topic where topic_name='"+tname+"'"; System.out.println(query); cnt=db.executeDMLOperation(query); tcobj.setChk(cnt); System.out.println(cnt); } } db.closeConnection(); return tcobj; } /** Created By:- Team No:B-4 Emp Id:478549 Emp Name:Sarpharaaj Alam Sarkar Project Name:SABA ITP Learning Automation Method:deleteCourse Purpose:To delete existing Course */ public TopicCatalog deleteCourse(TopicCatalog tcobj)throws SQLException { int cnt=0; String cname=tcobj.getCourse().trim().toUpperCase(); String tname=tcobj.getTopic().trim().toUpperCase(); System.out.println(cname); DBHandler db=new DBHandler(); boolean connstatus=db.establishConnection(); if(connstatus) { String q = "select count(*) from topic where topic_name='"+tname+"'"; ResultSet rs = db.executeDRLOperation(q); int c=0; while(rs.next()) { c = rs.getInt(1); } tcobj.setTopicExistChk(c);

if(c>0) { String q1 = "select count(*) from topic where topic_name='"+tname+"' and course_name='"+cname+"'"; ResultSet rs1 = db.executeDRLOperation(q1); int c1=0; while(rs1.next()) { c1 = rs1.getInt(1); } tcobj.setCourseExistChk(c1); if(c1>0) { String query="delete from topic where topic_name='"+tname+"' and course_name='"+cname+"'"; System.out.println(query); cnt=db.executeDMLOperation(query); tcobj.setChk(cnt); System.out.println(cnt); } } } db.closeConnection(); return tcobj; } }


////////////////////WBT UTILITY/////////////////////


/**

  Created By:-
  Team No:B-4
  Emp Id:478458
  Emp Name:Vidit Walia
  Project Name:SABA ITP Learning Automation
  Method1:calculateMarks
  Purpose:To calculate wbt_marks obtained by wbt_test 
  Method2:updateAssociateDetails
  Purpose:To update wbt_marks obtained by wbt_test 
  
  • /


package model.utility; import dbopr.*; import java.sql.*; import java.util.ArrayList;


import model.form.*; public class WBTUtility {


public Test calculateMarks(Test t)

{ ArrayList<String>alist=new ArrayList<String>(); int count=0; DBHandler d=new DBHandler(); try{ boolean stat=d.establishConnection(); if(stat) { String quest1=t.getQuest1(); String quest2=t.getQuest2(); String quest3=t.getQuest3(); String quest4=t.getQuest4(); String quest5=t.getQuest5();


String query="select answers from test1";


ResultSet rs=d.executeDRLOperation(query); System.out.println("Hi!!!!!!!"); while(rs.next()) { System.out.println("Inside RS.NEXT");

alist.add(rs.getString(1));

}

for(int i=0;i<alist.size();i++) { if(alist.get(i).equals(quest1)) { count=count+20; } i++; if(alist.get(i).equals(quest2)) { count=count+20; } i++; if(alist.get(i).equals(quest3)) { count=count+20; }

                i++;
                if(alist.get(i).equals(quest4))
   		     {
   	             count=count+20;
   		     }
                    i++;
                    if(alist.get(i).equals(quest5))
       		     {
       	             count=count+20;
       		     }
                        i++;

}

t.setResult(count);

} } catch(SQLException e) { System.out.println(e); } d.closeConnection(); return t; }


public Associate updateAssociateDetails(Associate a) { DBHandler db = new DBHandler(); double mark = a.getWbt_mark(); if(mark>=85) { String query = "update associate set wbt_mark="+mark+", status='completed',com_date=sysdate where userId="+a.getUserid().trim()+" and topic_name='"+a.getTopic().trim().toUpperCase()+"' and course_name='"+a.getCourse().trim().toUpperCase()+"'"; System.out.println(query);

boolean conExists = db.establishConnection(); if(conExists) { int c = db.executeDMLOperation(query); a.setReg_id(c); }

} else { String query = "update associate set wbt_mark="+mark+" where userId="+a.getUserid().trim()+" and topic_name='"+a.getTopic().trim().toUpperCase()+"' and course_name='"+a.getCourse().trim().toUpperCase()+"'"; System.out.println(query); boolean conExists = db.establishConnection(); if(conExists) { int c = db.executeDMLOperation(query); a.setReg_id(c); } } db.closeConnection(); return a; }


}


////////////////////////////ACTION CLASS////////////////////


////////////////////////////ADD ACTION///////////////////


/**

  Created By:-
  Team No:B-4
  Emp Id:478596
  Emp Name:Partha Ghosh
  Project Name:SABA ITP Learning Automation
  • /

package ctrlr.action;

import java.io.IOException; import java.sql.SQLException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import model.form.TopicCatalog; import model.utility.TopicCatalogUtility; import org.apache.struts.action.Action; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping;

public class AddAction extends Action { public ActionForward execute(ActionMapping map, ActionForm form, HttpServletRequest req, HttpServletResponse resp)throws IOException,SQLException { TopicCatalog tc = (TopicCatalog)form; TopicCatalogUtility tut = new TopicCatalogUtility(); tc = tut.addNew(tc); return map.findForward("addout"); } }


////////////////////////////ADD MARK ACTION///////////////


/**

  Created By:-
  Team No:B-4
  Emp Id:478596
  Emp Name:Partha Ghosh
  Project Name:SABA ITP Learning Automation
  • /

package ctrlr.action;

import java.io.IOException; import java.sql.SQLException;

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

import model.form.AssociateUtility;

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

public class AddMarkAction extends Action{

public ActionForward execute(ActionMapping map, ActionForm form, HttpServletRequest req, HttpServletResponse resp)throws IOException, ServletException, SQLException { AssociateUtility asu = (AssociateUtility)form; asu=asu.addmark(asu); String id = asu.getUserid(); asu.setUserid("none"); HttpSession hs = req.getSession(true); hs.setAttribute("userid",id );

return map.findForward("addmark"); }

}


//////////ADD MARK1///////////////


/**

  Created By:-
  Team No:B-4
  Emp Id:478596
  Emp Name:Partha Ghosh
  Project Name:SABA ITP Learning Automation
  • /

package ctrlr.action;

import java.io.IOException;

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

import model.form.AssociateUtility;

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

public class AddMarkAction1 extends Action{

public ActionForward execute(ActionMapping map, ActionForm form, HttpServletRequest req, HttpServletResponse resp)throws IOException, ServletException { AssociateUtility asu = (AssociateUtility)form; HttpSession hs = req.getSession(true); String id = (String)hs.getAttribute("userid"); asu.setUserid(id); asu=asu.addmark1(asu); System.out.println("AddAction 1"); System.out.println("mark "+asu.getMark()); System.out.println("userid "+asu.getUserid()); return map.findForward("addmark1"); }

}


///////////////////ASSOCIATE ACTION////////////


/**

  Created By:-
  Team No:B-4
  Emp Id:478715
  Emp Name:Sunalika Sahoo
  Project Name:SABA ITP Learning Automation
  • /

package ctrlr.action;

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

import model.form.Associate; import model.utility.AssociateUtility;

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

public class AssociateAction extends Action{ String option=""; public ActionForward execute(ActionMapping map, ActionForm form, HttpServletRequest req, HttpServletResponse resp) throws Exception { HttpSession hs=req.getSession(true); Associate asObj=(Associate)form; asObj.setUserid((String)hs.getAttribute("userid")); AssociateUtility utilityobj=new AssociateUtility(); System.out.println("Regd as topic:"+asObj.getTopic()); System.out.println("Regd as course:"+asObj.getCourse()); asObj=utilityobj.regAssociateInfo(asObj);

String topic = asObj.getTopic(); String course = asObj.getCourse(); System.out.println("Ass Action "+topic); System.out.println("Ass ACtion "+course);


HttpSession hs1 = req.getSession(true); hs1.setAttribute("topic", topic); hs1.setAttribute("course", course);


if(asObj.getReg_id()>0) { /*if(asObj.getClass_mark()==-1){ option="regsuccess1"; System.out.println("success wbt....1...class mark..."+asObj.getClass_mark()); } else{ option="regsuccess2"; System.out.println("success class ....1...wbt mark..."+asObj.getWbt_mark()); }*/ if(asObj.getMode().equals("wbt")) { option="regd_wbt"; } else { option="regd_cbt"; } }

else{ if((asObj.getMode().equals("wbt")) && (asObj.getStatus().equals("registered")) && (asObj.getClass_mark()==-1)) { asObj.setStatus("wbt_Not Completed"); } option="regfailure"; System.out.println("failure....1...wbt mark"+asObj.getWbt_mark()); System.out.println("failure....1...class mark"+asObj.getClass_mark()); }

return map.findForward(option); }

}


//////////////////ASSOCIATE DETAIL ACTION////////////////


/**

  Created By:-
  Team No:B-4
  Emp Id:478596
  Emp Name:Partha Ghosh
  Project Name:SABA ITP Learning Automation
  • /

package ctrlr.action;

import java.io.IOException; import java.sql.SQLException;

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

import model.form.AssociateDetailsUtility;

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

public class AssociateDetailsAction extends Action{

public ActionForward execute(ActionMapping map, ActionForm form, HttpServletRequest req, HttpServletResponse resp)throws IOException,ServletException, SQLException { AssociateDetailsUtility asdu = (AssociateDetailsUtility)form; asdu.getUserList(); return map.findForward("addclmark"); }

}



////////////////////ASSOCIATE REPORT ACTION//////////////


/**

  Created By:-
  Team No:B-4
  Emp Id:478514
  Emp Name:Sameer Kalra
  Project Name:SABA ITP Learning Automation
  • /

package ctrlr.action;

import org.apache.struts.action.*;

import javax.servlet.*; import javax.servlet.http.*; import java.io.*; import model.form.*; import java.util.*;


public class AssociateReportAction extends Action{

public ActionForward execute(ActionMapping map,ActionForm form,HttpServletRequest req,HttpServletResponse resp) throws IOException,ServletException { AssociateReport ar=(AssociateReport)form; ArrayList<Associate> aslist=ar.viewAssociateReport(); System.out.println(aslist); return map.findForward("associatelist"); }


}


////////////////////DELETE COURSE ACTION/////////////////


/**

  Created By:-
  Team No:B-4
  Emp Id:478549
  Emp Name:Sarpharaaj Alam Sarkar
  Project Name:SABA ITP Learning Automation
    • /

package ctrlr.action;

import java.io.*; import java.sql.SQLException; import model.form.TopicCatalog; import model.utility.TopicCatalogUtility; import org.apache.struts.action.*; import javax.servlet.http.*; import javax.servlet.*;

public class DeleteCourseAction extends Action { public ActionForward execute(ActionMapping map, ActionForm form, HttpServletRequest req, HttpServletResponse resp)throws IOException, ServletException, SQLException { TopicCatalog tc= (TopicCatalog)form; TopicCatalogUtility tcu = new TopicCatalogUtility(); tcu.deleteCourse(tc); return map.findForward("delcourse"); } }



//////////////////DELETE TOPIC ACTION/////////////////


/**

  Created By:-
  Team No:B-4
  Emp Id:478549
  Emp Name:Sarpharaaj Alam Sarkar
  Project Name:SABA ITP Learning Automation
    • /

package ctrlr.action; import java.io.*; import java.sql.SQLException; import model.form.TopicCatalog; import model.utility.TopicCatalogUtility; import org.apache.struts.action.*; import javax.servlet.http.*; import javax.servlet.*;

public class DeleteTopicAction extends Action { public ActionForward execute(ActionMapping map, ActionForm form, HttpServletRequest req, HttpServletResponse resp)throws IOException, ServletException, SQLException { TopicCatalog tc = (TopicCatalog)form; TopicCatalogUtility tcu = new TopicCatalogUtility(); tcu.deleteTopic(tc); return map.findForward("deltopic"); } }


////////////////////LOGIN ACTION//////////////////


/**

  Created By:-
  Team No:B-4
  Emp Id:478514
  Emp Name:Sameer Kalra
  Project Name:SABA ITP Learning Automation
  • /

package ctrlr.action;

import org.apache.struts.action.*; import javax.servlet.*; import javax.servlet.http.*; import java.io.*; import model.form.*; import model.utility.*;

public class LoginAction extends Action{

public ActionForward execute(ActionMapping map,ActionForm form,HttpServletRequest req,HttpServletResponse resp) throws IOException,ServletException { Login lf=(Login)form; LoginUtility lu=new LoginUtility(); boolean res=lu.isValid(lf); if(res) { System.out.println(res); String type=lf.getType(); HttpSession hs=req.getSession(true); hs.setAttribute("name",lf.getName()); if(type.equals("associate")) { return map.findForward("associate"); } else { return map.findForward("admin"); } } else return map.findForward("unauthorized");

}

}



////////////////////////SHOW DETAILS ACTION/////////////////////


/**

  Created By:-
  Team No:B-4
  Emp Id:478454
  Emp Name:Geeta Pargai
  Project Name:SABA ITP Learning Automation
    • /

package ctrlr.action; import javax.servlet.http.*;

import model.form.Associate; import model.form.AssociateUtility;

import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionMapping; import org.apache.struts.action.Action; import java.io.*; import java.util.ArrayList;

import javax.servlet.*;


public class ShowDetailsAction extends Action{ public ActionForward execute(ActionMapping map,ActionForm form,HttpServletRequest req,HttpServletResponse resp)throws IOException,ServletException { HttpSession hs=req.getSession(true); AssociateUtility auObj=(AssociateUtility)form; auObj.setUserid((String)hs.getAttribute("userid")); ArrayList<Associate> aslist=auObj.showDetails(); System.out.println(aslist); return map.findForward("details"); } }



//////////////////////TEST ACTION///////////////////////////


/**

  Created By:-
  Team No:B-4
  Emp Id:478458
  Emp Name:Vidit Walia
  Project Name:SABA ITP Learning Automation
  • /

package ctrlr.action;


import model.form.*; import model.utility.*;

import org.apache.struts.action.*; import java.io.*; import javax.servlet.*; import javax.servlet.http.*; public class TestAction extends Action{

public ActionForward execute(ActionMapping map, ActionForm form, HttpServletRequest req, HttpServletResponse resp) throws IOException,ServletException { HttpSession hs=req.getSession(true); String id=(String)hs.getAttribute("userid"); Test t =(Test)form; Associate as = new Associate(); WBTUtility wbu =new WBTUtility(); t= wbu.calculateMarks(t); int wbtmark = t.getResult(); String topic = t.getTopic(); String course = t.getCourse(); as.setUserid(id); as.setWbt_mark(wbtmark); as.setTopic(topic); as.setCourse(course); wbu.updateAssociateDetails(as); return map.findForward("testoutput"); }

}



////////////////////////////TOPIC LIST ACTION//////////////////////



/**

  Created By:-
  Team No:B-4
  Emp Id:478715
  Emp Name:Sunalika Sahoo
  Project Name:SABA ITP Learning Automation
 
    • /

package ctrlr.action;

import java.io.IOException; import java.sql.SQLException;

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

import model.form.AssociateDetailsUtility; import model.form.TopicListUtility;

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

public class TopicListAction extends Action {

public ActionForward execute(ActionMapping map, ActionForm form, HttpServletRequest req, HttpServletResponse resp)throws IOException,ServletException, SQLException { TopicListUtility tu = (TopicListUtility)form; tu.getTopic_list(); return map.findForward("searchtopic"); }

}



///////////////////////////TOPIC REPORT ACTION/////////////////////////////


/**

  Created By:-
  Team No:B-4
  Emp Id:478514
  Emp Name:Sameer Kalra
  Project Name:SABA ITP Learning Automation
  • /

package ctrlr.action;

import org.apache.struts.action.*;

import javax.servlet.*; import javax.servlet.http.*; import java.io.*; import model.form.*; import model.utility.*; import java.util.*;


public class TopicReportAction extends Action{

public ActionForward execute(ActionMapping map,ActionForm form,HttpServletRequest req,HttpServletResponse resp) throws IOException,ServletException { TopicReport ar=(TopicReport)form; ArrayList<Associate> aslist=ar.viewTopicReport(); return map.findForward("topiclist"); }

}



/////////////////////////////TOPIC SEARCH ACTION/////////////////////


/**

  Created By:-
  Team No:B-4
  Emp Id:478715
  Emp Name:Sunalika Sahoo
  Project Name:SABA ITP Learning Automation
  • /

package ctrlr.action;

import java.util.ArrayList;

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

import model.form.TopicCatalog; import model.form.TopicCatalogUtility;

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

public class TopicSearchAction extends Action{


@Override public ActionForward execute(ActionMapping map, ActionForm form, HttpServletRequest req, HttpServletResponse resp) throws Exception { //TopicCatalog topicObj=(TopicCatalog)form; TopicCatalogUtility tu_obj=(TopicCatalogUtility)form; tu_obj=tu_obj.searchCourse(tu_obj); //System.out.println("arrlist size"+topic_list.size()); return map.findForward("searchlist"); }

}



//////////////////////////////TOPIC SEARCH ACTION1///////////////////


package ctrlr.action;

import org.apache.struts.action.*;

import javax.servlet.*; import javax.servlet.http.*;

import java.io.*; import java.util.ArrayList;

import model.form.*; import model.utility.TopicCatalogUtility;;

public class TopicSearchAction1 extends Action{

public ActionForward execute(ActionMapping map,ActionForm form,HttpServletRequest req,HttpServletResponse resp) throws IOException,ServletException {

TopicCatalog tc=(TopicCatalog)form; TopicCatalogUtility tcu=new TopicCatalogUtility(); ArrayList<TopicCatalog> tclist=tcu.searchTopic(tc); return map.findForward("searchout"); } }