📄 addproduct_jsp.java
字号:
package org.apache.jsp;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
import java.sql.*;
import product_web.*;
import java.util.*;
import java.io.*;
public final class addProduct_jsp extends org.apache.jasper.runtime.HttpJspBase
implements org.apache.jasper.runtime.JspSourceDependent {
String name,sql;
private static java.util.Vector _jspx_dependants;
public java.util.List getDependants() {
return _jspx_dependants;
}
public void _jspService(HttpServletRequest request, HttpServletResponse response)
throws java.io.IOException, ServletException {
JspFactory _jspxFactory = null;
PageContext pageContext = null;
HttpSession session = null;
ServletContext application = null;
ServletConfig config = null;
JspWriter out = null;
Object page = this;
JspWriter _jspx_out = null;
PageContext _jspx_page_context = null;
try {
_jspxFactory = JspFactory.getDefaultFactory();
response.setContentType("text/html; charset=gb2312");
pageContext = _jspxFactory.getPageContext(this, request, response,
"error.jsp", true, 8192, true);
_jspx_page_context = pageContext;
application = pageContext.getServletContext();
config = pageContext.getServletConfig();
session = pageContext.getSession();
out = pageContext.getOut();
_jspx_out = out;
out.write("\r\n<html>\r\n<head>\r\n<title>Untitled Document</title>\r\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=gb2312\">\r\n<style type=\"text/css\">\r\n<!--\r\nbody {\r\n\tbackground-image: url(background.jpg);\r\n}\r\n-->\r\n</style></head>\r\n");
product_web.ViewCategory category = null;
synchronized (session) {
category = (product_web.ViewCategory) _jspx_page_context.getAttribute("category", PageContext.SESSION_SCOPE);
if (category == null){
category = new product_web.ViewCategory();
_jspx_page_context.setAttribute("category", category, PageContext.SESSION_SCOPE);
}
}
out.write("\r\n<body>\r\n<script language=\"JavaScript\" type=\"\">\r\n<!--\r\nfunction RgTest()\r\n{\r\n if(document.product.productId.value==\"\")\r\n {\r\n\t window.alert(\"请输入完整的信息!\");\r\n\t document.product.productId.focus();\r\n\t return false;\r\n\t}\r\n\tif(document.product.name.value==\"\")\r\n {\r\n\t window.alert(\"请输入完整的信息!\");\r\n\t document.product.name.focus();\r\n\t return false;\r\n\t}\r\n\tif(document.product.price.value==\"\")\r\n {\r\n\t window.alert(\"请输入完整的信息!\");\r\n\t document.product.price.focus();\r\n\t return false;\r\n\t}if(document.product.producer.value==\"\")\r\n {\r\n\t window.alert(\"请输入完整的信息!\");\r\n\t document.product.producer.focus();\r\n\t return false;\r\n\t}\r\n\tif(document.product.description.value==\"\")\r\n {\r\n\t window.alert(\"请输入完整的信息!\");\r\n\t document.product.description.focus();\r\n\t return false;\r\n\t}\r\n\r\n\r\n\t return true;\r\n}\r\n//-->\r\n</script>\r\n\r\n\r\n<center>\r\n<h1>增加新的书籍</h1>\r\n\r\n<form action=\"addProduct_do.jsp\" method=\"post\" name=\"product\">\r\n<table border=\"1\" bgcolor=\"#0099CC\">\r\n<tr>\r\n <td width=\"260\" height=\"34\">书籍的ID:\r\n <input type=\"text\" name=\"productId\"></td>\r\n");
out.write("</tr>\r\n<tr>\r\n <td height=\"30\">书籍名称:\r\n <input type=\"text\" name=\"name\"></td>\r\n</tr>\r\n<tr>\r\n <td height=\"32\">书籍价格:\r\n <input type=\"text\" name=\"price\"></td>\r\n</tr>\r\n<tr><td height=\"34\">=厂商=:\r\n <input type=\"text\" name=\"producer\"></td></tr>\r\n<tr><td height=\"32\">=描述=:\r\n <input type=\"text\" name=\"description\"></td></tr>\r\n<tr><td height=\"34\">=类别=:\r\n <select name=\"categoryId\" size=\"1\">\r\n");
out.write('\r');
out.write('\n');
sql = "select * from category";
ResultSet rs = category.executeQuery(sql);
while(rs.next())
{
out.println("<option>" + rs.getString("catid")+"</option>");
}
out.write("\r\n</select></td></tr>\r\n<tr><td height=\"32\"><input type=submit value=提交 onClick=\"return RgTest()\"></td></tr>\r\n</table>\r\n</form>\r\n</center>\r\n\r\n</body>\r\n</html>\r\n");
} catch (Throwable t) {
if (!(t instanceof SkipPageException)){
out = _jspx_out;
if (out != null && out.getBufferSize() != 0)
out.clearBuffer();
if (_jspx_page_context != null) _jspx_page_context.handlePageException(t);
}
} finally {
if (_jspxFactory != null) _jspxFactory.releasePageContext(_jspx_page_context);
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -