.

Wednesday, January 26, 2011

class DepositFixed ONLINE BANKING ACADEMIC PROJECT SOURCE CODE

/* this code is intended education purpuse only. all rights reserved .copy right
protected .www.freejavaprojectsonline.blogspot.com . mails to : johnjustin@in.com */



import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.sql.*;
import java.util.*;

public class DepositFixed extends HttpServlet{
Connection con;
Statement st;
ResultSet rs;
String rate[],duration[];

public void doPost(HttpServletRequest req,HttpServletResponse res) throws IOException,ServletException{
try{
int ano=Integer.parseInt(req.getParameter("ANO"));

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con=DriverManager.getConnection("jdbc:odbc:bank");
st=con.createStatement();

res.setContentType("text/html");
PrintWriter out=res.getWriter();

Calendar calendar = new GregorianCalendar();
String date=calendar.get(Calendar.DATE)+"/"+(calendar.get(Calendar.MONTH)+1)+"/"+calendar.get(Calendar.YEAR);

rs=st.executeQuery("SELECT * FROM FTABLE WHERE ACCOUNTNO="+ano);
if(!rs.next())
{
rs=st.executeQuery("SELECT COUNT(*) FROM FITABLE");
rs.next();
int limit=Integer.parseInt(rs.getString(1));
rs.close();
rate=new String[limit];
duration=new String[limit];

rs=st.executeQuery("SELECT * FROM FITABLE");
System.out.println("count1="+limit);

limit=0;

while(rs.next()){
duration[limit]=rs.getString(1);
rate[limit]=rs.getString(2);
limit++;
}

out.println("<html><head><title>Deposits</title>");
out.println("<script language=\"vbscript\">");
out.println(" sub f1");
out.println(" id1.style.visibility=\"visible\"");
out.println(" id2.style.visibility=\"hidden\"");
out.println(" end sub");
out.println(" sub f2");
out.println(" id2.style.visibility=\"visible\"");
out.println(" id1.style.visibility=\"hidden\"");
out.println(" end sub");
out.println(" sub window_onload");
out.println(" f1");
out.println(" end sub");
out.println("</script>");

out.println("</head><body background=\"http:\\\\localhost:8080\\examples\\servlets\\images\\globe.jpg\" link=red alink=green vlink=blue>");
out.println("<h2 align=\"center\"><font color=\"#000080\">");
out.println("<img border=\"0\" src=\"http:\\\\localhost:8080\\examples\\servlets\\images\\earth.gif\" align=\"left\" width=\"50\" height=\"49\">");
out.println("</font></h2><h2 align=\"center\"><font color=\"#000080\">UNIVERSAL NET BANK");
out.println("</font></h2><p align=\"center\">&nbsp;</p>");
out.println("<table border=\"2\" width=\"100%\" bordercolorlight=\"#0000FF\" bordercolordark=\"#0000FF\">");
out.println("<tr><td width=\"12%\" valign=\"top\" align=\"center\">");
out.println("<a href=\"http:\\\\localhost:8080\\examples\\servlet\\Welcome?ANO="+ano+"\">Welcome");
out.println("</a></td><td width=\"18%\" valign=\"top\" align=\"center\">");
out.println("<a href=\"http:\\\\localhost:8080\\examples\\servlet\\ADetail?ANO="+ano+"\">Account Details");
out.println("</a></td><td width=\"14%\" valign=\"top\" align=\"center\">");
out.println("<a href=\"http:\\\\localhost:8080\\examples\\servlet\\WithDraw?ANO="+ano+"\">Withdrawals");
out.println("</a></td><td width=\"12%\" valign=\"top\" align=\"center\">");
out.println("<a href=\"http:\\\\localhost:8080\\examples\\servlet\\Deposit?ANO="+ano+"\">Deposits");
out.println("</a></td><td width=\"12%\" valign=\"top\" align=\"center\">");
out.println("<a href=\"http:\\\\localhost:8080\\examples\\servlet\\Loan?ANO="+ano+"\">Loans");
out.println("</a></td><td width=\"12%\" valign=\"top\" align=\"center\">");
out.println("<a href=\"http:\\\\localhost:8080\\examples\\servlet\\Option?ANO="+ano+"\">Options");
out.println("</a></td><td width=\"12%\" valign=\"top\" align=\"center\">");
out.println("<a href=\"http:\\\\localhost:8080\\examples\\servlet\\Mail?ANO="+ano+"\">Mail Us");
out.println("</a></td><td width=\"11%\" valign=\"top\" align=\"center\">");
out.println("<a href=\"http:\\\\localhost:8080\\examples\\servlets\\Logout.html\">Logout");
out.println("</a></td></tr></table><table border=\"0\" width=\"100%\">");
out.println("<tr><td width=\"50%\"><font color=\"#000080\"><b>");
out.println("Date&nbsp;&nbsp; :&nbsp; </b></font><font color=\"#000080\"><b>");
out.println(date);
out.println("</b></font></td><td width=\"50%\" align=\"right\"><font color=\"#000080\">");
out.println("<b>Account No : <font size=\"3\">");
out.println(ano);
out.println("</font></b></font></td></tr></table>");
out.println("<p align=\"center\">&nbsp;<img border=\"0\" src=\"http:\\\\localhost:8080\\examples\\servlets\\images\\deposits.jpg\" width=\"403\" height=\"83\"></p>");

out.println("<div align=\"center\">");
out.println("<center><table border=\"1\" cellpadding=\"2\" width=\"75%\">");
out.println("<tr><td width=\"50%\" align=\"center\"><b><font color=\"#000080\">");
out.println("<input type=\"radio\" value=\"CREDIT\" checked name=\"DTYPE\" onclick=\"f1\">");
out.println("Deposit Through Credit Card</font></b></td>");
out.println("<td width=\"50%\" align=\"center\"><b><font color=\"#000080\">");
out.println("<input type=\"radio\" value=\"CASH\" name=\"DTYPE\" onclick=\"f2\">");
out.println("Deposit Through Cash</font></b></td></tr></table></center>");

out.println("</div><div id=\"id1\">");
out.println("<form method=\"POST\" action=\"http:\\\\localhost:8080\\examples\\servlet\\UpDepositFixed\"");
out.println("style=\"position: absolute;left: -2; top: 321; width: 692; height: 178\"> ");
out.println("<input type=hidden name=ANO value="+ano+">");
out.println("<input type=hidden name=TYPE value=\"CREDIT\">");
out.println("<div align=\"left\"><table border=\"1\" cellpadding=\"2\" width=\"50%\"><tr>");
out.println("<td width=\"50%\"><p align=\"left\"><b><font color=\"#000080\">");
out.println("Select The Card Type</font></b></td><td width=\"50%\" colspan=\"2\">");
out.println("<b><font color=\"#000080\"><select size=\"1\" name=\"CTYPE\">");
out.println("<option>Master Card</option><option>Visa Card</option>");
out.println("</select></font></b></td></tr><tr><td width=\"50%\"><b><font color=\"#000080\">");
out.println("Enter The Card Number</font></b></td>");
out.println("<td width=\"50%\" colspan=\"2\"><b><font color=\"#000080\">");
out.println("<input type=\"text\" name=\"CNO\" size=\"20\"></font>");
out.println("</b></td></tr><tr><td width=\"50%\"><b><font color=\"#000080\">");
out.println("Enter The Amount </font></b></td><td width=\"50%\" colspan=\"2\">");
out.println("<p align=\"left\"><b><font color=\"#000080\">");
out.println("<input type=\"text\" name=\"AMOUNT\" size=\"20\"></font></b></td>");
out.println("</tr><tr><td width=\"50%\"><b><font color=\"#000080\">Select The Duration");
out.println("</font></b></td><td width=\"50%\" colspan=\"2\"><b><font color=\"#000080\">");
out.println("<select size=\"1\" name=\"DURATION\">"+"year");

for (limit=0;limit<rate.length;limit++)
out.println("<option>"+duration[limit]+"</option>");
out.println("</select></font></b></td>");

out.println("</tr><tr><td width=\"50%\">&nbsp;</td><td width=\"25%\" align=\"right\">");
out.println("<b><font color=\"#000080\"><input type=\"submit\" value=\"Submit\" name=\"B1\">");
out.println("</font></b></td><td width=\"25%\" align=\"right\"><b>");
out.println("<font color=\"#000080\"><input type=\"reset\" value=\"Reset\" name=\"B2\">");
out.println("</font></b></td></tr></table></div></form></div><p>&nbsp;</p>");

out.println("<div id=\"id2\">");
out.println("<form method=\"POST\" action=\"http:\\\\localhost:8080\\examples\\servlet\\UPDeposit\"");
out.println("style=\"position: absolute; left: -1; top: 321; width: 693; height: 158\">");
out.println("<input type=hidden name=ANO value="+ano+">");
out.println("<input type=hidden name=TYPE value=\"ACCOUNT\">");
out.println("<div align=\"left\"><table border=\"1\" cellpadding=\"2\" width=\"50%\">");
out.println("<tr><td width=\"50%\"><font color=\"#000080\"><b>Enter The Amount</b>");
out.println("</font></td><td width=\"50%\" colspan=\"2\"><font color=\"#000080\"><b>");
out.println("<input type=\"text\" name=\"AMOUNT\" size=\"20\"></b></font></td>");
out.println("</tr><tr><td width=\"50%\"><font color=\"#000080\"><b>Select The Duration</b>");
out.println("</font></td><td width=\"50%\" colspan=\"2\"><font color=\"#000080\"><b>");
out.println("<select size=\"1\" name=\"DURATION\">"+"year");

for (limit=0;limit<rate.length;limit++)
out.println("<option>"+duration[limit]+"</option>");

out.println("</select></b></font></td></tr><tr>");
out.println("<td width=\"50%\">&nbsp;</td><td width=\"25%\" align=\"right\">");
out.println("<font color=\"#000080\"><b><input type=\"submit\" value=\"Submit\" name=\"B1\">");
out.println("</b></font></td><td width=\"25%\" align=\"right\"><font color=\"#000080\">");
out.println("<b><input type=\"reset\" value=\"Reset\" name=\"B2\"></b></font></td>");
out.println("</tr></table></div><p>&nbsp;</p></form></div>");

out.println("<form style=\"position: absolute; left: 1; top: 321; width: 671; height: 225\">");
out.println("<div align=\"right\"><table border=\"1\" cellpadding=\"2\" width=\"40%\">");
out.println("<tr><td width=\"50%\" bgcolor=\"#FFFFFF\" align=\"center\"><b>");
out.println("<font color=\"#000080\">Duration</font></b></td>");
out.println("<td width=\"50%\" bgcolor=\"#FFFFFF\" align=\"center\"><b><font color=\"#000080\">");
out.println("Interest Rate</font></b></td></tr>");
for (limit=0;limit<rate.length;limit++){
out.println("<tr><td width=\"50%\">");
out.println(duration[limit]);
out.println("</td><td width=\"50%\">");
out.println(rate[limit]);
out.println("</td></tr>");
}
out.println("</table></div><p>&nbsp;</p></form></body></html>");
}
else
{
out.println("<html><head><title>Deposits</title>");
out.println("</head><body background=\"http:\\\\localhost:8080\\examples\\servlets\\images\\globe.jpg\" link=red alink=green vlink=blue>");
out.println("<h2 align=\"center\"><font color=\"#000080\">");
out.println("<img border=\"0\" src=\"http:\\\\localhost:8080\\examples\\servlets\\images\\earth.gif\" align=\"left\" width=\"50\" height=\"49\">");
out.println("</font></h2><h2 align=\"center\"><font color=\"#000080\">UNIVERSAL NET BANK");
out.println("</font></h2><p align=\"center\">&nbsp;</p>");
out.println("<table border=\"2\" width=\"100%\" bordercolorlight=\"#0000FF\" bordercolordark=\"#0000FF\">");
out.println("<tr><td width=\"12%\" valign=\"top\" align=\"center\">");
out.println("<a href=\"http:\\\\localhost:8080\\examples\\servlet\\Welcome?ANO="+ano+"\">Welcome");
out.println("</a></td><td width=\"18%\" valign=\"top\" align=\"center\">");
out.println("<a href=\"http:\\\\localhost:8080\\examples\\servlet\\ADetail?ANO="+ano+"\">Account Details");
out.println("</a></td><td width=\"14%\" valign=\"top\" align=\"center\">");
out.println("<a href=\"http:\\\\localhost:8080\\examples\\servlet\\WithDraw?ANO="+ano+"\">Withdrawals");
out.println("</a></td><td width=\"12%\" valign=\"top\" align=\"center\">");
out.println("<a href=\"http:\\\\localhost:8080\\examples\\servlet\\Deposit?ANO="+ano+"\">Deposits");
out.println("</a></td><td width=\"12%\" valign=\"top\" align=\"center\">");
out.println("<a href=\"http:\\\\localhost:8080\\examples\\servlet\\Loan?ANO="+ano+"\">Loans");
out.println("</a></td><td width=\"12%\" valign=\"top\" align=\"center\">");
out.println("<a href=\"http:\\\\localhost:8080\\examples\\servlet\\Option?ANO="+ano+"\">Options");
out.println("</a></td><td width=\"12%\" valign=\"top\" align=\"center\">");
out.println("<a href=\"http:\\\\localhost:8080\\examples\\servlet\\Mail?ANO="+ano+"\">Mail Us");
out.println("</a></td><td width=\"11%\" valign=\"top\" align=\"center\">");
out.println("<a href=\"http:\\\\localhost:8080\\examples\\servlets\\Logout.html\">Logout");
out.println("</a></td></tr></table><table border=\"0\" width=\"100%\">");
out.println("<tr><td width=\"50%\"><font color=\"#000080\"><b>");
out.println("Date&nbsp;&nbsp; :&nbsp; </b></font><font color=\"#000080\"><b>");
out.println(date);
out.println("</b></font></td><td width=\"50%\" align=\"right\"><font color=\"#000080\">");
out.println("<b>Account No : <font size=\"3\">");
out.println(ano);
out.println("</font></b></font></td></tr></table>");
out.println("<p align=\"center\">&nbsp;<img border=\"0\" src=\"http:\\\\localhost:8080\\examples\\servlets\\images\\deposits.jpg\" width=\"403\" height=\"83\"></p>");

out.println("<p align=\"left\"><b><font color=\"#000080\">");
out.println("You Already Have One or More Fixed Deposit Account.");
out.println("<a href=\"http:\\\\localhost:8080\\examples\\servlet\\ViewFixed?ANO="+ano+"\">View Details");
out.println("</a></font></b></p><p align=\"left\"><b><font color=\"#000080\">");
out.println("Do You Wish to Create Another One ?&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
out.println("<a href=\"http:\\\\localhost:8080\\examples\\servlet\\Temp?ANO="+ano+"\">");
out.println("Yes</a>&nbsp;&nbsp;&nbsp;");
out.println("<a href=\"http:\\\\localhost:8080\\examples\\servlet\\Deposit?ANO="+ano+"\">");
out.println("No</a></font></b>&nbsp;");
out.println("</p><p align=\"left\">&nbsp;&nbsp;&nbsp; </p>");
out.println("</table></div><p>&nbsp;</p>");
out.println("<br><br><font color=red><MARQUEE><I>This option is for future enhancement (ATM Facility). The page is just displayed for knowing the facilities</I></MARQUEE></font>");
out.println("</form>");
out.println("</body></html>");

}
}
catch(SQLException sqle4){
System.out.println("Sql4 Exception "+sqle4);
}
catch(ClassNotFoundException cnfe){
System.out.println("Class Not Found "+cnfe);
}
}

public void doGet(HttpServletRequest req,HttpServletResponse res) throws IOException,ServletException{
doPost(req,res);
}

}





NEXT =>> class logincheck1 ONLINE BANKING APPLICATION USING JAVA JSP ACADEMIC PROJECT

Google Ads