sample jsp-servlet-service-db program

Ads
 

sample jsp-servlet-service-db program

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Create New Inventory Manager</title>
<link href="style.css" rel="stylesheet" type="text/css" media="screen" />
<script type="text/javascript">
function validation()
{

    var name1=inventory.name1.value;
var addr1=inventory.addr1.value;
var number=inventory.cnum.value;
var x=document.forms["inventory"]["name2"].value;
var atpos=x.indexOf("@");
var dotpos=x.lastIndexOf(".");
var sub;
var rand;


if(name1.length==0)
{
alert("Enter your Name");
inventory.name1.focus();
return false;
}

if(addr1.length<20)
{
alert("Enter your address(minimum 20 characters)");
inventory.addr1.focus();
return false;
}
if ((atpos<1) || (dotpos<atpos+2) || (dotpos+2>=x.length))
{
alert("Not a valid e-mail address");
inventory.name2.focus();
return false;
}

if(number.length<10)
{
alert("Enter your 10 digit Contact Number");
inventory.cnum.focus();
return false;
}
sub= onsubmitform();

}

function isNumberKey(evt)
{
   var charCode = (evt.which) ? evt.which : event.keyCode;
   if ((charCode > 31) && (charCode < 48) || (charCode > 57))
      return false;

   return true;
}
function isNumberKey1(evt)
{
   var charCode = (evt.which) ? evt.which : event.keyCode;
   if (charCode > 31 && (charCode < 48) || (charCode > 57))
      return true;

   return false;
}
function onsubmitform()
 {
  alert("Account created successfully!");
   }
</script>
</head>
<body bgcolor=silver>
<form method ="post" name="inventory" action="CreateIm" onsubmit="return validation()">
 <center> Enter the Inventory Manager Details</center>
 <table border="0" cellpadding="0" cellspacing="0">

 <tr>
 <td>Inventory Manager name: </td>
<td><INPUT id="txtChar" onkeypress="return isNumberKey1(event)" type="text" name="name1"></td>
 </tr>
 <tr>
 <td>Address:</td>
 <td><textarea rows="2" cols="20" name="addr1"></textarea></td>
 </tr>
 <tr>
 <td>E-mail ID: </td>
<td><input type="text" name="name2" size="20"/></td>
 </tr>
 <tr>
 <td>Phone No.: </td>
<td> <INPUT maxlength = 10 id="txtChar" onkeypress="return isNumberKey(event)" type="text" name="cnum">
</td>
 </tr>
 <tr>
 <td> </td>
 <td><input type="submit" value="Submit"/>
 <input type="reset" name="B2" value="Reset"/></td>
 </tr>
 </table>


 </form>      
</body>
</html>





<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
    <%@ page import="java.lang.*" %>

    <%@ page import="java.util.ArrayList" %>
    <%@ page import="java.sql.*"%>
    <%@ page import="com.ilp.tsi.db.DB" %>
    <%@ page import="com.ilp.tsi.um.beans.*" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
<link href="style.css" rel="stylesheet" type="text/css" media="screen" />
<script src="http://code.jquery.com/jquery-latest.js"></script>
  <script type="text/javascript" src="http://jzaefferer.github.com/jquery-validation/jquery.validate.js"></script>

  <script>
  function validation()
  {

    var name1=edit.user.value;
  var addr1=edit.add.value;
  var number=edit.num.value;
  var x=document.forms["edit"]["email"].value;
  var atpos=x.indexOf("@");
  var dotpos=x.lastIndexOf(".");
  var sub;



  if(name1.length==0)
  {
  alert("Enter your Name");
  edit.user.focus();
  return false;
  }

  if(addr1.length<20)
  {
  alert("Enter your address(minimum 20 characters)");
 edit.add.focus();
  return false;
  }
  if ((atpos<1) || (dotpos<atpos+2) || (dotpos+2>=x.length))
  {
  alert("Not a valid e-mail address");
 edit.email.focus();
  return false;
  }

  if(number.length<10)
  {
  alert("Enter your 10 digit Contact Number");
edit.num.focus();
  return false;
  }
}

  function openPage(pageURL)  {  window.location.href = pageURL;  } 

  function isNumberKey(evt)
    {
       var charCode = (evt.which) ? evt.which : event.keyCode;
       if ((charCode>31) && (charCode<48) || (charCode>57))
          return false;

       return true;
    }
    function isNumberKey1(evt)
    {
       var charCode = (evt.which) ? evt.which : event.keyCode;
       if (charCode>31 && (charCode<48 || charCode>57))
          return true;

       return false;
      }
      </script>


</head>
<body>

<h2 align="center">Retailer Details</h2>


