⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 addproduct.jsp

📁 ORACLE AQ sample 演示的如何出列
💻 JSP
字号:
<%--
  *  @author   Anupama Majety
  *  @version  1.0
  *
  *  Development Environment        : Oracle9i JDeveloper
  *  Name of the Application        : AddProduct.jsp
  *  Creation/Modification History  :
  *
  *     Anupama Majety     22-Jan-2002     Created
  *
  *  Overview of Application        :
  *    This JSP displays the form fields to be filled by the manufacturer
  *	   for adding a product into database.
--%>

<%@ page language="java" %>
<%@ page errorPage="Exception.jsp" %>

<HTML><HEAD><TITLE>Advanced Queuing Sample - Add A Product</TITLE>
<META content="text/html; charset=iso-8859-1" http-equiv=Content-Type>
<link rel="stylesheet" href="stylesheets/styles.css" type="text/css">
<script src="include/validation.js" language="JavaScript"></script>
<script language="JavaScript1.1">

  // This function is called when the manufacturer wants to add a product to his
  // database. It submits the form to the ControllerServlet appending the
  // appropriate event after validating the form. If an error message is
  // returned after validation then the message is alert and the form is not
  // submitted.
  function addProduct(){
    var errorMessage=validationForm();
    if(errorMessage==""){
        document.AddPrdsFrm.action = "ControllerServlet?Event=AddProduct";
        document.AddPrdsFrm.submit();
    }else{
        alert(errorMessage);
    }
  }

  // This function is called when the manufacturer wants to reset the form i.e.
  // erase all the values he entered previously.
  function resetForm(){
    document.AddPrdsFrm.ProductName.value="";
    document.AddPrdsFrm.ProductDesc.value="";
    document.AddPrdsFrm.CategoryDesc.value="";
    document.AddPrdsFrm.Price.value="";
    document.AddPrdsFrm.Quantity.value="";
  }

  // This function is used to validate all the fields entered by the user.
  // These are the validations done - Product Name, Description, quantity 
  // and price shouldn't be empty. Price and Quantity should be a positive 
  // integer and Quantity shouldn't contain a fractional part.
  // Finally this method returns the errors present in all the form fields.
  function validationForm(){
  	var errorMessage="";
    
	  // Check if product name is empty. If it is then display an alert.
    if(isEmpty(document.AddPrdsFrm.ProductName.value)){
        errorMessage+="Product Name should'nt be empty\n";
    }

	  // Check if product desc is empty. If it is then display an alert.	
    if(isEmpty(document.AddPrdsFrm.ProductDesc.value)){
        errorMessage+="Product Desc should'nt be empty\n";
    }
    var price=document.AddPrdsFrm.Price.value;
	
	  // Check if price is empty. If it is then display an alert.	
    if(isEmpty(price)){
        errorMessage+="Product Price should'nt be empty\n";
    }else{
		// If price is not empty then check if it is a postive number or not.
        if(!isNumber(price)){
              errorMessage+="Price should be Positive number greater than zero\n";
        }
    }
    var quantity=document.AddPrdsFrm.Quantity.value;
	
	  // Check if quantity entered is empty. If it is then display an alert.
    if(isEmpty(quantity)){
        errorMessage+="Quantity should'nt be empty\n";
    }else{
		  // If quantity entered is not empty then check to see if it is
		  // an positive number.
        if(isNumber(quantity)){
		     // If it is a positive number then check if it is a whole number.
		     // i.e. Doesn't contain a fractional part
           if(isCharPresent(".",quantity)){
                errorMessage+="Quantity should be an Integer\n ";
           }
        }else{
             errorMessage+="Quantity should be Positive integer greater than zero\n";
        }
    }
    return errorMessage;
  }
</script>

<META content="MSHTML 5.00.2314.1000" name=GENERATOR></HEAD>
<BODY bgColor=#ffffff  text=#000000>
<form name="AddPrdsFrm" method="post" >
<!-- Main table -->
  <jsp:include page="include/Top.jsp" />
 			<SPAN class="greeting"> Hi <%= (String)session.getAttribute("Name")%>. You have logged in as a Computer Manufacturer.</SPAN>
   <jsp:include page="include/Links.jsp" />  			  
     <!-- Heading of the page goes here -->

     <TR><TD class="mainHeading" align="center">Add a Product</TD></TR>
     <TR><TD>&nbsp;</TD></TR>
     <TR>
        <TD>
            <!-- 5th table starts here working area -->
            <TABLE border=0 cellPadding=0 cellSpacing=0 width=970>
              <TBODY>
              <TR>
                <TD valign="top" width="15%" noWrap>&nbsp;</TD>
                <TD vAlign=top width="75%" align="center">
                  <!-- 6th table starts here-->
                  <TABLE border=0 width="60%">
                    <TBODY>
                  	<TR>
                      <TD align="right"><span class="formHeading">Product Name </span>
                        <span class="errorMessage">*</span></TD>
                      <TD>&nbsp;&nbsp;</TD>
                      <TD class="data">
                        <input type="text" name="ProductName" size="30">
                      </TD>
                    </TR>
                    <TR>
                      <TD align="right"><span class="formHeading">Product Desc </span>
                        <span class="errorMessage">*</span></TD>
                      <TD>&nbsp;&nbsp;</TD>
                      <TD class="data">
                        <textarea name="ProductDesc" rows="4" cols="30"></textarea>
                      </TD>
                    </TR>
                    <TR>
                      <TD class="formHeading" align="right">Category Desc</TD>
                      <TD>&nbsp;&nbsp;</TD>
                      <TD class="data">
                        <textarea name="CategoryDesc"></textarea>
                      </TD>
                    </TR>
                    <TR>
                      <TD align="right"><span class="formHeading">Price</span>
                        <span class="errorMessage">*</span></TD>
                      <TD>&nbsp;&nbsp;</TD>
                      <TD class="data">
                        <input type="text" name="Price" size="15"><span class="formHeading">$</span>
                      </TD>
                    </TR>
                    <TR>
                      <TD align="right"><span class="formHeading">Quantity</span>
					  		<span class="errorMessage">*</span></TD>
                      <TD>&nbsp;&nbsp;</TD>
                      <TD class="data">
                        <input type="text" name="Quantity" size="6" maxlength="6">
                      </TD>
                    </TR>
                   </TBODY>
                  </TABLE>

            <!-- 6th table ends here -->
                </TD>
                <TD width="10%">&nbsp;</TD>
              </TR>
              <TR><TD colspan=3>&nbsp;</TD></TR>
              <TR>

            <TD colspan=3 align="center"> <img src="images/add.gif" border=0 width="60" height="32" onMouseUp="addProduct()">
              <img src="images/reset12.gif" border=0 width="60" height="32" onMouseUp="resetForm()">
            </TD>
              </TR>
              </TBODY>
            </TABLE>
            <!-- 5th table ends here working area-->
        </TD>
      </TR>
      <TR>
        <TD vAlign=top align=left noWrap>&nbsp;</TD>
      </TR>
      <TR>
        <TD vAlign=top align=left ><image src="images/line.gif" height="3" width="970"></TD>
      </TR>
      <TR>
        
    <TD height=19 vAlign=top align="left"><font face="Arial, Helvetica" size=-2> 
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &copy; Copyright 2002 Oracle Corporation. 
      All rights reserved.</font> </TD>
      </TR>
    </TABLE>
    <!-- Main table ends here-->
</form>
</BODY>
</HTML>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -