Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


Http Servlet
jsp
0 Answer(s)      2 years and 8 months ago
Posted in : WebSevices


    <%@ 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>



<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN""http://www.w3.org/TR/html4/loose.dtd">

<%@ page import="java.sql.*" %><%@ page import="java.io.*" %> 
<%@ page import="com.ilp.tsi.utils.*" %>
<%@ page import="com.ilp.tsi.db.*" %>
<html>
<head>
<link rel="stylesheet" type="text/css" href="style.css" />
<title>Display products</title>
</head>
<body>
<font>
<h1 align="center">List of Products</h2>
<%        String retailername = (String)session.getAttribute("rid");
            System.out.println(retailername);
%>
<%
try
{

Connection connection=null;
Statement statement=null;
ResultSet rs=null;
DB dao=new DB();
connection=dao.getConnection();
statement = connection.createStatement();
rs = statement.executeQuery("SELECT prod_model_name,price,features,description,quantity from product where product_id in(select product_id from ret_prod where retailer_id='"+retailername+"')");
%>

<TABLE cellpadding="15" border="1" >
<tr>
        <th>Product Model Name</th>
        <th>Price</th>
    <th>Features</th>
    <th>Description</th>
    <th>Availabilty</th>
  </tr>
<%
while (rs.next())

 {

    %>

<tr>

    <td><%=rs.getString(1)%>

    </td><td><%=rs.getInt(2)%>

    </td><td><%=rs.getString(3)%></td>

    <td><%=rs.getString(4)%></td>

    <td><%=rs.getString(5)%></td>


</tr>
<% 
}
%>
<%
rs.close();

statement.close();

connection.close();
} 

catch (Exception ex) 
{
    out.println("Unable to connect to database.");
}
%>
</TABLE>
<TABLE>
<TR>
<TD>
<br><br>
<a href=retailerHome.jsp>Go to Home Page</a>
</TABLE>
</font>
</body>
</html>

Advertisement
View Answers

Related Tutorials/Questions & Answers:
jsp
jsp  how to include two jsp page
JSP
what is JSP forward tag for  what is JSP forward tag for   It forwards the current request to another JSP page. Below is the syntax for the same:- <jsp:forward page="...url..." /> We can also forward parameter
Advertisements
Jsp
Jsp  Can I implement interface in jsp
jsp
jsp  how to create jsp page
JSP
JSP  How to run jsp program in eclipse
jsp
jsp  how jsp translated into servlets
jsp
jsp  write a code for jsp file generator to generate a jsp page automatically taking html page as input
jsp
jsp  how to create a table in oracle using jsp and the table name is entered in text feild of jsp page
JSP
JSP  Hi, What is JSP? What is the use of JSP? Thanks   Hi, JSP Stands for Java Server Pages. It is Java technology for developing web applications. JSP is very easy to learn and it allows the developers to use Java
jsp
jsp   what is the basic necessities reguired for running jsp using JDBC bridge?? and how to write a jsp code to access the detail present in microsoft access pls send link regarding above
jsp
jsp  how to connect the database with jsp using mysql   Hi Friend, Please visit the following links: http://www.roseindia.net/jsp/connectjspwith_mysql.shtml http://www.roseindia.net/jsp/Accessingdatabase-fromJSP.shtml
jsp
jsp  how to upload image through csv format in jsp
jsp
jsp  I Want complete note on JSP servlet
jsp
jsp  how to delete data from database using jsp
jsp
jsp  code for jsp automatic genration using html
jsp
jsp  why jsp is translated into servlet?pls describe precisly
JSP
JSP  relevant difference between servlet and jsp in 1 line
jsp
jsp  how to write a servlet and jsp program for user login form
jsp
jsp  how to write a servlet and jsp program for user login form
JSP
JSP   How to create CAPTCHA creation by using JSP? I need an code for CAPTCHA creation by using JSP...   You can create a captcha validation using jsp. Have a look at the following tutorial: Captcha Creation
jsp
jsp  how to include google map in our jsp page
JSP
JSP  FILE UPLOAD-DOWNLOAD code USING JSP
jsp
jsp  how to write hindi in jsp and store in database as unicode
jsp
jsp  how to pass jsp variable to an html page
JSP
What are JSP directives, page directives and include directives?  what are jsp directives? and what are page directives? and what are include directives? can you explain taglib directives?   JSP directives JSP
JSP
Can you explain jsp page life cycle what is el how does el search for an attribute in JSP  Can you explain jsp page life cycle what is el how does el...://www.roseindia.net/jsp/simple-jsp-example/LifeCycleOfJspPage.shtml http
JSP
JSP  what are the different scopes an object can have in a jsp page   JSP Scope Variables: Page scope-It makes the data available... the following links: http://www.roseindia.net/jsp/simple-jsp-example
JSP
what is jstl in JSP   what is jstl   JSTL is also called as JSP tag libraries. They are collection of custom actions which canbe accessed as JSP tags. For more information, visit the following link: JSTL Tutorials
JSP
access application data stored in JavaBeans components. The jsp expression...). Before JSP 2.0, we could use only a scriptlet, JSP expression, or a custom tag to include server state in the jsp page output. For more information, visit
JSP
JSP public opinion poll   Develop a JSP for a news channel to conduct public opinion poll on any topic. Users will respond through yes or no options. Later display the result in percentage
jsp
jsp  sir i want to jsp code for online examination like as bank po,,,,,,plz help me sir
 

 

 

DMCA.com