<center><form method="post" id="edit" name="edit" action="EditRetailer" onsubmit="return validation()" >
<%
Connection conn=null;
Statement stmt=null;
try
{

    DB obj=new DB();

    conn=obj.getConnection();
    stmt=conn.createStatement();
    ResultSet rs=null;
    ResultSet rs1=null,rs2=null;;
    //RetBean rbean=new RetBean();

    String retId=(String)session.getAttribute("retId");

    rs=stmt.executeQuery("select * from retailer where RETAILER_ID='"+retId+"'");
    while(rs.next())
    {

    %>

<table border="0" cellspacing="5" cellpadding="5">

<tr>
<td>Retailer Name:</td>
<td><input type="text" name="user" onkeypress="return isNumberKey1(event)" class="Retailer name required"  value="<%= rs.getString("retailer_name") %>"></input></td>
</tr>
<tr>
<td>Address:</td>
<td><textarea rows="1" cols="20" name="add" class="address required"  ><%= rs.getString("address")%></textarea></td>
</tr>
<tr>
<td>Email ID:</td>
<td><input type="text" name="email" class="email required" value="<%= rs.getString("email_id")%>"></input></td>
</tr>
<tr>
<td>Contact Number:</td>
<td><input type="text" name="num" onkeypress="return isNumberKey(event)" class="contact number required" size="10" value="<%= rs.getString("contact_no")%>"></input></td>
</tr>
<tr><th align="left">Tagged retailer products</th></tr>
<%
}


rs1=stmt.executeQuery("select product.prod_model_name,product.product_id from ret_prod inner join product  on ret_prod.product_id=product.product_id where retailer_id='"+retId+"'");
while(rs1.next())
{

%>
<tr>

<td></td>

<td><%=rs1.getString("prod_model_name") %></td>
</tr>
<%
//rs2=stmt.executeQuery("insert into ret_prod values ('"+retId+"','"+rs1.getString("product_id")+"')"); 
}
%>
<tr>
<td><input type="button" value="Product Catalog" onclick="openPage('tags.jsp')"></input></td>

<td><input type="submit"  value="update" name="Edit1"></input></td>
<td><input type="button" value="untag"  onclick="openPage('untag.jsp')"></input></td>
<td><input type="button" value="delete" onclick="openPage('deleteretailer.jsp')"></input></td>
</tr>
</table>
</form>
<%
conn.close();
stmt.close();
}
catch(SQLException E)
{
    E.printStackTrace();
}

%>





</center>
</body>
</html>






<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title> Retailer Home  </title>
<link rel="stylesheet" type="text/css" href="style.css" />
<script type="text/javascript">
window.history.forward();
function noBack()
{
    windows.history.forward();
}
</script>
</head>
<body onload="noBack();" onPageshow="if(event.resisted)noBack();" onunload="">
<font>
<p align="right"><a href=changeRetPassword.jsp>Change Password</a>&nbsp&nbsp<a href=welcome.jsp>Logout</a></p>
<h1 align="center">Retailer Home Page </h1>

<%@page language="java" session="true" %>
<% 


session.setMaxInactiveInterval(60);
%>




<table align="center"  cellpadding="10" cellspacing="2" border="3">
            <tr height ="50">
                <td width="220" align="center" bgcolor="#FAEBD7">
                    <input type="button" onclick="window.location = 'viewListModels.jsp';" value="View list of models "  style="height: 1.5cm;width:5cm;" >
                </td>
            </tr>
            <tr height="50">
                <td width="220" align="center" bgcolor="#FAEBD7">
                    <input type="button" onclick="window.location = 'orderPlacing.jsp';" value="Order Products "  style="height: 1.5cm;width:5cm;" >
                </td>
            </tr>
            <tr height ="50">
                <td width="220" align="center" bgcolor="#FAEBD7">
                    <input type="submit" onclick="window.location = 'deleteOrder.jsp';" name="upViewAll" value="Cancel the order"  style="height: 1.5cm;width:5cm;"/>
                </td>
            </tr>
            <tr height ="50">
                <td width="220" align="center" bgcolor="#FAEBD7">
                    <input type="submit" onclick="window.location = 'pdate_customer_info1.jsp';" name="productnameDB" value="Update customer information"  style="height: 1.5cm;width:5cm;" >
                </td>
            </tr>
            <tr height ="50">
                <td width="220" align="center" bgcolor="#FAEBD7">
                    <input type="submit" onclick="window.location = 'checkShipment.jsp';" name="productnameDB" value="Check status of shipment"  style="height: 1.5cm;width:5cm;" >
                </td>
            </tr>
            <tr height ="50">
                <td width="220" align="center" bgcolor="#FAEBD7">
                    <input type="submit" onclick="window.location = 'defectReplace.jsp';" name="productnameDB" value="Defect Replacement"  style="height: 1.5cm;width:5cm;" >
                </td>
            </tr>
            <tr height ="50">
                <td width="220" align="center" bgcolor="#FAEBD7">
                    <input type="submit" onclick="window.location = 'viewListOrders.jsp';" name="productnameDB" value="View List of orders"  style="height: 1.5cm;width:5cm;" >
                </td>

            </tr>
        </table>



