addproduct.jsp

来自「基于WEB的商品管理系统」· JSP 代码 · 共 92 行

JSP
92
字号
<%@ page contentType="text/html; charset=gb2312" language="java" import="org.me.product.*,java.util.*,java.io.*" errorPage="error.jsp" %><%--The taglib directive below imports the JSTL library. If you uncomment it,you must also add the JSTL library to the project. The Add Library... actionon Libraries node in Projects view can be used to add the JSTL 1.1 library.--%><%--<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> --%><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"   "http://www.w3.org/TR/html4/loose.dtd"><html><head><title>Untitled Document</title><meta http-equiv="Content-Type" content="text/html; charset=gb2312"></head><jsp:useBean id="category" class="org.me.product.ViewCategory" scope="page"><jsp:setProperty name="category" property="*" /></jsp:useBean><body><script language="JavaScript"><!--function RgTest(){    if(document.product.productId.value=="")     {	   window.alert("Please input all the information");	   document.product.productId.focus();	   return false;	}	if(document.product.name.value=="")     {	   window.alert("Please input all the information!");	   document.product.name.focus();	   return false;	}	if(document.product.price.value=="")     {	   window.alert("Please input all the information!");	   document.product.price.focus();	   return false;	}if(document.product.producer.value=="")     {	   window.alert("Please input all the information!");	   document.product.producer.focus();	   return false;	}	if(document.product.description.value=="")     {	   window.alert("Please input all the information!");	   document.product.description.focus();	   return false;	}	   	   	   return true;}//--></script>	   <center><h1>add product</h1><form action="addProduct_do.jsp" method="post" name="product"><table border="1" bgcolor="#0099CC"><tr><td>productId:<input type="text" name="productId"></td></tr><tr><td>name:<input type="text" name="name"></td></tr><tr><td>price:<input type="text" name="price"></td></tr><tr><td>=producer=:<input type="text" name="producer"></td></tr><tr><td>=description=:<input type="text" name="description"></td></tr><tr><td>=categoryId=:<select name="categoryId"><% Collection categorys=category.getAllCategory();Iterator it=categorys.iterator();while(it.hasNext()){    Category temp=(Category)it.next();	out.println("<option value="+temp.getCategoryId()+">"+temp.getCategoryId()+"</option>");}%></select></td></tr><tr><td><input type=submit value=OK  onClick="return RgTest()"></td></tr></table></form></center></body></html>

⌨️ 快捷键说明

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