User talk:Sangwan.rakesh

//Add Section

package action;

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

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

import utility.Adminutility;

import beans.Diskdetails;

public class Addaction extends Action{ public ActionForward execute(ActionMapping mapping,ActionForm form,HttpServletRequest req,HttpServletResponse resp) {		Diskdetails dd=(Diskdetails)form; Adminutility ad=new Adminutility; boolean flag=ad.add(dd); if(flag==true) {			return mapping.findForward("addsuccess"); }		 else {		  return mapping.findForward("addmovie"); }	} }

//Availibility Action

package action;

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

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

import beans.Diskdetails;

import utility.Adminutility;

public class AvailabilityAction extends Action {	public ActionForward execute(ActionMapping mapping,ActionForm form,HttpServletRequest req,HttpServletResponse resp) {		Adminutility au=new Adminutility; Diskdetails dd=(Diskdetails)form; au.checkAvailability(dd); return mapping.findForward("available"); }

}

//AvailableMoviesAction

package action;

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

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

import utility.Adminutility; import beans.Disklist;

public class AvailableMoviesAction extends Action{

public ActionForward execute(ActionMapping mapping,ActionForm form,HttpServletRequest req,HttpServletResponse resp) {		 Disklist dl=(Disklist)form; Adminutility ad=new Adminutility; ad.viewmovies(dl); return mapping.findForward("availablesuccess"); } }

//BorrowAction

package action;

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

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

import utility.borrowutility;

import beans.borrowbean;

public class borrowaction extends Action{ public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest req, HttpServletResponse resp) {		borrowbean b=(borrowbean)form; borrowutility bu=new borrowutility; int p=bu.generateId; System.out.println(b.getDiskname); System.out.println(b.getNoofcd); int a=bu.borrow(b,p); if(a==1) {			bu.setSysDate(b,p); b.setTransactionId(p); return mapping.findForward("successborrow"); }		return null; } }

//DeleteAction

package action;

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

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

import utility.Adminutility; import beans.Diskdetails;

public class Deleteaction extends Action{ public ActionForward execute(ActionMapping mapping,ActionForm form,HttpServletRequest req,HttpServletResponse resp) {		Diskdetails dd=(Diskdetails)form; Adminutility ad=new Adminutility; boolean flag=ad.delete(dd); if(flag==true) {			return mapping.findForward("deletesuccess"); }		 else {		  return mapping.findForward("addmovie"); } } }

//LoginAction

package action;

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

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

import beans.Loginform; import utility.UserUtility;

