addbook.jsp

来自「这是个简单的在线书店购书系统」· JSP 代码 · 共 60 行

JSP
60
字号
<%@ page language="java" import="java.util.*,mypack.*" pageEncoding="gb2312"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'add.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->

  </head>
  
  <body>
  
  
  

   <form action="addbook.jsp" method="post">
   图书编号id:<input type="text" name="id"><br>
   图书名称name:<input type="text" name="name"><br>
 图书标题 title:  <input type="text" name="title"><br>
   图书价格price:<input type="text" name="price"><br>
  出版日期 yr<input type="text" name="yr"><br>
   图书描述description:<textarea rows="20" cols="30" name="description"></textarea><br>
 销售情况:  saleAmount:<input type="text" name="saleAmount"><br>
   <input type="submit" value="添加">
   </form>
   
   
	<jsp:useBean id="book" class="mypack.BookBean">
  	<jsp:setProperty name="book" property="*"/>
  	</jsp:useBean>
  	<jsp:useBean id="bookdb" class="mypack.BookDB" scope="session"/>
  <%
  	if(book.getId()!=null){
  		boolean flg=bookdb.addBook(book);
  		if(flg){
  			out.println("success");
  		}else{out.println("faile");}
  	}
  	
  %>   
   
   
  <a href="all.jsp"> all infor</a>
  </body>
</html>

⌨️ 快捷键说明

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