Hi friends! , This is the Servlet version of " A Powerful Java Swing & JDBC Code for Application Development "
ADD RECORD |
MODIFY RECORD |
DELETE RECORD |
SHOW ALL |
HOME |
//my index
//Right
//ADDRECORD
/*
-----------------Very import please read installation instructions------------------------------
Code By : James Smith Kelleher
Email me : james_smith73@yahoo.com
================================================================================================
*********** PHASE 1 INSTALLING JAKARTA TOMCAT 3.2.1 (OPTIONAL on WIN 98) **********************
DOWNLOAD ------------------------------------------------------------------>
Step 1: Read http://jakarta.apache.org/tomcat/tomcat-3.2-doc/index.html
Step 2: If u dont get this zip file "jakarta-tomcat-3.2.1.zip" download it from here (best version i feel)
Step 3: http://www.geocities.com/james_smith73/jakarta-tomcat-3.2.1.zip
INSTALL ------------------------------------------------------------------->
Step 4: unzip this "jakarta-tomcat-3.2.1.zip" to this location "c:\jakarta-tomcat-3.2.1"
Step 5: Right Click your MSDOS icon , Properties , Click on Memory Tab , set Initial Environment 2816
Autoexec.bat -------------------------------------------------------------->
Step 6: Edit your C:\Autoexec.bat as shown below
====================================================
SET JAVA_HOME=c:\jdk1.2.1
SET TOMCAT_HOME=c:\jakarta-tomcat-3.2.1
SET PATH=c:\windows;c:\windows\command;c:\jdk1.2.1\bin;c:\
SET CLASSPATH=c:\jakarta-tomcat-3.2.1\lib\ant.jar;c:\jakarta-tomcat-3.2.1\lib\jaxp.jar;c:\jakarta-tomcat-3.2.1\lib\servlet.jar;c:\jakarta-tomcat-3.2.1\lib\parser.jar;c:\jakarta-tomcat-3.2.1\lib\webserver.jar;c:\jakarta-tomcat-3.2.1\lib\jasper.jar
====================================================
Step 7: Save settings and Restart your Computer
*********** PHASE 2 SETTINGUP SERVLETS ********************************************************
Step 8: Download http://www.geocities.com/james_smith73
Download Menu ----> james2.zip
Step 9: unzip to c:\temp or anyother folder of ur choice
Step 10: copy these files into this location
C:\jakarta-tomcat-3.2.1\WEBAPPS\ROOT\myindex.html
C:\jakarta-tomcat-3.2.1\WEBAPPS\ROOT\left.html
C:\jakarta-tomcat-3.2.1\WEBAPPS\ROOT\right.html
C:\jakarta-tomcat-3.2.1\WEBAPPS\ROOT\style.css (case sensitive Remember !! not style.css)
C:\jakarta-tomcat-3.2.1\WEBAPPS\ROOT\steam.gif (case sensitive Remember !! not style.css)
C:\jakarta-tomcat-3.2.1\WEBAPPS\ROOT\Andrew.jpg
C:\jakarta-tomcat-3.2.1\WEBAPPS\ROOT\James.jpg
C:\jakarta-tomcat-3.2.1\WEBAPPS\ROOT\Janet.jpg
C:\jakarta-tomcat-3.2.1\WEBAPPS\ROOT\Laura.jpg
C:\jakarta-tomcat-3.2.1\WEBAPPS\ROOT\Margaret.jpg
C:\jakarta-tomcat-3.2.1\WEBAPPS\ROOT\Michael.jpg
C:\jakarta-tomcat-3.2.1\WEBAPPS\ROOT\Nancy.jpg
C:\jakarta-tomcat-3.2.1\WEBAPPS\ROOT\Robert.jpg
C:\jakarta-tomcat-3.2.1\WEBAPPS\ROOT\Steven.jpg
Step 11: copy these files into this location ------------------------------------->
C:\jakarta-tomcat-3.2.1\WEBAPPS\EXAMPLES\WEB-INF\CLASSES\addrec.java
javac addrec.java
C:\jakarta-tomcat-3.2.1\WEBAPPS\EXAMPLES\WEB-INF\CLASSES\addrecresp.java
javac addrecresp.java
C:\jakarta-tomcat-3.2.1\WEBAPPS\EXAMPLES\WEB-INF\CLASSES\modrec.java
javac modrec.java
C:\jakarta-tomcat-3.2.1\WEBAPPS\EXAMPLES\WEB-INF\CLASSES\modrecresp.java
javac modrecresp.java
C:\jakarta-tomcat-3.2.1\WEBAPPS\EXAMPLES\WEB-INF\CLASSES\modrecresp2.java
javac modrecresp2.java
C:\jakarta-tomcat-3.2.1\WEBAPPS\EXAMPLES\WEB-INF\CLASSES\delrec.java
javac delrec.java
C:\jakarta-tomcat-3.2.1\WEBAPPS\EXAMPLES\WEB-INF\CLASSES\delrecresp.java
javac delrecresp.java
C:\jakarta-tomcat-3.2.1\WEBAPPS\EXAMPLES\WEB-INF\CLASSES\showall.java
javac showall.java
*********** PHASE 3 ODBC Settings ********************************************************
step 12 : click control panel
step 13 : ODBC Data Sources
step 14 : click UserDSN Tab
step 15 : click ADD Button , Select Microsoft Access Driver , Finish
step 16 : Give Datasource Name as "james" , no double quotes
step 17 : use Select and select james.mdb from c:\james\james.mdb
click ok , ok finish
*********** RUN THE WEB SERVER ************************************************************
step 18 : cd c:\jakarta-tomcat-3.2.1\bin
startup.bat (or) startup
================================================================================================
*/
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class addrec extends HttpServlet
{
public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
{
response.setContentType("text/html");
PrintWriter out = response.getWriter();
out.println("");
out.println("");
out.println("");
out.println("
out.println("");
out.println("");
out.println("");
buildtableadd(out);
out.println("");
out.println("");
}
void buildtableadd(PrintWriter out)
{
out.println("");
}
}
//ADDrecreso
/*
-----------------Very import please read installation instructions------------------------------
Code By : James Smith Kelleher
Email me : james_smith73@yahoo.com
================================================================================================
*********** PHASE 1 INSTALLING JAKARTA TOMCAT 3.2.1 (OPTIONAL on WIN 98) **********************
DOWNLOAD ------------------------------------------------------------------>
Step 1: Read http://jakarta.apache.org/tomcat/tomcat-3.2-doc/index.html
Step 2: If u dont get this zip file "jakarta-tomcat-3.2.1.zip" download it from here (best version i feel)
Step 3: http://www.geocities.com/james_smith73/jakarta-tomcat-3.2.1.zip
INSTALL ------------------------------------------------------------------->
Step 4: unzip this "jakarta-tomcat-3.2.1.zip" to this location "c:\jakarta-tomcat-3.2.1"
Step 5: Right Click your MSDOS icon , Properties , Click on Memory Tab , set Initial Environment 2816
Autoexec.bat -------------------------------------------------------------->
Step 6: Edit your C:\Autoexec.bat as shown below
====================================================
SET JAVA_HOME=c:\jdk1.2.1
SET TOMCAT_HOME=c:\jakarta-tomcat-3.2.1
SET PATH=c:\windows;c:\windows\command;c:\jdk1.2.1\bin;c:\
SET CLASSPATH=c:\jakarta-tomcat-3.2.1\lib\ant.jar;c:\jakarta-tomcat-3.2.1\lib\jaxp.jar;c:\jakarta-tomcat-3.2.1\lib\servlet.jar;c:\jakarta-tomcat-3.2.1\lib\parser.jar;c:\jakarta-tomcat-3.2.1\lib\webserver.jar;c:\jakarta-tomcat-3.2.1\lib\jasper.jar
====================================================
Step 7: Save settings and Restart your Computer
*********** PHASE 2 SETTINGUP SERVLETS ********************************************************
Step 8: Download http://www.geocities.com/james_smith73
Download Menu ----> james2.zip
Step 9: unzip to c:\temp or anyother folder of ur choice
Step 10: copy these files into this location
C:\jakarta-tomcat-3.2.1\WEBAPPS\ROOT\myindex.html
C:\jakarta-tomcat-3.2.1\WEBAPPS\ROOT\left.html
C:\jakarta-tomcat-3.2.1\WEBAPPS\ROOT\right.html
C:\jakarta-tomcat-3.2.1\WEBAPPS\ROOT\style.css (case sensitive Remember !! not style.css)
C:\jakarta-tomcat-3.2.1\WEBAPPS\ROOT\steam.gif (case sensitive Remember !! not style.css)
C:\jakarta-tomcat-3.2.1\WEBAPPS\ROOT\Andrew.jpg
C:\jakarta-tomcat-3.2.1\WEBAPPS\ROOT\James.jpg
C:\jakarta-tomcat-3.2.1\WEBAPPS\ROOT\Janet.jpg
C:\jakarta-tomcat-3.2.1\WEBAPPS\ROOT\Laura.jpg
C:\jakarta-tomcat-3.2.1\WEBAPPS\ROOT\Margaret.jpg
C:\jakarta-tomcat-3.2.1\WEBAPPS\ROOT\Michael.jpg
C:\jakarta-tomcat-3.2.1\WEBAPPS\ROOT\Nancy.jpg
C:\jakarta-tomcat-3.2.1\WEBAPPS\ROOT\Robert.jpg
C:\jakarta-tomcat-3.2.1\WEBAPPS\ROOT\Steven.jpg
Step 11: copy these files into this location ------------------------------------->
C:\jakarta-tomcat-3.2.1\WEBAPPS\EXAMPLES\WEB-INF\CLASSES\addrec.java
javac addrec.java
C:\jakarta-tomcat-3.2.1\WEBAPPS\EXAMPLES\WEB-INF\CLASSES\addrecresp.java
javac addrecresp.java
C:\jakarta-tomcat-3.2.1\WEBAPPS\EXAMPLES\WEB-INF\CLASSES\modrec.java
javac modrec.java
C:\jakarta-tomcat-3.2.1\WEBAPPS\EXAMPLES\WEB-INF\CLASSES\modrecresp.java
javac modrecresp.java
C:\jakarta-tomcat-3.2.1\WEBAPPS\EXAMPLES\WEB-INF\CLASSES\modrecresp2.java
javac modrecresp2.java
C:\jakarta-tomcat-3.2.1\WEBAPPS\EXAMPLES\WEB-INF\CLASSES\delrec.java
javac delrec.java
C:\jakarta-tomcat-3.2.1\WEBAPPS\EXAMPLES\WEB-INF\CLASSES\delrecresp.java
javac delrecresp.java
C:\jakarta-tomcat-3.2.1\WEBAPPS\EXAMPLES\WEB-INF\CLASSES\showall.java
javac showall.java
*********** PHASE 3 ODBC Settings ********************************************************
step 12 : click control panel
step 13 : ODBC Data Sources
step 14 : click UserDSN Tab
step 15 : click ADD Button , Select Microsoft Access Driver , Finish
step 16 : Give Datasource Name as "james" , no double quotes
step 17 : use Select and select james.mdb from c:\james\james.mdb
click ok , ok finish
*********** RUN THE WEB SERVER ************************************************************
step 18 : cd c:\jakarta-tomcat-3.2.1\bin
startup.bat (or) startup
================================================================================================
*/
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.sql.*;
public class addrecresp extends HttpServlet
{
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, java.io.IOException
{
response.setContentType("text/html");
PrintWriter out = response.getWriter();
java.util.Properties props = new java.util.Properties();
props.put("user", " ");
props.put("password", " ");
String driverName = "sun.jdbc.odbc.JdbcOdbcDriver";
String connectionURL = "jdbc:odbc:james";
String Name = request.getParameter("sname");
String Address = request.getParameter("saddr");
String FName = request.getParameter("fname");
String Sex = request.getParameter("sex");
String Yearsel = request.getParameter("myclass");
String Sectionsel = request.getParameter("mysec");
String SSLC = request.getParameter("SSLC");
String PHOTO = request.getParameter("PHOTO");
String CHARCERT = request.getParameter("charCERT");
String NCCCERT = request.getParameter("nccCERT");
String imagename = request.getParameter("imname");
String reg_no="";
String sql="";
int SSLCsel=1, PHOTOsel=1, CHARCERTsel=1, NCCCERTsel=1;
try
{
Class.forName(driverName);
Connection connection=DriverManager.getConnection(connectionURL);
Statement statement = connection.createStatement();
String query = "SELECT * FROM student_det";
ResultSet rs = statement.executeQuery(query);
int cnt = 0;
while (rs.next())
{
cnt++;
}
cnt = cnt+1;
char ys = Yearsel.charAt(0);
char ss = Sectionsel.charAt(8);
reg_no = "02-PCM-"+ys+""+ss+"-"+cnt;
sql = "INSERT INTO student_det (StudentID, Name, Address, FName, Sex, Yearsel, Sectionsel, SSLC, PHOTO, CHARCERT, NCCCERT, imagename) VALUES ('"+reg_no+"','"+Name+"','"+Address+"','"+FName+"','"+Sex+"','"+Yearsel+"','"+Sectionsel+"',"+SSLC+","+PHOTO+","+CHARCERT+","+NCCCERT+",'"+imagename+"')";
statement.executeUpdate(sql);
connection.close();
}
catch(Exception ex)
{
}
out.println("");
out.println("");
out.println("");
out.println("
out.println("");
out.println("");
buildtableadd(out);
out.println("");
out.println("");
out.flush();
out.close();
}
public void init(ServletConfig cfg) throws ServletException
{
super.init(cfg);
}
public void destroy()
{
super.destroy();
}
void buildtableadd(PrintWriter out)
{
out.println("");
}
}
//DELETE RECORD
/*
-----------------Very import please read installation instructions------------------------------
Code By : James Smith Kelleher
Email me : james_smith73@yahoo.com
================================================================================================
*********** PHASE 1 INSTALLING JAKARTA TOMCAT 3.2.1 (OPTIONAL on WIN 98) **********************
DOWNLOAD ------------------------------------------------------------------>
Step 1: Read http://jakarta.apache.org/tomcat/tomcat-3.2-doc/index.html
Step 2: If u dont get this zip file "jakarta-tomcat-3.2.1.zip" download it from here (best version i feel)
Step 3: http://www.geocities.com/james_smith73/jakarta-tomcat-3.2.1.zip
INSTALL ------------------------------------------------------------------->
Step 4: unzip this "jakarta-tomcat-3.2.1.zip" to this location "c:\jakarta-tomcat-3.2.1"
Step 5: Right Click your MSDOS icon , Properties , Click on Memory Tab , set Initial Environment 2816
Autoexec.bat -------------------------------------------------------------->
Step 6: Edit your C:\Autoexec.bat as shown below
====================================================
SET JAVA_HOME=c:\jdk1.2.1
SET TOMCAT_HOME=c:\jakarta-tomcat-3.2.1
SET PATH=c:\windows;c:\windows\command;c:\jdk1.2.1\bin;c:\
SET CLASSPATH=c:\jakarta-tomcat-3.2.1\lib\ant.jar;c:\jakarta-tomcat-3.2.1\lib\jaxp.jar;c:\jakarta-tomcat-3.2.1\lib\servlet.jar;c:\jakarta-tomcat-3.2.1\lib\parser.jar;c:\jakarta-tomcat-3.2.1\lib\webserver.jar;c:\jakarta-tomcat-3.2.1\lib\jasper.jar
====================================================
Step 7: Save settings and Restart your Computer
*********** PHASE 2 SETTINGUP SERVLETS ********************************************************
Step 8: Download http://www.geocities.com/james_smith73
Download Menu ----> james2.zip
Step 9: unzip to c:\temp or anyother folder of ur choice
Step 10: copy these files into this location
C:\jakarta-tomcat-3.2.1\WEBAPPS\ROOT\myindex.html
C:\jakarta-tomcat-3.2.1\WEBAPPS\ROOT\left.html
C:\jakarta-tomcat-3.2.1\WEBAPPS\ROOT\right.html
C:\jakarta-tomcat-3.2.1\WEBAPPS\ROOT\style.css (case sensitive Remember !! not style.css)
C:\jakarta-tomcat-3.2.1\WEBAPPS\ROOT\steam.gif (case sensitive Remember !! not style.css)
C:\jakarta-tomcat-3.2.1\WEBAPPS\ROOT\Andrew.jpg
C:\jakarta-tomcat-3.2.1\WEBAPPS\ROOT\James.jpg
C:\jakarta-tomcat-3.2.1\WEBAPPS\ROOT\Janet.jpg
C:\jakarta-tomcat-3.2.1\WEBAPPS\ROOT\Laura.jpg
C:\jakarta-tomcat-3.2.1\WEBAPPS\ROOT\Margaret.jpg
C:\jakarta-tomcat-3.2.1\WEBAPPS\ROOT\Michael.jpg
C:\jakarta-tomcat-3.2.1\WEBAPPS\ROOT\Nancy.jpg
C:\jakarta-tomcat-3.2.1\WEBAPPS\ROOT\Robert.jpg
C:\jakarta-tomcat-3.2.1\WEBAPPS\ROOT\Steven.jpg
Step 11: copy these files into this location ------------------------------------->
C:\jakarta-tomcat-3.2.1\WEBAPPS\EXAMPLES\WEB-INF\CLASSES\addrec.java
javac addrec.java
C:\jakarta-tomcat-3.2.1\WEBAPPS\EXAMPLES\WEB-INF\CLASSES\addrecresp.java
javac addrecresp.java
C:\jakarta-tomcat-3.2.1\WEBAPPS\EXAMPLES\WEB-INF\CLASSES\modrec.java
javac modrec.java
C:\jakarta-tomcat-3.2.1\WEBAPPS\EXAMPLES\WEB-INF\CLASSES\modrecresp.java
javac modrecresp.java
C:\jakarta-tomcat-3.2.1\WEBAPPS\EXAMPLES\WEB-INF\CLASSES\modrecresp2.java
javac modrecresp2.java
C:\jakarta-tomcat-3.2.1\WEBAPPS\EXAMPLES\WEB-INF\CLASSES\delrec.java
javac delrec.java
C:\jakarta-tomcat-3.2.1\WEBAPPS\EXAMPLES\WEB-INF\CLASSES\delrecresp.java
javac delrecresp.java
C:\jakarta-tomcat-3.2.1\WEBAPPS\EXAMPLES\WEB-INF\CLASSES\showall.java
javac showall.java
*********** PHASE 3 ODBC Settings ********************************************************
step 12 : click control panel
step 13 : ODBC Data Sources
step 14 : click UserDSN Tab
step 15 : click ADD Button , Select Microsoft Access Driver , Finish
step 16 : Give Datasource Name as "james" , no double quotes
step 17 : use Select and select james.mdb from c:\james\james.mdb
click ok , ok finish
*********** RUN THE WEB SERVER ************************************************************
step 18 : cd c:\jakarta-tomcat-3.2.1\bin
startup.bat (or) startup
================================================================================================
*/
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.sql.*;
public class delrec extends HttpServlet
{
public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
{
response.setContentType("text/html");
PrintWriter out = response.getWriter();
java.util.Properties props = new java.util.Properties();
props.put("user", " ");
props.put("password", " ");
String driverName = "sun.jdbc.odbc.JdbcOdbcDriver";
String connectionURL = "jdbc:odbc:james";
out.println("");
out.println("");
out.println("");
out.println("
out.println("");
//===================================================Start Java Script ====================
out.println(" ");
//---------------------------------------------------End Java Script ----------------------
out.println("");
out.println("");
buildtabledel(driverName,connectionURL,props,out);
out.println("");
out.println("");
}
void buildtabledel(String driverName,String connectionURL, java.util.Properties props, PrintWriter out)
{
out.println("");
}
void listregid(String driverName,String connectionURL, java.util.Properties props, PrintWriter out)
{
String query = "SELECT * FROM student_det";
boolean rc = true;
Connection con = null;
Statement stmt = null;
ResultSet rs = null;
int rowCount = 0;
try
{
Class.forName(driverName).newInstance();
con = DriverManager.getConnection(connectionURL, props);
stmt = con.createStatement();
rs = stmt.executeQuery(query);
out.println(" ");
}
catch (Exception ex)
{
out.println("Exception!");
ex.printStackTrace(out);
rc = false;
}
finally
{
try
{
if (rs != null)
{
rs.close();
}
if (stmt != null)
{
stmt.close();
}
if (con != null)
{
con.close();
}
}
catch (Exception ex)
{
// Do Nothing here
}
}
}
}
//DELETE Recresp
/*
-----------------Very import please read installation instructions------------------------------
Code By : James Smith Kelleher
Email me : james_smith73@yahoo.com
================================================================================================
*********** PHASE 1 INSTALLING JAKARTA TOMCAT 3.2.1 (OPTIONAL on WIN 98) **********************
DOWNLOAD ------------------------------------------------------------------>
Step 1: Read http://jakarta.apache.org/tomcat/tomcat-3.2-doc/index.html
Step 2: If u dont get this zip file "jakarta-tomcat-3.2.1.zip" download it from here (best version i feel)
Step 3: http://www.geocities.com/james_smith73/jakarta-tomcat-3.2.1.zip
INSTALL ------------------------------------------------------------------->
Step 4: unzip this "jakarta-tomcat-3.2.1.zip" to this location "c:\jakarta-tomcat-3.2.1"
Step 5: Right Click your MSDOS icon , Properties , Click on Memory Tab , set Initial Environment 2816
Autoexec.bat -------------------------------------------------------------->
Step 6: Edit your C:\Autoexec.bat as shown below
====================================================
SET JAVA_HOME=c:\jdk1.2.1
SET TOMCAT_HOME=c:\jakarta-tomcat-3.2.1
SET PATH=c:\windows;c:\windows\command;c:\jdk1.2.1\bin;c:\
SET CLASSPATH=c:\jakarta-tomcat-3.2.1\lib\ant.jar;c:\jakarta-tomcat-3.2.1\lib\jaxp.jar;c:\jakarta-tomcat-3.2.1\lib\servlet.jar;c:\jakarta-tomcat-3.2.1\lib\parser.jar;c:\jakarta-tomcat-3.2.1\lib\webserver.jar;c:\jakarta-tomcat-3.2.1\lib\jasper.jar
====================================================
Step 7: Save settings and Restart your Computer
*********** PHASE 2 SETTINGUP SERVLETS ********************************************************
Step 8: Download http://www.geocities.com/james_smith73
Download Menu ----> james2.zip
Step 9: unzip to c:\temp or anyother folder of ur choice
Step 10: copy these files into this location
C:\jakarta-tomcat-3.2.1\WEBAPPS\ROOT\myindex.html
C:\jakarta-tomcat-3.2.1\WEBAPPS\ROOT\left.html
C:\jakarta-tomcat-3.2.1\WEBAPPS\ROOT\right.html
C:\jakarta-tomcat-3.2.1\WEBAPPS\ROOT\style.css (case sensitive Remember !! not style.css)
C:\jakarta-tomcat-3.2.1\WEBAPPS\ROOT\steam.gif (case sensitive Remember !! not style.css)
C:\jakarta-tomcat-3.2.1\WEBAPPS\ROOT\Andrew.jpg
C:\jakarta-tomcat-3.2.1\WEBAPPS\ROOT\James.jpg
C:\jakarta-tomcat-3.2.1\WEBAPPS\ROOT\Janet.jpg
C:\jakarta-tomcat-3.2.1\WEBAPPS\ROOT\Laura.jpg
C:\jakarta-tomcat-3.2.1\WEBAPPS\ROOT\Margaret.jpg
C:\jakarta-tomcat-3.2.1\WEBAPPS\ROOT\Michael.jpg
C:\jakarta-tomcat-3.2.1\WEBAPPS\ROOT\Nancy.jpg
C:\jakarta-tomcat-3.2.1\WEBAPPS\ROOT\Robert.jpg
C:\jakarta-tomcat-3.2.1\WEBAPPS\ROOT\Steven.jpg
Step 11: copy these files into this location ------------------------------------->
C:\jakarta-tomcat-3.2.1\WEBAPPS\EXAMPLES\WEB-INF\CLASSES\addrec.java
javac addrec.java
C:\jakarta-tomcat-3.2.1\WEBAPPS\EXAMPLES\WEB-INF\CLASSES\addrecresp.java
javac addrecresp.java
C:\jakarta-tomcat-3.2.1\WEBAPPS\EXAMPLES\WEB-INF\CLASSES\modrec.java
javac modrec.java
C:\jakarta-tomcat-3.2.1\WEBAPPS\EXAMPLES\WEB-INF\CLASSES\modrecresp.java
javac modrecresp.java
C:\jakarta-tomcat-3.2.1\WEBAPPS\EXAMPLES\WEB-INF\CLASSES\modrecresp2.java
javac modrecresp2.java
C:\jakarta-tomcat-3.2.1\WEBAPPS\EXAMPLES\WEB-INF\CLASSES\delrec.java
javac delrec.java
C:\jakarta-tomcat-3.2.1\WEBAPPS\EXAMPLES\WEB-INF\CLASSES\delrecresp.java
javac delrecresp.java
C:\jakarta-tomcat-3.2.1\WEBAPPS\EXAMPLES\WEB-INF\CLASSES\showall.java
javac showall.java
*********** PHASE 3 ODBC Settings ********************************************************
step 12 : click control panel
step 13 : ODBC Data Sources
step 14 : click UserDSN Tab
step 15 : click ADD Button , Select Microsoft Access Driver , Finish
step 16 : Give Datasource Name as "james" , no double quotes
step 17 : use Select and select james.mdb from c:\james\james.mdb
click ok , ok finish
*********** RUN THE WEB SERVER ************************************************************
step 18 : cd c:\jakarta-tomcat-3.2.1\bin
startup.bat (or) startup
================================================================================================
*/
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.sql.*;
public class delrecresp extends HttpServlet
{
public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
{
response.setContentType("text/html");
PrintWriter out = response.getWriter();
java.util.Properties props = new java.util.Properties();
props.put("user", " ");
props.put("password", " ");
String driverName = "sun.jdbc.odbc.JdbcOdbcDriver";
String connectionURL = "jdbc:odbc:james";
String studentidin = request.getParameter("studentid");
out.println("");
out.println("");
out.println("");
out.println("
out.println("");
//===================================================Start Java Script ====================
out.println(" ");
//---------------------------------------------------End Java Script ----------------------
out.println("");
out.println("");
out.println("");
out.println("");
out.println("");
}
void listregid2(String driverName,String connectionURL, java.util.Properties props, PrintWriter out, String studentidin)
{
String query = "DELETE FROM student_det WHERE studentID='"+studentidin+"'";
boolean rc = true;
Connection con = null;
Statement stmt = null;
ResultSet rs = null;
int rowCount = 0;
try
{
Class.forName(driverName).newInstance();
con = DriverManager.getConnection(connectionURL, props);
stmt = con.createStatement();
stmt.executeUpdate(query);
}
catch (Exception ex)
{
out.println("Exception!");
ex.printStackTrace(out);
rc = false;
}
finally
{
try
{
if (rs != null)
{
rs.close();
}
if (stmt != null)
{
stmt.close();
}
if (con != null)
{
con.close();
}
}
catch (Exception ex)
{
// Do Nothing here
}
}
}
void buildtabledel(String driverName,String connectionURL, java.util.Properties props, PrintWriter out)
{
out.println("");
}
void listregid(String driverName,String connectionURL, java.util.Properties props, PrintWriter out)
{
String query = "SELECT * FROM student_det";
boolean rc = true;
Connection con = null;
Statement stmt = null;
ResultSet rs = null;
int rowCount = 0;
out.println("
" + rsmd.getColumnLabel(i + 1) + " | ");|
"+tempval+" | ");"+rs.getString(i+1)+" | ");
}
catch (Exception ex)
{
out.println("Exception!");
ex.printStackTrace(out);
rc = false;
}
finally
{
try
{
if (rs != null)
{
rs.close();
}
if (stmt != null)
{
stmt.close();
}
if (con != null)
{
con.close();
}
}
catch (Exception ex)
{
// Do Nothing here
}
}
}
}
//MODREC
/*
-----------------Very import please read installation instructions------------------------------
Code By : James Smith Kelleher
Email me : james_smith73@yahoo.com
================================================================================================
*********** PHASE 1 INSTALLING JAKARTA TOMCAT 3.2.1 (OPTIONAL on WIN 98) **********************
DOWNLOAD ------------------------------------------------------------------>
Step 1: Read http://jakarta.apache.org/tomcat/tomcat-3.2-doc/index.html
Step 2: If u dont get this zip file "jakarta-tomcat-3.2.1.zip" download it from here (best version i feel)
Step 3: http://www.geocities.com/james_smith73/jakarta-tomcat-3.2.1.zip
INSTALL ------------------------------------------------------------------->
Step 4: unzip this "jakarta-tomcat-3.2.1.zip" to this location "c:\jakarta-tomcat-3.2.1"
Step 5: Right Click your MSDOS icon , Properties , Click on Memory Tab , set Initial Environment 2816
Autoexec.bat -------------------------------------------------------------->
Step 6: Edit your C:\Autoexec.bat as shown below
====================================================
SET JAVA_HOME=c:\jdk1.2.1
SET TOMCAT_HOME=c:\jakarta-tomcat-3.2.1
SET PATH=c:\windows;c:\windows\command;c:\jdk1.2.1\bin;c:\
SET CLASSPATH=c:\jakarta-tomcat-3.2.1\lib\ant.jar;c:\jakarta-tomcat-3.2.1\lib\jaxp.jar;c:\jakarta-tomcat-3.2.1\lib\servlet.jar;c:\jakarta-tomcat-3.2.1\lib\parser.jar;c:\jakarta-tomcat-3.2.1\lib\webserver.jar;c:\jakarta-tomcat-3.2.1\lib\jasper.jar
====================================================
Step 7: Save settings and Restart your Computer
*********** PHASE 2 SETTINGUP SERVLETS ********************************************************
Step 8: Download http://www.geocities.com/james_smith73
Download Menu ----> james2.zip
Step 9: unzip to c:\temp or anyother folder of ur choice
Step 10: copy these files into this location
C:\jakarta-tomcat-3.2.1\WEBAPPS\ROOT\myindex.html
C:\jakarta-tomcat-3.2.1\WEBAPPS\ROOT\left.html
C:\jakarta-tomcat-3.2.1\WEBAPPS\ROOT\right.html
C:\jakarta-tomcat-3.2.1\WEBAPPS\ROOT\style.css (case sensitive Remember !! not style.css)
C:\jakarta-tomcat-3.2.1\WEBAPPS\ROOT\steam.gif (case sensitive Remember !! not style.css)
C:\jakarta-tomcat-3.2.1\WEBAPPS\ROOT\Andrew.jpg
C:\jakarta-tomcat-3.2.1\WEBAPPS\ROOT\James.jpg
C:\jakarta-tomcat-3.2.1\WEBAPPS\ROOT\Janet.jpg
C:\jakarta-tomcat-3.2.1\WEBAPPS\ROOT\Laura.jpg
C:\jakarta-tomcat-3.2.1\WEBAPPS\ROOT\Margaret.jpg
C:\jakarta-tomcat-3.2.1\WEBAPPS\ROOT\Michael.jpg
C:\jakarta-tomcat-3.2.1\WEBAPPS\ROOT\Nancy.jpg
C:\jakarta-tomcat-3.2.1\WEBAPPS\ROOT\Robert.jpg
C:\jakarta-tomcat-3.2.1\WEBAPPS\ROOT\Steven.jpg
Step 11: copy these files into this location ------------------------------------->
C:\jakarta-tomcat-3.2.1\WEBAPPS\EXAMPLES\WEB-INF\CLASSES\addrec.java
javac addrec.java
C:\jakarta-tomcat-3.2.1\WEBAPPS\EXAMPLES\WEB-INF\CLASSES\addrecresp.java
javac addrecresp.java
C:\jakarta-tomcat-3.2.1\WEBAPPS\EXAMPLES\WEB-INF\CLASSES\modrec.java
javac modrec.java
C:\jakarta-tomcat-3.2.1\WEBAPPS\EXAMPLES\WEB-INF\CLASSES\modrecresp.java
javac modrecresp.java
C:\jakarta-tomcat-3.2.1\WEBAPPS\EXAMPLES\WEB-INF\CLASSES\modrecresp2.java
javac modrecresp2.java
C:\jakarta-tomcat-3.2.1\WEBAPPS\EXAMPLES\WEB-INF\CLASSES\delrec.java
javac delrec.java
C:\jakarta-tomcat-3.2.1\WEBAPPS\EXAMPLES\WEB-INF\CLASSES\delrecresp.java
javac delrecresp.java
C:\jakarta-tomcat-3.2.1\WEBAPPS\EXAMPLES\WEB-INF\CLASSES\showall.java
javac showall.java
*********** PHASE 3 ODBC Settings ********************************************************
step 12 : click control panel
step 13 : ODBC Data Sources
step 14 : click UserDSN Tab
step 15 : click ADD Button , Select Microsoft Access Driver , Finish
step 16 : Give Datasource Name as "james" , no double quotes
step 17 : use Select and select james.mdb from c:\james\james.mdb
click ok , ok finish
*********** RUN THE WEB SERVER ************************************************************
step 18 : cd c:\jakarta-tomcat-3.2.1\bin
startup.bat (or) startup
================================================================================================
*/
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.sql.*;
public class modrec extends HttpServlet
{
public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
{
response.setContentType("text/html");
PrintWriter out = response.getWriter();
java.util.Properties props = new java.util.Properties();
props.put("user", " ");
props.put("password", " ");
String driverName = "sun.jdbc.odbc.JdbcOdbcDriver";
String connectionURL = "jdbc:odbc:james";
out.println("");
out.println("");
out.println("");
out.println("
out.println("");
//===================================================Start Java Script ====================
out.println(" ");
//---------------------------------------------------End Java Script ----------------------
out.println("");
out.println("");
out.println("");
out.println("");
out.println("");
}
void buildtablemod(String driverName,String connectionURL, java.util.Properties props, PrintWriter out)
{
out.println("
MODIFY RECORD MODULE ");
listregid(driverName,connectionURL,props,out); out.println(" | ");
||||||||||||||||||||
");
out.println("
out.println(" | ");
}
void listregid(String driverName,String connectionURL, java.util.Properties props, PrintWriter out)
{
String query = "SELECT * FROM student_det";
boolean rc = true;
Connection con = null;
Statement stmt = null;
ResultSet rs = null;
int rowCount = 0;
try
{
Class.forName(driverName).newInstance();
con = DriverManager.getConnection(connectionURL, props);
stmt = con.createStatement();
rs = stmt.executeQuery(query);
out.println(" ");
}
catch (Exception ex)
{
out.println("Exception!");
ex.printStackTrace(out);
rc = false;
}
finally
{
try
{
if (rs != null)
{
rs.close();
}
if (stmt != null)
{
stmt.close();
}
if (con != null)
{
con.close();
}
}
catch (Exception ex)
{
// Do Nothing here
}
}
}
}
//MODRECresp
/*
-----------------Very import please read installation instructions------------------------------
Code By : James Smith Kelleher
Email me : james_smith73@yahoo.com
================================================================================================
*********** PHASE 1 INSTALLING JAKARTA TOMCAT 3.2.1 (OPTIONAL on WIN 98) **********************
DOWNLOAD ------------------------------------------------------------------>
Step 1: Read http://jakarta.apache.org/tomcat/tomcat-3.2-doc/index.html
Step 2: If u dont get this zip file "jakarta-tomcat-3.2.1.zip" download it from here (best version i feel)
Step 3: http://www.geocities.com/james_smith73/jakarta-tomcat-3.2.1.zip
INSTALL ------------------------------------------------------------------->
Step 4: unzip this "jakarta-tomcat-3.2.1.zip" to this location "c:\jakarta-tomcat-3.2.1"
Step 5: Right Click your MSDOS icon , Properties , Click on Memory Tab , set Initial Environment 2816
Autoexec.bat -------------------------------------------------------------->
Step 6: Edit your C:\Autoexec.bat as shown below
====================================================
SET JAVA_HOME=c:\jdk1.2.1
SET TOMCAT_HOME=c:\jakarta-tomcat-3.2.1
SET PATH=c:\windows;c:\windows\command;c:\jdk1.2.1\bin;c:\
SET CLASSPATH=c:\jakarta-tomcat-3.2.1\lib\ant.jar;c:\jakarta-tomcat-3.2.1\lib\jaxp.jar;c:\jakarta-tomcat-3.2.1\lib\servlet.jar;c:\jakarta-tomcat-3.2.1\lib\parser.jar;c:\jakarta-tomcat-3.2.1\lib\webserver.jar;c:\jakarta-tomcat-3.2.1\lib\jasper.jar
====================================================
Step 7: Save settings and Restart your Computer
*********** PHASE 2 SETTINGUP SERVLETS ********************************************************
Step 8: Download http://www.geocities.com/james_smith73
Download Menu ----> james2.zip
Step 9: unzip to c:\temp or anyother folder of ur choice
Step 10: copy these files into this location
C:\jakarta-tomcat-3.2.1\WEBAPPS\ROOT\myindex.html
C:\jakarta-tomcat-3.2.1\WEBAPPS\ROOT\left.html
C:\jakarta-tomcat-3.2.1\WEBAPPS\ROOT\right.html
C:\jakarta-tomcat-3.2.1\WEBAPPS\ROOT\style.css (case sensitive Remember !! not style.css)
C:\jakarta-tomcat-3.2.1\WEBAPPS\ROOT\steam.gif (case sensitive Remember !! not style.css)
C:\jakarta-tomcat-3.2.1\WEBAPPS\ROOT\Andrew.jpg
C:\jakarta-tomcat-3.2.1\WEBAPPS\ROOT\James.jpg
C:\jakarta-tomcat-3.2.1\WEBAPPS\ROOT\Janet.jpg
C:\jakarta-tomcat-3.2.1\WEBAPPS\ROOT\Laura.jpg
C:\jakarta-tomcat-3.2.1\WEBAPPS\ROOT\Margaret.jpg
C:\jakarta-tomcat-3.2.1\WEBAPPS\ROOT\Michael.jpg
C:\jakarta-tomcat-3.2.1\WEBAPPS\ROOT\Nancy.jpg
C:\jakarta-tomcat-3.2.1\WEBAPPS\ROOT\Robert.jpg
C:\jakarta-tomcat-3.2.1\WEBAPPS\ROOT\Steven.jpg
Step 11: copy these files into this location ------------------------------------->
C:\jakarta-tomcat-3.2.1\WEBAPPS\EXAMPLES\WEB-INF\CLASSES\addrec.java
javac addrec.java
C:\jakarta-tomcat-3.2.1\WEBAPPS\EXAMPLES\WEB-INF\CLASSES\addrecresp.java
javac addrecresp.java
C:\jakarta-tomcat-3.2.1\WEBAPPS\EXAMPLES\WEB-INF\CLASSES\modrec.java
javac modrec.java
C:\jakarta-tomcat-3.2.1\WEBAPPS\EXAMPLES\WEB-INF\CLASSES\modrecresp.java
javac modrecresp.java
C:\jakarta-tomcat-3.2.1\WEBAPPS\EXAMPLES\WEB-INF\CLASSES\modrecresp2.java
javac modrecresp2.java
C:\jakarta-tomcat-3.2.1\WEBAPPS\EXAMPLES\WEB-INF\CLASSES\delrec.java
javac delrec.java
C:\jakarta-tomcat-3.2.1\WEBAPPS\EXAMPLES\WEB-INF\CLASSES\delrecresp.java
javac delrecresp.java
C:\jakarta-tomcat-3.2.1\WEBAPPS\EXAMPLES\WEB-INF\CLASSES\showall.java
javac showall.java
*********** PHASE 3 ODBC Settings ********************************************************
step 12 : click control panel
step 13 : ODBC Data Sources
step 14 : click UserDSN Tab
step 15 : click ADD Button , Select Microsoft Access Driver , Finish
step 16 : Give Datasource Name as "james" , no double quotes
step 17 : use Select and select james.mdb from c:\james\james.mdb
click ok , ok finish
*********** RUN THE WEB SERVER ************************************************************
step 18 : cd c:\jakarta-tomcat-3.2.1\bin
startup.bat (or) startup
================================================================================================
*/
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.sql.*;
public class modrecresp extends HttpServlet
{
public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
{
response.setContentType("text/html");
PrintWriter out = response.getWriter();
java.util.Properties props = new java.util.Properties();
props.put("user", " ");
props.put("password", " ");
String driverName = "sun.jdbc.odbc.JdbcOdbcDriver";
String connectionURL = "jdbc:odbc:james";
String studentidin = request.getParameter("studentid");
out.println("");
out.println("");
out.println("");
out.println("
out.println("");
//===================================================Start Java Script ====================
out.println(" ");
//---------------------------------------------------End Java Script ----------------------
out.println("");
out.println("");
out.println("");
out.println("");
out.println("");
}
void buildtablemod2(String driverName,String connectionURL, java.util.Properties props, PrintWriter out, String studentidin)
{
String query = "SELECT * FROM student_det WHERE studentID='"+studentidin+"'";
boolean rc = true;
Connection con = null;
Statement stmt = null;
ResultSet rs = null;
int rowCount = 0;
String tempname="";
String tempaddr="";
String fname="";
String imname="steam.gif";
String malesel="unchecked";
String femalesel="unchecked";
String sex="";
String yearsel="1st PUC";
String Sectionsel="Section A";
int SSLCsel=0;
String SSLCchk="";
int PHOTOsel=0;
String PHOTOchk="";
int CHARCERTsel=0;
String CHARCERTchk="";
int NCCCERTsel=0;
String NCCCERTchk="";
try
{
Class.forName(driverName).newInstance();
con = DriverManager.getConnection(connectionURL, props);
stmt = con.createStatement();
rs = stmt.executeQuery(query);
while (rs.next())
{
tempname = rs.getString(3);
tempaddr = rs.getString(4);
fname = rs.getString(5);
sex = rs.getString(6).trim();
imname = rs.getString(13);
yearsel = rs.getString(7).trim();
Sectionsel = rs.getString(8).trim();
SSLCsel = rs.getInt(9);
PHOTOsel = rs.getInt(10);
CHARCERTsel = rs.getInt(11);
NCCCERTsel = rs.getInt(12);
if(sex.equals("Male"))
{
malesel="checked";
}
else
{
femalesel="checked";
}
if(SSLCsel==1)
{
SSLCchk="checked";
}
if(PHOTOsel==1)
{
PHOTOchk="checked";
}
if(CHARCERTsel==1)
{
CHARCERTchk="checked";
}
if(NCCCERTsel==1)
{
NCCCERTchk="checked";
}
}
}
catch (Exception ex)
{
out.println("Exception!");
ex.printStackTrace(out);
rc = false;
}
finally
{
try
{
if (rs != null)
{
rs.close();
}
if (stmt != null)
{
stmt.close();
}
if (con != null)
{
con.close();
}
}
catch (Exception ex)
{
// Do Nothing here
}
}
out.println("
MODIFY RECORD MODULE ");
listregid2(driverName,connectionURL,props,out,studentidin); out.println(" | ");
||||||||||||||||||||
");
out.println("
out.println(" | ");
}
void listregid2(String driverName,String connectionURL, java.util.Properties props, PrintWriter out, String studentidin)
{
//-------------------- Start
String query = "SELECT * FROM student_det ";
boolean rc = true;
Connection con = null;
Statement stmt = null;
ResultSet rs = null;
int rowCount = 0;
try
{
Class.forName(driverName).newInstance();
con = DriverManager.getConnection(connectionURL, props);
stmt = con.createStatement();
rs = stmt.executeQuery(query);
out.println(" ");
}
catch (Exception ex)
{
out.println("Exception!");
ex.printStackTrace(out);
rc = false;
}
finally
{
try
{
if (rs != null)
{
rs.close();
}
if (stmt != null)
{
stmt.close();
}
if (con != null)
{
con.close();
}
}
catch (Exception ex)
{
// Do Nothing here
}
}
}
}
//modrecresp2
/*
-----------------Very import please read installation instructions------------------------------
Code By : James Smith Kelleher
Email me : james_smith73@yahoo.com
================================================================================================
*********** PHASE 1 INSTALLING JAKARTA TOMCAT 3.2.1 (OPTIONAL on WIN 98) **********************
DOWNLOAD ------------------------------------------------------------------>
Step 1: Read http://jakarta.apache.org/tomcat/tomcat-3.2-doc/index.html
Step 2: If u dont get this zip file "jakarta-tomcat-3.2.1.zip" download it from here (best version i feel)
Step 3: http://www.geocities.com/james_smith73/jakarta-tomcat-3.2.1.zip
INSTALL ------------------------------------------------------------------->
Step 4: unzip this "jakarta-tomcat-3.2.1.zip" to this location "c:\jakarta-tomcat-3.2.1"
Step 5: Right Click your MSDOS icon , Properties , Click on Memory Tab , set Initial Environment 2816
Autoexec.bat -------------------------------------------------------------->
Step 6: Edit your C:\Autoexec.bat as shown below
====================================================
SET JAVA_HOME=c:\jdk1.2.1
SET TOMCAT_HOME=c:\jakarta-tomcat-3.2.1
SET PATH=c:\windows;c:\windows\command;c:\jdk1.2.1\bin;c:\
SET CLASSPATH=c:\jakarta-tomcat-3.2.1\lib\ant.jar;c:\jakarta-tomcat-3.2.1\lib\jaxp.jar;c:\jakarta-tomcat-3.2.1\lib\servlet.jar;c:\jakarta-tomcat-3.2.1\lib\parser.jar;c:\jakarta-tomcat-3.2.1\lib\webserver.jar;c:\jakarta-tomcat-3.2.1\lib\jasper.jar
====================================================
Step 7: Save settings and Restart your Computer
*********** PHASE 2 SETTINGUP SERVLETS ********************************************************
Step 8: Download http://www.geocities.com/james_smith73/james2.zip
Step 9: unzip to c:\temp or anyother folder of ur choice
Step 10: copy these files into this location
C:\jakarta-tomcat-3.2.1\WEBAPPS\ROOT\myindex.html
C:\jakarta-tomcat-3.2.1\WEBAPPS\ROOT\left.html
C:\jakarta-tomcat-3.2.1\WEBAPPS\ROOT\right.html
C:\jakarta-tomcat-3.2.1\WEBAPPS\ROOT\style.css (case sensitive Remember !! not style.css)
C:\jakarta-tomcat-3.2.1\WEBAPPS\ROOT\steam.gif (case sensitive Remember !! not style.css)
C:\jakarta-tomcat-3.2.1\WEBAPPS\ROOT\Andrew.jpg
C:\jakarta-tomcat-3.2.1\WEBAPPS\ROOT\James.jpg
C:\jakarta-tomcat-3.2.1\WEBAPPS\ROOT\Janet.jpg
C:\jakarta-tomcat-3.2.1\WEBAPPS\ROOT\Laura.jpg
C:\jakarta-tomcat-3.2.1\WEBAPPS\ROOT\Margaret.jpg
C:\jakarta-tomcat-3.2.1\WEBAPPS\ROOT\Michael.jpg
C:\jakarta-tomcat-3.2.1\WEBAPPS\ROOT\Nancy.jpg
C:\jakarta-tomcat-3.2.1\WEBAPPS\ROOT\Robert.jpg
C:\jakarta-tomcat-3.2.1\WEBAPPS\ROOT\Steven.jpg
Step 11: copy these files into this location ------------------------------------->
C:\jakarta-tomcat-3.2.1\WEBAPPS\EXAMPLES\WEB-INF\CLASSES\addrec.java
javac addrec.java
C:\jakarta-tomcat-3.2.1\WEBAPPS\EXAMPLES\WEB-INF\CLASSES\addrecresp.java
javac addrecresp.java
C:\jakarta-tomcat-3.2.1\WEBAPPS\EXAMPLES\WEB-INF\CLASSES\modrec.java
javac modrec.java
C:\jakarta-tomcat-3.2.1\WEBAPPS\EXAMPLES\WEB-INF\CLASSES\modrecresp.java
javac modrecresp.java
C:\jakarta-tomcat-3.2.1\WEBAPPS\EXAMPLES\WEB-INF\CLASSES\modrecresp2.java
javac modrecresp2.java
C:\jakarta-tomcat-3.2.1\WEBAPPS\EXAMPLES\WEB-INF\CLASSES\delrec.java
javac delrec.java
C:\jakarta-tomcat-3.2.1\WEBAPPS\EXAMPLES\WEB-INF\CLASSES\delrecresp.java
javac delrecresp.java
C:\jakarta-tomcat-3.2.1\WEBAPPS\EXAMPLES\WEB-INF\CLASSES\showall.java
javac showall.java
*********** PHASE 3 ODBC Settings ********************************************************
step 12 : click control panel
step 13 : ODBC Data Sources
step 14 : click UserDSN Tab
step 15 : click ADD Button , Select Microsoft Access Driver , Finish
step 16 : Give Datasource Name as "james" , no double quotes
step 17 : use Select and select james.mdb from c:\james\james.mdb
click ok , ok finish
*********** RUN THE WEB SERVER ************************************************************
step 18 : cd c:\jakarta-tomcat-3.2.1\bin
startup.bat (or) startup
================================================================================================
*/
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.sql.*;
public class modrecresp2 extends HttpServlet
{
public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
{
response.setContentType("text/html");
PrintWriter out = response.getWriter();
java.util.Properties props = new java.util.Properties();
props.put("user", " ");
props.put("password", " ");
String driverName = "sun.jdbc.odbc.JdbcOdbcDriver";
String connectionURL = "jdbc:odbc:james";
String studentidin = request.getParameter("studentid");
out.println("");
out.println("");
out.println("");
out.println("
out.println("");
//===================================================Start Java Script ====================
out.println(" ");
//---------------------------------------------------End Java Script ----------------------
out.println("");
out.println("");
String Name = request.getParameter("sname");
String Address = request.getParameter("saddr");
String FName = request.getParameter("fname");
String Sex = request.getParameter("sex");
String Yearsel = request.getParameter("myclass");
String Sectionsel = request.getParameter("mysec");
String SSLC = request.getParameter("SSLC");
String PHOTO = request.getParameter("PHOTO");
String CHARCERT = request.getParameter("charCERT");
String NCCCERT = request.getParameter("nccCERT");
String imagename = request.getParameter("imname");
String sqlupd="UPDATE student_det SET Name='"+Name+"', Address='"+Address+"', FName='"+FName+"', Sex='"+Sex+"', Yearsel='"+Yearsel+"', Sectionsel='"+Sectionsel+"', SSLC="+SSLC+", PHOTO="+PHOTO+", CHARCERT="+CHARCERT+", NCCCERT="+NCCCERT+", imagename='"+imagename+"' WHERE StudentID='"+studentidin+"'";
updatedbmod(driverName,connectionURL,props,out,studentidin,sqlupd);
out.println("");
out.println("");
out.println("");
}
void buildtablemod2(String driverName,String connectionURL, java.util.Properties props, PrintWriter out, String studentidin)
{
String query = "SELECT * FROM student_det WHERE studentID='"+studentidin+"'";
boolean rc = true;
Connection con = null;
Statement stmt = null;
ResultSet rs = null;
int rowCount = 0;
String tempname="";
String tempaddr="";
String fname="";
String imname="steam.gif";
String malesel="unchecked";
String femalesel="unchecked";
String sex="";
String yearsel="1st PUC";
String Sectionsel="Section A";
int SSLCsel=0;
String SSLCchk="";
int PHOTOsel=0;
String PHOTOchk="";
int CHARCERTsel=0;
String CHARCERTchk="";
int NCCCERTsel=0;
String NCCCERTchk="";
try
{
Class.forName(driverName).newInstance();
con = DriverManager.getConnection(connectionURL, props);
stmt = con.createStatement();
rs = stmt.executeQuery(query);
while (rs.next())
{
tempname = rs.getString(3);
tempaddr = rs.getString(4);
fname = rs.getString(5);
sex = rs.getString(6).trim();
imname = rs.getString(13);
yearsel = rs.getString(7).trim();
Sectionsel = rs.getString(8).trim();
SSLCsel = rs.getInt(9);
PHOTOsel = rs.getInt(10);
CHARCERTsel = rs.getInt(11);
NCCCERTsel = rs.getInt(12);
if(sex.equals("Male"))
{
malesel="checked";
}
else
{
femalesel="checked";
}
if(SSLCsel==1)
{
SSLCchk="checked";
}
if(PHOTOsel==1)
{
PHOTOchk="checked";
}
if(CHARCERTsel==1)
{
CHARCERTchk="checked";
}
if(NCCCERTsel==1)
{
NCCCERTchk="checked";
}
}
}
catch (Exception ex)
{
out.println("Exception!");
ex.printStackTrace(out);
rc = false;
}
finally
{
try
{
if (rs != null)
{
rs.close();
}
if (stmt != null)
{
stmt.close();
}
if (con != null)
{
con.close();
}
}
catch (Exception ex)
{
// Do Nothing here
}
}
out.println("
MODIFY RECORD MODULE ");
listregid2(driverName,connectionURL,props,out,studentidin); out.println(" | ");
||||||||||||||||||||
");
out.println("
out.println(" | ");
}
void updatedbmod(String driverName,String connectionURL, java.util.Properties props, PrintWriter out, String studentidin, String sqlupd)
{
//-------------Start------------
boolean rc = true;
Connection con = null;
Statement stmt = null;
ResultSet rs = null;
int rowCount = 0;
try
{
Class.forName(driverName).newInstance();
con = DriverManager.getConnection(connectionURL, props);
stmt = con.createStatement();
stmt.executeUpdate(sqlupd);
}
catch (Exception ex)
{
out.println("Exception!");
ex.printStackTrace(out);
rc = false;
}
finally
{
try
{
if (rs != null)
{
rs.close();
}
if (stmt != null)
{
stmt.close();
}
if (con != null)
{
con.close();
}
}
catch (Exception ex)
{
// Do Nothing here
}
}
//--------------End------------*/
}
void listregid2(String driverName,String connectionURL, java.util.Properties props, PrintWriter out, String studentidin)
{
//-------------------- Start
String query = "SELECT * FROM student_det ";
boolean rc = true;
Connection con = null;
Statement stmt = null;
ResultSet rs = null;
int rowCount = 0;
try
{
Class.forName(driverName).newInstance();
con = DriverManager.getConnection(connectionURL, props);
stmt = con.createStatement();
rs = stmt.executeQuery(query);
out.println(" ");
}
catch (Exception ex)
{
out.println("Exception!");
ex.printStackTrace(out);
rc = false;
}
finally
{
try
{
if (rs != null)
{
rs.close();
}
if (stmt != null)
{
stmt.close();
}
if (con != null)
{
con.close();
}
}
catch (Exception ex)
{
// Do Nothing here
}
}
}
}
//Show all
/*
-----------------Very import please read installation instructions------------------------------
Code By : James Smith Kelleher
Email me : james_smith73@yahoo.com
================================================================================================
*********** PHASE 1 INSTALLING JAKARTA TOMCAT 3.2.1 (OPTIONAL on WIN 98) **********************
DOWNLOAD ------------------------------------------------------------------>
Step 1: Read http://jakarta.apache.org/tomcat/tomcat-3.2-doc/index.html
Step 2: If u dont get this zip file "jakarta-tomcat-3.2.1.zip" download it from here (best version i feel)
Step 3: http://www.geocities.com/james_smith73/jakarta-tomcat-3.2.1.zip
INSTALL ------------------------------------------------------------------->
Step 4: unzip this "jakarta-tomcat-3.2.1.zip" to this location "c:\jakarta-tomcat-3.2.1"
Step 5: Right Click your MSDOS icon , Properties , Click on Memory Tab , set Initial Environment 2816
Autoexec.bat -------------------------------------------------------------->
Step 6: Edit your C:\Autoexec.bat as shown below
====================================================
SET JAVA_HOME=c:\jdk1.2.1
SET TOMCAT_HOME=c:\jakarta-tomcat-3.2.1
SET PATH=c:\windows;c:\windows\command;c:\jdk1.2.1\bin;c:\
SET CLASSPATH=c:\jakarta-tomcat-3.2.1\lib\ant.jar;c:\jakarta-tomcat-3.2.1\lib\jaxp.jar;c:\jakarta-tomcat-3.2.1\lib\servlet.jar;c:\jakarta-tomcat-3.2.1\lib\parser.jar;c:\jakarta-tomcat-3.2.1\lib\webserver.jar;c:\jakarta-tomcat-3.2.1\lib\jasper.jar
====================================================
Step 7: Save settings and Restart your Computer
*********** PHASE 2 SETTINGUP SERVLETS ********************************************************
Step 8: Download http://www.geocities.com/james_smith73
Download Menu ----> james2.zip
Step 9: unzip to c:\temp or anyother folder of ur choice
Step 10: copy these files into this location
C:\jakarta-tomcat-3.2.1\WEBAPPS\ROOT\myindex.html
C:\jakarta-tomcat-3.2.1\WEBAPPS\ROOT\left.html
C:\jakarta-tomcat-3.2.1\WEBAPPS\ROOT\right.html
C:\jakarta-tomcat-3.2.1\WEBAPPS\ROOT\style.css (case sensitive Remember !! not style.css)
C:\jakarta-tomcat-3.2.1\WEBAPPS\ROOT\steam.gif (case sensitive Remember !! not style.css)
C:\jakarta-tomcat-3.2.1\WEBAPPS\ROOT\Andrew.jpg
C:\jakarta-tomcat-3.2.1\WEBAPPS\ROOT\James.jpg
C:\jakarta-tomcat-3.2.1\WEBAPPS\ROOT\Janet.jpg
C:\jakarta-tomcat-3.2.1\WEBAPPS\ROOT\Laura.jpg
C:\jakarta-tomcat-3.2.1\WEBAPPS\ROOT\Margaret.jpg
C:\jakarta-tomcat-3.2.1\WEBAPPS\ROOT\Michael.jpg
C:\jakarta-tomcat-3.2.1\WEBAPPS\ROOT\Nancy.jpg
C:\jakarta-tomcat-3.2.1\WEBAPPS\ROOT\Robert.jpg
C:\jakarta-tomcat-3.2.1\WEBAPPS\ROOT\Steven.jpg
Step 11: copy these files into this location ------------------------------------->
C:\jakarta-tomcat-3.2.1\WEBAPPS\EXAMPLES\WEB-INF\CLASSES\addrec.java
javac addrec.java
C:\jakarta-tomcat-3.2.1\WEBAPPS\EXAMPLES\WEB-INF\CLASSES\addrecresp.java
javac addrecresp.java
C:\jakarta-tomcat-3.2.1\WEBAPPS\EXAMPLES\WEB-INF\CLASSES\modrec.java
javac modrec.java
C:\jakarta-tomcat-3.2.1\WEBAPPS\EXAMPLES\WEB-INF\CLASSES\modrecresp.java
javac modrecresp.java
C:\jakarta-tomcat-3.2.1\WEBAPPS\EXAMPLES\WEB-INF\CLASSES\modrecresp2.java
javac modrecresp2.java
C:\jakarta-tomcat-3.2.1\WEBAPPS\EXAMPLES\WEB-INF\CLASSES\delrec.java
javac delrec.java
C:\jakarta-tomcat-3.2.1\WEBAPPS\EXAMPLES\WEB-INF\CLASSES\delrecresp.java
javac delrecresp.java
C:\jakarta-tomcat-3.2.1\WEBAPPS\EXAMPLES\WEB-INF\CLASSES\showall.java
javac showall.java
*********** PHASE 3 ODBC Settings ********************************************************
step 12 : click control panel
step 13 : ODBC Data Sources
step 14 : click UserDSN Tab
step 15 : click ADD Button , Select Microsoft Access Driver , Finish
step 16 : Give Datasource Name as "james" , no double quotes
step 17 : use Select and select james.mdb from c:\james\james.mdb
click ok , ok finish
*********** RUN THE WEB SERVER ************************************************************
step 18 : cd c:\jakarta-tomcat-3.2.1\bin
startup.bat (or) startup
================================================================================================
*/
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.sql.*;
public class showall extends HttpServlet
{
public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
{
response.setContentType("text/html");
PrintWriter out = response.getWriter();
java.util.Properties props = new java.util.Properties();
props.put("user", " ");
props.put("password", " ");
String driverName = "sun.jdbc.odbc.JdbcOdbcDriver";
String connectionURL = "jdbc:odbc:james";
out.println("");
out.println("");
out.println("");
out.println("
out.println("");
out.println("");
out.println("");
buildtabledel(driverName,connectionURL,props,out);
out.println("");
out.println("");
}
void buildtabledel(String driverName,String connectionURL, java.util.Properties props, PrintWriter out)
{
out.println("");
}
void listregid(String driverName,String connectionURL, java.util.Properties props, PrintWriter out)
{
String query = "SELECT * FROM student_det";
boolean rc = true;
Connection con = null;
Statement stmt = null;
ResultSet rs = null;
int rowCount = 0;
out.println("
" + rsmd.getColumnLabel(i + 1) + " | ");|
"+tempval+" | ");"+rs.getString(i+1)+" | ");
}
catch (Exception ex)
{
out.println("Exception!");
ex.printStackTrace(out);
rc = false;
}
finally
{
try
{
if (rs != null)
{
rs.close();
}
if (stmt != null)
{
stmt.close();
}
if (con != null)
{
con.close();
}
}
catch (Exception ex)
{
// Do Nothing here
}
}
}
}
//Style
p
{
text-align: justify;
color: black; font-family:
courier new;margin-top: 0;
margin-bottom: 6;
font-size:9pt;
}
input
{
BACKGROUND-COLOR:#FFFFFF;
font-size:9pt;
COLOR:#333333;
BORDER:1x SOLID;
border-color : black;
font-family: courier new;
}
td
{ color: black;
font-family: courier new;
font-size:9pt;
color: blue;
}
select
{
background : white;
font-size:6pt;
font : "Courier New"";
color : #FF00FF;
}
No comments:
Post a Comment