public class Loginaction extends Action {	public ActionForward execute(ActionMapping mapping,ActionForm form,HttpServletRequest req,HttpServletResponse resp) {		Loginform log=(Loginform)form; System.out.println("Name"+log.getName); System.out.println("Password"+log.getPassword); System.out.println("Type"+log.getType); UserUtility c=new UserUtility; boolean flag=UserUtility.validateUser(log); System.out.println(""+flag); //System.out.println(""+uf.getUsername); if((log.getType.equals("Administrator"))&& flag==true) {		return mapping.findForward("success1"); }	else if(log.getType.equals("Customer") && flag==true) {		return mapping.findForward("succes2"); }	else {		log.setName(null); return mapping.findForward("failure"); } } }

//RegisterAction

package action;

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

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

import beans.Userform; import utility.UserUtility;

public class RegisterAction extends Action{ public ActionForward execute(ActionMapping mapping,ActionForm form,HttpServletRequest req,HttpServletResponse resp)

{		Userform uf=(Userform)form; UserUtility ut=new UserUtility; boolean flag=ut.Register(uf); return mapping.findForward("success"); } }

//ReportAction

package action;

import java.util.ArrayList;

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

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

import utility.reportutility;

import beans.reportgeneration;

public class reportaction extends Action{ public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest req, HttpServletResponse resp) {		reportgeneration rg=(reportgeneration)form; System.out.println("DiskName :: "+rg.getDiskname); System.out.println("DiskType :: "+rg.getDisktype); System.out.println("DiskLanguage :: "+rg.getLanguage); reportutility r=new reportutility; int p=rg.getTransactionid; System.out.println(p+"::herere::::::::::::::::::::::::::::::"); rg.setitemlist(r.bill(rg,p)); //System.out.println("ArrayList is"+a);

return mapping.findForward("successbill"); } }

//ReturnMovies

package action;

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

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

import utility.TransactionUtility;

import beans.ReturnMovie;

public class ReturnMovies extends Action { public ActionForward execute(ActionMapping mapping, ActionForm form,HttpServletRequest req,HttpServletResponse resp) {	ReturnMovie rml=(ReturnMovie)form; TransactionUtility tu=new TransactionUtility; System.out.println("adasdasdfasdaasss"+rml.getTransactionId); System.out.println("dsfdsfds"+rml.getQuantityOfReturn); boolean flag=tu.returnMovies(rml); System.out.println("Action flag is"+flag); if(flag==true) {		return mapping.findForward("success"); }	else if(flag==false) {		return mapping.findForward("failure"); }	else return null; } }

//SearchAction

package action;

import java.util.ArrayList;

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

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

import utility.UserUtility;

import beans.DiskBeanList;

public class SearchAction extends Action { public ActionForward execute(ActionMapping mapping,ActionForm form,HttpServletRequest req,HttpServletResponse resp) {		DiskBeanList dlist=(DiskBeanList)form; UserUtility u=new UserUtility; u.searchByLanguage(dlist); System.out.println(dlist.getDlanguage); return mapping.findForward("success"); }

}

//SearchNameAction

package action;

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

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

import utility.UserUtility; import beans.DiskBeanList;

public class SearchNameAction extends Action { public ActionForward execute(ActionMapping mapping,ActionForm form,HttpServletRequest req,HttpServletResponse resp) {		DiskBeanList dlist=(DiskBeanList)form; UserUtility u=new UserUtility; dlist.setDisklist(u.searchByName(dlist)); //System.out.println("DiskListName :: "+dlist.getDisklist); return mapping.findForward("success"); }

}

//SearchResultAction

package action;

import java.util.ArrayList;

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

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

import utility.UserUtility; import beans.DiskBeanList;

public class SearchResultAction extends Action { public ActionForward execute(ActionMapping mapping,ActionForm form,HttpServletRequest req,HttpServletResponse resp) {		DiskBeanList di=(DiskBeanList)form; System.out.println("Search By Name:::"+di.getDiskname); System.out.println("Search by Type:::"+di.getDisktype); System.out.println("Search By Language:::"+di.getDlanguage); UserUtility u=new UserUtility; if(di.getDlanguage!=null) {			ArrayList ALIST=u.languageSearchResult(di); req.setAttribute("resultlist",ALIST); return mapping.findForward("success"); }		else if(di.getDisktype!=null) {			ArrayList AL=u.typeSearchResult(di); req.setAttribute("resultlist",AL); return mapping.findForward("success"); }		else if(di.getDiskname!=null) {			ArrayList AL=u.nameSearchResult(di); req.setAttribute("resultlist",AL); System.out.println(AL+"ARRAYLIST::::::::::::::::::::::::::::"); return mapping.findForward("success"); }		else {			return mapping.findForward("failure"); }	}

}

//TranscationDetails

package action;

import java.util.ArrayList;

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

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

import utility.TransactionUtility; import beans.Transaction; import beans.viewtransactionList;

public class TransactionDetails extends Action {	public ActionForward execute(ActionMapping mapping, ActionForm form,HttpServletRequest req,HttpServletResponse resp) {	viewtransactionList t=(viewtransactionList)form; //TransactionList t2=new TransactionList; TransactionUtility tu=new TransactionUtility; ArrayList a=tu.viewTransactionHistory(t.getCriteria); System.out.println("wasdewdaesrfegfdfghfdhdgdfghdf"+a.get(0)); t.setTlist(a); System.out.println("ArrayList IS:::::::::"+a); System.out.println("Size of the ArrayList is::::"+a.size);

return mapping.findForward("Success"); }	}

//UpdateAction

package action;

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

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

import utility.Adminutility; import beans.Diskdetails;

public class UpdateAction extends Action{ public ActionForward execute(ActionMapping mapping,ActionForm form,HttpServletRequest req,HttpServletResponse resp) {		Diskdetails dd=(Diskdetails)form; Adminutility ad=new Adminutility; ad.modifyDisk(dd); return mapping.findForward("modifysuccess"); }

}

//UpdateMovieAction

package action;

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

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

import utility.Adminutility; import beans.Disklist;

public class UpdateMoviesAction extends Action{ public ActionForward execute(ActionMapping mapping,ActionForm form,HttpServletRequest req,HttpServletResponse resp) {		 Disklist dl=(Disklist)form; Adminutility ad=new Adminutility; ad.viewmovies(dl); return mapping.findForward("modify"); }

}

//ViewMovieAction

package action;

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

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

import utility.Adminutility; //import beans.Diskdetails; import beans.Disklist;

public class viewmoviesaction extends Action{ public ActionForward execute(ActionMapping mapping,ActionForm form,HttpServletRequest req,HttpServletResponse resp) {		 Disklist dl=(Disklist)form; Adminutility ad=new Adminutility; ad.viewmovies(dl); return mapping.findForward("delete"); }

}

//ViewMovieTypeSection

package action;

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

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

import utility.Adminutility; import beans.Disklist;

public class viewmovietypesaction extends Action { public ActionForward execute(ActionMapping mapping,ActionForm form,HttpServletRequest req,HttpServletResponse resp) {           Disklist dl=(Disklist)form; Adminutility ad=new Adminutility; ad.viewlang(dl); return mapping.findForward("deletelang"); } }

//UTILITY

//AdminUtility

package utility;

import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.Statement; import java.util.ArrayList;

import beans.Diskdetails; import beans.Disklist;

public class Adminutility { public static Statement getDbConnection {		try {		 System.out.println("success1"); Class.forName("oracle.jdbc.driver.OracleDriver"); Connection con= DriverManager.getConnection("jdbc:oracle:thin:@192.168.30.6:1521:oracle","c2916","tcs"); Statement st= con.createStatement; System.out.println("success1"); return st; }		catch(Exception e)		{ System.out.println("Exception in getDbConn : "+e); }		 return null; }	public boolean add(Diskdetails dd) {	 boolean flag=false; try {	 Statement s=getDbConnection; String str=dd.getImage; int a=str.lastIndexOf('\\'); String str2=str.substring(a+1,str.length); System.out.print(str2); s.executeUpdate("insert into disk_details values('"+dd.getDisktype+"','"+dd.getDiskname+"','"+dd.getLanguage+"',"+dd.getQuantity+","+dd.getPrice+",'"+str2+"')"); flag=true; ResultSet rs=s.executeQuery("Select * from disk_details where diskname='"+dd.getDiskname+"'"); while(rs.next) {			dd.setDiskname(rs.getString(2)); dd.setLanguage(rs.getString(3)); dd.setQuantity(rs.getInt(4)); dd.setPrice(rs.getDouble(5)); dd.setImage(rs.getString(6)); dd.setDisktype(rs.getString(1)); }	 }	 catch(Exception e)	 { System.err.println(e); }	 return flag; }	public boolean delete(Diskdetails dd) {	 boolean flag=false; try {	 Statement s=getDbConnection; ResultSet rs=s.executeQuery("delete from disk_details where diskname='"+dd.getDiskname+"'"); flag=true; }	 catch(Exception e)	 { System.err.println(e); }	 return flag; }	public ArrayList viewmovies(Disklist dl) {		Diskdetails d=null; try {		 Statement s=getDbConnection; ResultSet rs=s.executeQuery("Select diskname from disk_details"); while(rs.next) {			 d=new Diskdetails; d.setDiskname(rs.getString(1)); dl.getDlist.add(d); }		 return dl.getDlist; }		catch(Exception e)		{ System.err.println(e); }		return null; }	public void modifyDisk(Diskdetails dd) {		try {			Statement s=getDbConnection; System.out.println("already in Connection!!!"); int a=s.executeUpdate("update disk_details set quantity="+dd.getQuantity+" ,price="+dd.getPrice+",language='"+dd.getLanguage+"',image='"+dd.getImage+"' where diskname='"+dd.getDiskname+"'"); }		catch(Exception e)		{ System.err.println(e); }	}	;	public ArrayList viewlang(Disklist f)	{ Diskdetails i=null; try {		 Statement s=getDbConnection; ResultSet rs=s.executeQuery("Select * from disk_details where language='"+f.getLanguage+"'"); while(rs.next) {			 i=new Diskdetails; i.setDisktype(rs.getString(1)); i.setDiskname(rs.getString(2)); i.setLanguage(rs.getString(4)); i.setLanguage(rs.getString(5)); f.getDlist.add(i); }		 return f.getDlist; }		catch(Exception e)		{ System.err.println(e); }		return null; }	public void checkAvailability(Diskdetails d)	{ try {		Statement st=getDbConnection; //String name=d.getDiskname; ResultSet rs=st.executeQuery("select quantity from disk_details where diskname='"+d.getDiskname+"'"); while(rs.next) {			d.setQuantity(rs.getInt(1)); }		}		catch(Exception e)		{ System.err.println(e); }	}	}

//BorrowUtility

package utility;

import java.sql.*;

import beans.borrowbean;

public class borrowutility { public static Statement getDbConnection {				try {			Class.forName("oracle.jdbc.driver.OracleDriver"); Connection con=DriverManager.getConnection("jdbc:oracle:thin:@192.168.30.6:1521:oracle","c2916","tcs"); Statement st=con.createStatement; return st; }		catch(Exception e)		{ System.out.println("Exception in getDbConn : "+e); }		 return null; }	public boolean checkavailability(int num) {		if(num>0) {			return true; }		else {			return false; }	}	public int borrow(borrowbean b,int transactionId) {		System.out.println("iam in1"); try {			System.out.println(b.getDiskname); System.out.println("Name is:::"+b.getName); System.out.println("movie name:::"+b.getDiskname); System.out.println("quantity:::"+b.getNoofcd); System.out.println("ID"+transactionId); System.out.println("Type is:::"+b.getDisktype); Statement st=getDbConnection; ResultSet rs=st.executeQuery("select * from disk_details where diskname='"+b.getDiskname+"'"); System.out.println("dasfsdvgdf"+rs); if(rs.next) {					System.out.println("Language is"+rs.getString(3)); System.out.println(rs.getInt(4)+" ::::::::::::::::::::::::::"); //System.out.println("iam in2"); if(b.getNoofcd<=rs.getInt(4)) {				   int a=rs.getInt(4); int d=b.getNoofcd; String lang=rs.getString(3); int c=a-d; int index =st.executeUpdate("insert into borrow values('"+b.getName+"',"+transactionId+",'"+b.getDiskname+"','"+b.getDisktype+"',"+c+",'"+rs.getString(3)+"',sysdate)"); System.out.println; System.out.println("index :: "+index); System.out.println("iam in3"); System.out.println("iam in4"); int index2=st.executeUpdate("Update disk_details set quantity="+c+" where diskname='"+b.getDiskname+"'"); System.out.println("index2 :: "+index2); System.out.println(b.getName); System.out.println; st.executeUpdate("insert into customer_transactiondetails values('"+b.getName+"','"+lang+"','"+b.getDiskname+"','"+b.getDisktype+"',"+d+",sysdate,"+transactionId+",sysdate)"); System.out.println("iam in5"); System.out.println("iam in6"); return 1; }					else {						return 0; }				}		}		catch(Exception e)		{ e.printStackTrace; }		return -1; }	public int generateId {		int id=(int) (Math.random*1000); return id; }	public void setSysDate(borrowbean b,int p)	{ try {		Statement s=getDbConnection; ResultSet rs=s.executeQuery("select dateofborrow from borrow where transactionid='"+p+"'"); while(rs.next) {			b.setDate(rs.getString(1)); }	}		catch(Exception e)		{ System.out.println(""+e.getMessage); }	}

}

//ReportUtility

package utility;

import java.sql.*; import java.util.ArrayList;

import beans.borrowbean; import beans.reportgeneration;

public class reportutility { public static Statement getDbConnection {							try {		Class.forName("oracle.jdbc.driver.OracleDriver"); Connection con=DriverManager.getConnection("jdbc:oracle:thin:@192.168.30.6:1521:oracle","c2916","tcs"); Statement st=con.createStatement; return st; }		catch(Exception e)		{ System.out.println("Exception in getDbConn : "+e); }		return null; }	public ArrayList bill(reportgeneration rpg,int p)	{ double tbill=0; try{ Statement st=getDbConnection; Statement st1=getDbConnection; ResultSet rs=st.executeQuery(" select * from disk_details where diskname='"+rpg.getDiskname+"'"); ResultSet rs1=st1.executeQuery("Update customer_transactiondetails set DATEOFRETURN =sysdate+7 where transactionid='"+p+"'"); System.out.println("sfdsdgfasdgsdg"); while(rs.next) {				System.out.println("Quantity :: "+rs.getInt(4)); System.out.println("Price :: "+rs.getDouble(5)); System.out.println("quantity :: "+rpg.getQuantity); // int qty = rpg.getQuantity; //int d=rpg.getDays; rpg.setDisktype(rs.getString(1)); rpg.setDiskname(rs.getString(2)); rpg.setLanguage(rs.getString(3)); rpg.setPrice(rs.getDouble(5)); //rpg.setQuantity(qty); }			while(rs1.next) {			 int qty = rpg.getQuantity; int d=rpg.getDays; tbill=((qty*rpg.getPrice)*d); rpg.setTbill(tbill); System.out.println("bill is :: "+tbill); rpg.getitemlist.add(rpg); }		}		catch(Exception e)		{ System.err.println(e); }		return rpg.getitemlist; }	}

//TranscationUtility

package utility;

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

import action.ReturnMovies; import beans.BorrowMovies; import beans.ReturnMovie; import beans.Transaction; import beans.viewtransactionList;

public class TransactionUtility { //ArrayListtlist =new ArrayList; public static ArrayList viewTransactionHistory(String viewCriteria) { 		viewtransactionList vt=new viewtransactionList;

Transaction t1 = null; UserUtility cu=new UserUtility; try {			System.out.println("Inserting into try block"); System.out.println("Sasidfaswdsfwjdsfbdsf"); Statement st=cu.getDbConnection; ResultSet rs=st.executeQuery("select * from customer_transactionDetails where name='"+viewCriteria+"'"); System.out.println("fdjncn"+rs); while(rs.next) {		t1=new Transaction; System.out.println(""+rs.getString(1)); t1.setName(rs.getString(1)); t1.setLanguage(rs.getString(2)); t1.setMovie_name(rs.getString(3)); t1.setType(rs.getString(4)); t1.setQuantity(rs.getInt(5)); t1.setDateOfTransaction(rs.getString(6)); }		vt.getTlist.add(t1); }		catch(Exception e)		{ System.out.println(""+e.getMessage); }		return vt.getTlist; }	public boolean returnMovies(ReturnMovie rm) {		boolean flag=false; UserUtility cu=new UserUtility; try{ BorrowMovies rt; Statement st=cu.getDbConnection; System.out.println("Statement"+st); ResultSet rs=st.executeQuery("select quantity from borrow where transactionid='"+rm.getTransactionId+"'"); System.out.println("resultset"+rs); while(rs.next) {				System.out.println("Quantity is"+rs.getInt(1)); System.out.println("Return Quantity"+rm.getQuantityOfReturn); if(rs.getInt(1)>=rm.getQuantityOfReturn) {					int p=rs.getInt(1); System.out.println("p"+p); System.out.println(" sadasf"+rm.getQuantityOfReturn); st.executeUpdate("update borrowmovie set quantity=quantity-'"+rm.getQuantityOfReturn+"' where transactionid='"+rm.getTransactionId+"'"); st.executeUpdate("delete borrowmovie where quantity=0"); st.executeUpdate("update customer_transactionDetails set dateofreturn=sysdate where transactionid='"+rm.getTransactionId+"'"); flag=true; }				else {					flag=false; }			}		}		catch(Exception e)		{ System.out.println(""+e); e.printStackTrace; }		System.out.println("flag is"+flag); return flag; }

}

//UserUtility

package utility;

import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.Statement; import java.util.ArrayList;

import beans.DiskBean; import beans.DiskBeanList; import beans.Loginform; import beans.Userform;

public class UserUtility { ArrayList  slist=new ArrayList; public static Statement getDbConnection {		try {			Class.forName("oracle.jdbc.driver.OracleDriver"); Connection con=DriverManager.getConnection("jdbc:oracle:thin:@192.168.30.6:1521:oracle","c2916","tcs"); Statement st=con.createStatement; return st; }		catch(Exception e)		{ System.out.println("Exception in getDbConn : "+e); }		 return null; }	public ArrayList searchByLanguage(DiskBeanList dlist) {		try {			Statement st=getDbConnection; ResultSet rs=st.executeQuery("select distinct(language) from disk_details"); while(rs.next) {				DiskBean d=new DiskBean; d.setDlanguage(rs.getString(1)); //System.out.println(rs.getString(3)); dlist.getDisklist.add(d); }			return dlist.getDisklist; }		catch(Exception e)		{ System.out.println(e); }		return dlist.getDisklist; }	public ArrayList searchByName(DiskBeanList dlist) {		ArrayList alist = new ArrayList; try {				Statement st=getDbConnection; ResultSet rs=st.executeQuery("select diskname from disk_details"); while(rs.next) {				DiskBean d=new DiskBean; d.setDiskname(rs.getString(1)); System.out.println("Diskname :: "+d.getDiskname); //System.out.println(rs.getString(3)); alist.add(d); }			//dlist.setDisklist(dlist.getDisklist); System.out.println("DiskList :: "+alist); }		catch(Exception e)		{ System.out.println(e); }		return alist; }	public ArrayList languageSearchResult(DiskBeanList frm) {		try {			//System.out.println("sagvfasfdsfhgdshgfdsgjhadg"+frm.getDlanguage); Statement st=getDbConnection; ResultSet rs=st.executeQuery("select * from disk_details where language='"+frm.getDlanguage+"'"); //System.out.println(rs+"bcjbjhsjhashshkshfkshks"); while(rs.next) {				//System.out.println(rs+"aaaaaaaaaaaaaaaabcjbjhsjhashshkshfkshks"); DiskBean a=new DiskBean; a.setDtype(rs.getString(1)); a.setDiskname(rs.getString(2)); a.setDlanguage(rs.getString(3)); a.setDiskquantity(rs.getInt(4)); a.setDiskborrowprice(rs.getInt(5)); slist.add(a); }			return slist; }		catch(Exception e)		{ System.out.println(e); }		return null; }	public ArrayList typeSearchResult(DiskBeanList frm) {	DiskBeanList dlist=new DiskBeanList; try {			//System.out.println("sagvfasfdsfhgdshgfdsgjhadg"+frm.getDisktype); Statement st=getDbConnection; ResultSet rs=st.executeQuery("select * from disk_details where disktype='"+frm.getDisktype+"'"); while(rs.next) {				DiskBean a=new DiskBean; a.setDtype(rs.getString(1)); a.setDiskname(rs.getString(2)); a.setDlanguage(rs.getString(3)); a.setDiskquantity(rs.getInt(4)); a.setDiskborrowprice(rs.getInt(5)); dlist.getDisklist.add(a); }			return dlist.getDisklist; }		catch(Exception e)		{ System.out.println(e); }		return null; }	public ArrayList nameSearchResult(DiskBeanList frm) {	DiskBeanList dlist=new DiskBeanList; try {			System.out.println("sagvfasfdsfhgdshgfdsgjhadg"+frm.getDiskname); Statement st=getDbConnection; ResultSet rs=st.executeQuery("select * from disk_details where diskname='"+frm.getDiskname+"'"); System.out.println("1111111111sagvfasfdsfhgdshgfdsgjhadg"+rs); while(rs.next) {				DiskBean a=new DiskBean; a.setDtype(rs.getString(1)); a.setDiskname(rs.getString(2)); a.setDlanguage(rs.getString(3)); a.setDiskquantity(rs.getInt(4)); a.setDiskborrowprice(rs.getInt(5)); dlist.getDisklist.add(a); }			return dlist.getDisklist; }		catch(Exception e)		{ System.out.println(e); }		return null; }	public boolean Register(Userform b)	{ boolean flag=false; try {			String df="Customer"; Statement s=getDbConnection; s.executeUpdate("insert into userregister values('"+b.getName+"','"+b.getPassword+"','"+b.getAge+"','"+b.getSex+"','"+b.getPhone+"','"+b.getMail+"')"); s.executeUpdate("insert into login_details values('"+b.getName+"','"+b.getPassword+"','"+df+"')"); flag=true; }		catch(Exception e)		{ System.err.println(e); }		return flag;

}	public static boolean validateUser(Loginform lf) { boolean flag=false; try {

Statement s=getDbConnection; System.out.println(""+s); ResultSet rs=s.executeQuery("select * from login_details where username='"+lf.getName+"'"); System.out.println(""+rs); while(rs.next) {		System.out.println("name from table"+rs.getString(1)); System.out.println("password from table"+rs.getString(2)); System.out.println; if((rs.getString(1).equals(lf.getName)) && (rs.getString(2).equals(lf.getPassword))) {	flag= true; }	}	}	catch(Exception e)	{} return flag; }

}

//Beans

//BorrowBean

package beans;

import java.util.*;

import org.apache.struts.action.ActionForm;

public class borrowbean extends ActionForm { private String name; private String Disktype; private String Diskname; private String date; private int noofcd; private int transactionId;

ArrayList ilist =new ArrayList ; public borrowbean { }	public String getDiskname { return Diskname; }	public void setDiskname(String diskname) { Diskname = diskname; }	public String getDisktype { return Disktype; }	public void setDisktype(String disktype) { Disktype = disktype; }	public int getNoofcd { return noofcd; }	public void setNoofcd(int noofcd) { this.noofcd = noofcd; }	public ArrayList getIlist { return ilist; }	public void setIlist(ArrayList itemlist) { this.ilist = itemlist; }	public String getDate { return date; }	public void setDate(String date) { this.date = date; }	public String getName { return name; }	public void setName(String name) { this.name = name; }	public int getTransactionId { return transactionId; }	public void setTransactionId(int transactionId) { this.transactionId = transactionId; } }

//BorrowMovies

package beans;

public class BorrowMovies { private String language; private String moviename; private int quantity; private String dateofborrow; private String type; public String getDateofborrow { return dateofborrow; }	public void setDateofborrow(String dateofborrow) { this.dateofborrow = dateofborrow; }	public String getLanguage { return language; }	public void setLanguage(String language) { this.language = language; }	public String getMoviename { return moviename; }	public void setMoviename(String moviename) { this.moviename = moviename; }	public int getQuantity { return quantity; }	public void setQuantity(int quantity) { this.quantity = quantity; }	public String getType { return type; }	public void setType(String type) { this.type = type; }

}

//DiskBean

package beans;

import org.apache.struts.action.ActionForm;

public class DiskBean extends ActionForm { private String dlanguage; private String dtype; private String diskname; private int diskquantity; private int diskborrowprice;

public String getDiskname { return diskname; } public void setDiskname(String diskname) { this.diskname = diskname; } public int getDiskquantity { return diskquantity; } public void setDiskquantity(int diskquantity) { this.diskquantity = diskquantity; } public String getDtype { return dtype; } public void setDtype(String dtype) { this.dtype = dtype; }

public String getDlanguage { return dlanguage; } public void setDlanguage(String dlanguage) { this.dlanguage = dlanguage; } public int getDiskborrowprice { return diskborrowprice; } public void setDiskborrowprice(int diskborrowprice) { this.diskborrowprice = diskborrowprice; }

}

//DiskBeanList

package beans; import java.util.*;

import org.apache.struts.action.ActionForm;

public class DiskBeanList extends ActionForm {	private String dlanguage; private String disktype; private String diskname;

ArrayList disklist=new ArrayList;

public ArrayList<DiskBean> getDisklist { return disklist; }

public void setDisklist(ArrayList<DiskBean> disklist) { this.disklist = disklist; }

public String getDlanguage { return dlanguage; }

public void setDlanguage(String dlanguage) { this.dlanguage = dlanguage; }

public String getDisktype { return disktype; }

public void setDisktype(String disktype) { this.disktype = disktype; }

public String getDiskname { return diskname; }

public void setDiskname(String diskname) { this.diskname = diskname; } }

//DiskDetails

package beans;

import java.util.ArrayList;

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;

public class Diskdetails extends ActionForm{ private String disktype; private String diskname; private String language; private int quantity; private double price; private String image; public String getDiskname { return diskname; }	public void setDiskname(String diskname) { this.diskname = diskname; }	public String getDisktype { return disktype; }	public void setDisktype(String disktype) { this.disktype = disktype; }	public String getLanguage { return language; }	public void setLanguage(String language) { this.language = language; }	public double getPrice { return price; }	public void setPrice(double price) { this.price = price; }	public int getQuantity { return quantity; }	public void setQuantity(int quantity) { this.quantity = quantity; }	public String getImage { return image; }	public void setImage(String image) { this.image = image; }	public ActionErrors validate(ActionMapping mapping,HttpServletRequest req) {		ActionErrors errors=new ActionErrors; System.out.println("Diskdetails"+errors); System.out.println(req.getRequestURI); if(req.getRequestURI.equals("/music/ActionSer.do")) {		if(diskname.equals("")) {			errors.add("diskname",new ActionMessage("Diskdetails.diskname")); }		else if(language.equals("")) {			errors.add("language",new ActionMessage("Diskdetails.language")); }		else if(image.equals("")) {			errors.add("image",new ActionMessage("Diskdetails.image") ); }		}		return errors; }

}

//DiskList

package beans;

import java.util.ArrayList;

import org.apache.struts.action.ActionForm;

public class Disklist extends ActionForm { private String language; private String diskname; ArrayList<Diskdetails> dlist=new ArrayList<Diskdetails>; public ArrayList<Diskdetails> getDlist { return dlist; }	public void setDlist(ArrayList<Diskdetails> dlist) { this.dlist = dlist; }	public String getLanguage { return language; }	public void setLanguage(String language) { this.language = language; } }

//LoginForm

package beans;

import org.apache.struts.action.ActionForm;

public class Loginform extends ActionForm {	public String name; public String password; private String type; public String getType { return type; }	public void setType(String type) { this.type = type; }	public String getName { return name; }	public void setName(String name) { this.name = name; }	public String getPassword { return password; }	public void setPassword(String password) { this.password = password; } }

//ReportGeneration

package beans;

import java.util.ArrayList;

import org.apache.struts.action.ActionForm;

public class reportgeneration extends ActionForm { private String disktype; private String diskname; private String language; private int quantity; private double price; private double tbill; private int transactionid; private int days; public int getDays { return days; }	public void setDays(int days) { this.days = days; }	public int getTransactionid { return transactionid; }	public void setTransactionid(int transactionid) { this.transactionid = transactionid; }	public double getTbill { return tbill; }	public void setTbill(double tbill) { this.tbill = tbill; }	public String getDiskname { return diskname; }	public void setDiskname(String diskname) { this.diskname = diskname; }	public String getDisktype { return disktype; }	public void setDisktype(String disktype) { this.disktype = disktype; }	public String getLanguage { return language; }	public void setLanguage(String language) { this.language = language; }	public double getPrice { return price; }	public void setPrice(double price) { this.price = price; }	public int getQuantity { return quantity; }	public void setQuantity(int quantity) { this.quantity = quantity; } ArrayList itemlist =new ArrayList ; public ArrayList getitemlist {		return itemlist; }	public void setitemlist(ArrayList itemlist) {		this.itemlist=itemlist; } }

//ReturnMovie

package beans;

import java.util.ArrayList;

import org.apache.struts.action.ActionForm;

public class ReturnMovie extends ActionForm { private int transactionId; private int quantityOfReturn; public int getTransactionId { return transactionId; }	public void setTransactionId(int transactionId) { this.transactionId = transactionId; }	public int getQuantityOfReturn { return quantityOfReturn; }	public void setQuantityOfReturn(int quantityOfReturn) { this.quantityOfReturn = quantityOfReturn; }

}

//Transaction

package beans;

import java.util.ArrayList;

import org.apache.struts.action.ActionForm;

public class Transaction extends ActionForm {	private String name; private String language; private String movie_name; private String type; private int quantity; private String dateOfTransaction;

public String getDateOfTransaction { return dateOfTransaction; }	public void setDateOfTransaction(String dateOfTransaction) { this.dateOfTransaction = dateOfTransaction; }	public String getLanguage { return language; }	public void setLanguage(String language) { this.language = language; }	public String getMovie_name { return movie_name; }	public void setMovie_name(String movie_name) { this.movie_name = movie_name; }	public String getName { return name; }	public void setName(String name) { this.name = name; }	public int getQuantity { return quantity; }	public void setQuantity(int quantity) { this.quantity = quantity; }	public String getType { return type; }	public void setType(String type) { this.type = type; }

}

//UserForm

package beans;

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;

public class Userform extends ActionForm {	public String name; public String password; public String age; public String sex; public String phone; public String mail; public String getAge { return age; }	public void setAge(String age) { this.age = age; }	public String getMail { return mail; }	public void setMail(String mail) { this.mail = mail; }	public String getName { return name; }	public void setName(String name) { this.name = name; }	public String getPassword { return password; }	public void setPassword(String password) { this.password = password; }	public String getPhone { return phone; }	public void setPhone(String phone) { this.phone = phone; }	public String getSex { return sex; }	public void setSex(String sex) { this.sex = sex; }		public ActionErrors validate(ActionMapping mapping,HttpServletRequest req) {		ActionErrors errors=new ActionErrors; System.out.println("Userform"+errors); if(name.equals("")) {			errors.add("name",new ActionMessage("Userform.name")); }		else if(password.equals("")) {			errors.add("password",new ActionMessage("Userform.password")); }		else if(age.equals("")) {			errors.add("age",new ActionMessage("Userform.age")); }		else if(sex.equals("")) {			errors.add("sex",new ActionMessage("Userform.sex")); }		else if(phone.equals("")) {			errors.add("phone",new ActionMessage("Userform.phone")); }		else if(mail.equals("")) {			errors.add("mail",new ActionMessage("Userform.mail")); }		return errors; }

}

//ViewTransactionList

package beans;

import java.util.ArrayList;

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

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

public class viewtransactionList extends ActionForm { private String criteria; private  ArrayList<Transaction> tlist=new ArrayList<Transaction>; public ArrayList<Transaction> getTlist { return tlist; }	public void setTlist(ArrayList<Transaction> tlist) { this.tlist = tlist; }

public String getCriteria { return criteria; }	public void setCriteria(String criteria) { this.criteria = criteria; }

}

//Struct-Config

<?xml version="1.0" encoding="UTF-8" ?> - <struts-config> - <form-beans> <form-bean name="mydisk" type="beans.DiskBeanList" /> <form-bean name="mysearch" type="beans.DiskBean" /> <form-bean name="mytype" type="beans.DiskBeanList" /> <form-bean name="myname" type="beans.DiskBeanList" /> <form-bean name="Transaction" type="beans.viewtransactionList" /> <form-bean name="return" type="beans.ReturnMovie" /> <form-bean name="Mybean" type="beans.reportgeneration" /> <form-bean name="myborrow" type="beans.borrowbean" /> <form-bean name="Mybean1" type="beans.Userform" /> <form-bean name="Mybeann" type="beans.Loginform" /> <form-bean name="Mybean2" type="beans.Diskdetails" /> <form-bean name="Mybeans" type="beans.Diskdetails" /> <form-bean name="Mybeanss" type="beans.Disklist" /> <form-bean name="Mybeanssss" type="beans.Disklist" /> <form-bean name="Mybeansss" type="beans.Disklist" /> <form-bean name="Updatebeans" type="beans.Diskdetails" /> <form-bean name="availability" type="beans.Diskdetails" /> <form-bean name="availablebeans" type="beans.Disklist" /> </form-beans> - <action-mappings> - <action path="/Search" type="action.SearchAction" name="mydisk" scope="request"> <forward name="success" path="/searchtype.jsp" /> - <action path="/SearchResult" type="action.SearchResultAction" name="mysearch" scope="request"> <forward name="success" path="/searchresult.jsp" /> <forward name="failure" path="/error.jsp" /> - <action path="/SearchResult1" type="action.SearchResultAction" name="mytype" scope="request"> <forward name="success" path="/searchresult.jsp" /> <forward name="failure" path="/error.jsp" /> - <action path="/SearchByName" type="action.SearchNameAction" name="myname" scope="request"> <forward name="success" path="/searchname.jsp" /> - <action path="/viewTransaction" type="action.TransactionDetails" name="Transaction" scope="request" input="/viewtransactionHistory.jsp" validate="true"> <forward name="Success" path="/viewtransactionDetails.jsp" /> <forward name="failure" path="/viewtransactionHistory.jsp" /> - <action path="/returnMovies" type="action.ReturnMovies" name="return"> <forward name="success" path="/SuccessPage.jsp" /> <forward name="failure" path="/failurePage.jsp" /> - <action path="/ActionSer" type="act.reportaction" name="Mybean" scope="request"> <forward name="successbill" path="/bill.jsp" /> - <action path="/Borrow" type="action.borrowaction" name="myborrow" scope="request"> <forward name="successborrow" path="/borrowresult.jsp" /> - <action path="/register" type="action.RegisterAction" name="Mybean1" scope="request" input="/register.jsp" validate="true"> <forward name="success" path="/reg.jsp" /> - <action path="/login" type="action.Loginaction" name="Mybeann" scope="request"> <forward name="success1" path="/AdminMenu.jsp" /> <forward name="succes2" path="/CustomerMenu.jsp" /> <forward name="failure" path="/login.jsp" /> - <action path="/ActionSer" type="action.Addaction" name="Mybean2" scope="request" input="/Addmovie.jsp" validate="true"> <forward name="addsuccess" path="/Addsuccess.jsp" /> <forward name="addmovie" path="/Addmovie.jsp" /> - <action path="/deletemovie" type="action.Deleteaction" name="Mybeans" scope="request"> <forward name="deletesuccess" path="/Deletesuccess.jsp" /> - <action path="/viewmovie" type="action.viewmoviesaction" name="Mybeanss" scope="request"> <forward name="delete" path="/delete1.jsp" /> - <action path="/viewmovielanguage" type="action.viewmovietypesaction" name="Mybeanssss" scope="request"> <forward name="deletelang" path="/delete2.jsp" /> - <action path="/upmovie" type="action.UpdateMoviesAction" name="Mybeansss" scope="request"> <forward name="modify" path="/Update.jsp" /> - <action path="/updatemovie" type="action.UpdateAction" name="Updatebeans" scope="request"> <forward name="modifysuccess" path="/updateSuccess.jsp" /> - <action path="/viewitem" type="action.AvailabilityAction" name="availability" scope="request"> <forward name="available" path="/Available.jsp" /> - <action path="/availmovie" type="action.AvailableMoviesAction" name="availablebeans" scope="request"> <forward name="availablesuccess" path="/checkAvailability.jsp" /> </action-mappings> <message-resources parameter="message" /> </struts-config>

//WEB-XML

--> -  <servlet-name>action</servlet-name> <servlet-class>org.apache.struts.action.ActionServlet</servlet-class> <load-on-startup>1</load-on-startup> - <servlet-mapping> <servlet-name>action</servlet-name> <url-pattern>*.do</url-pattern> </servlet-mapping> </web-app>