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

📄 add.jsp

📁 简单的网上图书书店
💻 JSP
字号:
<%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="" %>
<!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=gb2312">
<title>add.jsp</title>
</head>
<%@page import="java.util.*" %>
<body>
	
<%

String name=new String(request.getParameter("name").getBytes("ISO-8859-1"));
String type=new String(request.getParameter("type").getBytes("ISO-8859-1"));
String price=new String(request.getParameter("price").getBytes("ISO-8859-1"));
String off=new String(request.getParameter("off").getBytes("ISO-8859-1"));
String id=new String(request.getParameter("id").getBytes("ISO-8859-1"));
String number=new String(request.getParameter("number").getBytes("ISO-8859-1"));

float _price=(new Float(price)).floatValue();
float _off=(new Float(off)).floatValue();
int _number=(new Integer(number)).intValue();
float total=_price*_number*_off;
	
LinkedList lsName=(LinkedList)session.getAttribute("lsName");
LinkedList lsType=(LinkedList)session.getAttribute("lsType");
LinkedList lsPrice=(LinkedList)session.getAttribute("lsPrice");
LinkedList lsOff=(LinkedList)session.getAttribute("lsOff");
LinkedList lsId=(LinkedList)session.getAttribute("lsId");
LinkedList lsNumber=(LinkedList)session.getAttribute("lsNumber");
LinkedList lsTotal=(LinkedList)session.getAttribute("lsTotal");

if (lsName==null){
    response.sendRedirect("../indexServlet?init");
}

lsName.add(name);
lsType.add(type);
lsPrice.add(price);
lsOff.add(off);
lsId.add(id);
lsNumber.add(number);
lsTotal.add(new Float(total));
	
session.setAttribute("lsName",lsName);
session.setAttribute("lsType",lsType);
session.setAttribute("lsPrice",lsPrice);
session.setAttribute("lsOff",lsOff);
session.setAttribute("lsId",lsId);
session.setAttribute("lsNumber",lsNumber);
session.setAttribute("lsTotal",lsTotal);
	
response.sendRedirect("../indexServlet?cmd=cart");
%>
</body>
</html>

⌨️ 快捷键说明

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