</font>

</body>
</html>
View Answers

Ads









Related Tutorials/Questions & Answers:
sample jsp-servlet-service-db program
sample jsp-servlet-service-db program  <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>...; <% Connection conn=null; Statement stmt=null; try { DB obj=new DB
sample Applet program
sample Applet program  I need Source Code for sample Applet program.   Hi Friend, Please visit the following link: Applet Tutorials Thanks
Advertisements
Sample java program
Sample java program  I want a sample program: to produce summary information on sales report. The program will input Data of Salesman Id, Item code, and number of cuestomer. Sales id is 5digit long, and items code range from
Sample program of JSP
Sample program of JSP  <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org
Sample program of JSP
Input program in JSP  <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org
Getting Exception on UseDefinedException sample program - Please help me how to resolve
Getting Exception on UseDefinedException sample program - Please help me how to resolve  class UseDefinedException extends Exception{ String msg = ""; int marks; public UseDefinedException() ){ } public
Sample Java program for beginners
Here beginners in Java can learn to create there first Hello World program..., a programmer is ready to create their own Java program. Here we have also described..., web development, application development, programming, etc. After a program
ModuleNotFoundError: No module named 'sample'
ModuleNotFoundError: No module named 'sample'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'sample' How to remove the ModuleNotFoundError: No module named 'sample'
program
program  write a javascript program to create a application form with validation
program
program  write a html program in show table and this word in box
program
program  write a program different between to dates in terms of days in java
program
program  write a program reversee a string. input-hi this is roseindia output-roseindia is this hi
program
program  develop a servlet to insert the data in the database from our program in the table stored in the database
program
program  WAP a java program to form 1/2+3/4+5/6+7/8 series
program
program  write a java program to input a no. and print wheather the no. is a special no or not. (special no. are those no whose factorial of the sum of digit of the no is same as the original
program
program  how to improve programming skills plss tell some tips..i am understanding concepts but unable to write program so,pls give some guideness plsss
Program
Program  a program to prove that default constructor of super class is available to subclass by default. Define a parameterize constructor for super class to store name = ‚??Tommy‚?? age=‚??23‚?? and call this constructor
Program
Program  a program to create two classes Commercial and Domestic. Override the method calculatebill() of Commercial class(Rs.8 per unit) into Domestic class(Rs 6 per unit) to compute electricity bill for both classes
program
program  no i want a program that shows how merge sort algorithm works in graphical representations like numbers are taken in circles and computation... in rectangles or circles wat ever it may be. the theme of program is to show algorithm
program
program  Write a JSP Program, which displays a web page containing the name of the Courses, Courses being offered currently, number of students enrolled in each course, new courses to be offered, eligibility criteria for taking
program
program  i want a progra in java to print a sentence in alphabetic order, taking the input from the user.the program should writen without using the array for example : if input= this is a cat then output sould = a cat
program
program  Write a JSP Program, which displays a web page containing... it goes to a JSP page which displays your personal profile and by clicking on link for classes schedule another JSP page will open to show the schedule
program
program  Write a program to print details of a week for a particular day using array of objects Integer and String. OUTPUT: First Day of Week is Monday Second Day of Week is Tuesday Third Day of Week is Wednesday Forth Day
Jsp program
Jsp program  A sample program of jsp using dml quaries
JSF Sample Programs
JSF Sample Programs  I need a JSF sample programs
ModuleNotFoundError: No module named 'active-sample'
ModuleNotFoundError: No module named 'active-sample'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'active-sample' How to remove the ModuleNotFoundError: No module named
ModuleNotFoundError: No module named 'auooo-sample'
ModuleNotFoundError: No module named 'auooo-sample'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'auooo-sample' How to remove the ModuleNotFoundError: No module named '
ModuleNotFoundError: No module named 'auooo-sample'
ModuleNotFoundError: No module named 'auooo-sample'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'auooo-sample' How to remove the ModuleNotFoundError: No module named '
ModuleNotFoundError: No module named 'bert_sample'
ModuleNotFoundError: No module named 'bert_sample'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'bert_sample' How to remove the ModuleNotFoundError: No module named '
ModuleNotFoundError: No module named 'bert_sample'
ModuleNotFoundError: No module named 'bert_sample'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'bert_sample' How to remove the ModuleNotFoundError: No module named '
ModuleNotFoundError: No module named 'carrier-sample'
ModuleNotFoundError: No module named 'carrier-sample'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'carrier-sample' How to remove the ModuleNotFoundError: No module named

Ads