只写了一遍的代码:页面的跳转操作,全部是从web文件中读取进行的
web配置文件
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd"
version="4.0">
demo
com.it.Demo
demo
/CarServlet
demo1
com.it.ClearDemo
demo1
/ClearCartServlet
public class Demo extends HttpServlet {
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
HttpSession session = req.getSession();
resp.setContentType("text/html;charset=utf-8");
int id = Integer.parseInt(req.getParameter("id"));
String[] names = {"iphone7", "小米6", "三星note8", "魅族"