.

Wednesday, January 26, 2011

class Loan module of online banking system java academic project

/* 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 Loan extends HttpServlet{
Connection con;
Statement st;
ResultSet rs;

public void doPost(HttpServletRequest req,HttpServletResponse res) throws IOException,ServletException{
try{
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);

String sql="SELECT * FROM LITABLE ORDER BY DURATION";
rs=st.executeQuery(sql);

int ano=Integer.parseInt(req.getParameter("ANO"));

out.println("<html><head><title>Options</title></head>");
out.println("<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\\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\\update.jpg\" width=\"403\" height=\"83\"></p>");

out.println("<p align=\"center\"><font size=\"4\" color=\"#000080\"><b>LOAN APPLICATION FORM");
out.println("</b></font></p><p align=\"center\"><b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
out.println("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
out.println("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
out.println("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
out.println("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
out.println("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
out.println("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
out.println("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
out.println("&nbsp;&nbsp;&nbsp;&nbsp;Interest Rates</b></p>");
out.println("<form method=\"POST\" action=\"http:\\\\localhost:8080\\examples\\servlet\\UpdateLoan\"");
out.println("style=\"position: absolute; left: 20; top: 400; width: 675; height: 120\" >");
out.println("<input type=hidden name=\"ANO\" value=\"1000\">");
out.println("<table border=\"3\" width=\"55%\" height=\"109\">");
out.println("<tr><td width=\"39%\" height=\"23\"><font size=\"3\"><b>");
out.println("Loan Amount Required </b></font></td><td width=\"35%\" height=\"23\">");
out.println("<input type=\"text\" name=\"AMOUNT\" size=\"20\"></td></tr><tr>");
out.println("<td width=\"39%\" height=\"18\"><font size=\"3\"><b>Loan Duration </b>");
out.println("</font></td><td width=\"35%\" height=\"18\">");
out.println("<select size=\"1\" name=\"DURATION\">");
while(rs.next())
{
out.println("<option>"+rs.getString(1)+"</option>");
}
out.println("</select></td>");
out.println("</tr><tr><td width=\"39%\" height=\"19\">&nbsp;</td>");
out.println("<td width=\"35%\" height=\"19\">&nbsp;</td></tr><tr>");
out.println("<td width=\"39%\" height=\"25\">&nbsp;</td><td width=\"10%\" height=\"25\">");
out.println("<p align=\"right\"><input type=\"submit\" value=\"Submit\" name=\"B1\"></td>");
out.println("</tr></table></form><div align=\"right\">");
out.println("<table border=\"2\" width=\"40%\"><tr>");
out.println("<td width=\"44%\" align=\"center\" bgcolor=\"#FFFFFF\"><b><font color=\"#000080\">Loan");
out.println(" Duration</font></b></td>");
out.println("<td width=\"56%\" align=\"center\" bgcolor=\"#FFFFFF\"><b>");
out.println("<font color=\"#000080\">Loan Interest Rate</font></b></td></tr>");

rs=st.executeQuery(sql);
while(rs.next())
{
out.println("<tr>");
out.println("<td width=\"44%\" align=\"left\">"+rs.getString(1)+" Year</td>");
out.println("<td width=\"56%\" align=\"left\">"+rs.getString(2)+"%</td></tr>");
out.println("</tr>");
}

out.println("</table></div>");
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("</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 processDetails OF ONLINE BANKING SYSTEM

Google Ads