请问一下查询页面出现这问题是怎么回事?
package com.imooc.food; public class Food { private String id; private String foodName; private String taste; private String path; private String price; private String describe; public Food() { } public Food(String id, String foodName, String taste, String path, String price, String describe) { super(); this.id = id; this.foodName = foodName; this.taste = taste; this.path = path; this.price = price; this.describe = describe; } public String getId() { return id; } public void setId(String id) { this.id = id; } public String getFoodName() { return foodName; } public void setFoodName(String foodName) { this.foodName = foodName; } public String getTaste() { return taste; } public void setTaste(String taste) { this.taste = taste; } public String getPath() { return path; } public void setPath(String path) { this.path = path; } public String getPrice() { return price; } public void setPrice(String price) { this.price = price; } public String getDescribe() { return describe; } public void setDescribe(String describe) { this.describe = describe; } @Override public String toString() { return "Food [id=" + id + ", foodName=" + foodName + ", taste=" + taste + ", path=" + path + ", price=" + price + ", describe=" + describe + ", toString()=" + super.toString() + "]"; } } package com.imooc.food; import java.util.ArrayList; import java.util.Iterator; import java.util.List; public class FoodDaoImpl { private static final List<Food> db=new ArrayList<Food>(); private String msgString; public static List<Food> getDb(){ return db; } public String getMsgString() { return msgString; } public void setMsgString(String msgString) { this.msgString = msgString; } //添加菜品 public void addFood(Food food) { db.add(food); } //查询所有菜品信息 public List<Food> getAllFood(){ if(db.isEmpty()) { System.out.println("菜单是空的"); return null; }else { Iterator it=db.iterator(); return db; } } //根据菜品名称查询菜品信息 public Food getFoodByName(String foodName) { Food food=new Food(); for(int i=0;i<db.size();i++) { if(db.get(i).getFoodName().equals(foodName)) { food=db.get(i); break; } } return food; } //根据菜品id查询菜品信息 public Food getFoodById(String id) { Food food=new Food(); for(int i=0;i<db.size();i++) { if(db.get(i).getId().equals(id)) { food=db.get(i); break; } } return food; } //菜品修改 public void updateFood(Food newFood) { for(int i=0;i<db.size();i++) { if(db.get(i).getId().equals(newFood.getId())) { db.remove(i); db.add(i, newFood); System.out.println("菜品已更新完成!"); break; } } } //根据菜品ID进行删除 public void deleteFoodById(String id) { if(db.isEmpty()) { System.out.println("菜品是空的"); return; }else { for(int i=0;i<db.size();i++) { if(db.get(i).getId().equals(id)) { db.remove(i); break; } } } } }
package com.imooc.servlet; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.util.HashMap; import java.util.List; import java.util.Map; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.commons.fileupload.FileItem; import org.apache.commons.fileupload.FileUploadException; import org.apache.commons.fileupload.disk.DiskFileItemFactory; import org.apache.commons.fileupload.servlet.ServletFileUpload; import com.imooc.food.Food; import com.imooc.food.FoodDaoImpl; import com.imooc.utils.UploadUtils; /** * Servlet implementation class FoodAddServlet */ @WebServlet("/FoodAddServlet") public class FoodAddServlet extends HttpServlet { private static final long serialVersionUID = 1L; /** * @see HttpServlet#HttpServlet() */ public FoodAddServlet() { super(); // TODO Auto-generated constructor stub } /** * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) */ protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { FoodDaoImpl FoodDaoImpl1=(FoodDaoImpl) this.getServletContext().getAttribute("FoodDaoImpl"); List<Food> foodList=(List<Food>) this.getServletContext().getAttribute("foodList"); if(foodList.isEmpty()) { System.out.println("从servletContext中获得的集合是空的"); } try { //定义一个Map集合用于保存接收到的数据(即addFood.jsp提交的) Map<String, String> map = new HashMap<String, String>(); //1、创建一个磁盘文件项工厂对象 DiskFileItemFactory diskFileItemFactory = new DiskFileItemFactory(); //2、创建一个核心的解析类 ServletFileUpload servletFileUpload = new ServletFileUpload(diskFileItemFactory); //3、解析request请求,返回的是List集合,List集合中存放的是FileItem对象 List<FileItem> list = servletFileUpload.parseRequest(request); //4、遍历list,查看传递过来的数据是什么 String url = null; for(FileItem fileItem:list) { if(fileItem.isFormField()) { //普通表单项:单选框、多选框、按钮 //接收表单项参数的值 String name = fileItem.getFieldName();//获得表单项的name属性的值 String value = fileItem.getString("UTF-8"); //存放在map中 map.put(name, value); }else { //文件上传项 //获得文件上传的名称 String fileName=fileItem.getName(); if(fileName!=null && !"".equals(fileName)) { //通过工具类获得唯一文件名 String uuidFileName=UploadUtils.getUUIDFileName(fileName); //获得文件上传的数据 InputStream is=fileItem.getInputStream(); //获得文件上传的路径 String path=this.getServletContext().getRealPath("/foodImage"); //将输入流对接到输出流 url=path+"\\"+uuidFileName; OutputStream os=new FileOutputStream(url); int len=0; byte[] b=new byte[1024]; while((len=is.read(b))!=-1) { os.write(b, 0, len); } is.close(); os.close(); } } } if(foodList==null) System.out.println("从ContextServlet中获得的菜单是空的"); if(foodList!=null) { //检验网页上添加的菜名是否已存在 for(Food food:foodList) { if(food.getId().equals(map.get("id"))) { request.setAttribute("msg", "菜名已存在"); //菜名已存在,跳转到添加界面 request.getRequestDispatcher("/addFood.jsp").forward(request, response); return; } } } //新添加的菜名可上传,封装相关数据 Food food = new Food(); food.setId(map.get("id")); food.setFoodName(map.get("foodName")); food.setTaste(map.get("taste")); food.setPath(url); food.setPrice((map.get("price"))); food.setDescribe(map.get("description")); if( FoodDaoImpl1==null) { FoodDaoImpl1=new FoodDaoImpl(); } //添加到全局对象FoodDaoImpl1中 FoodDaoImpl1.addFood(food); this.getServletContext().setAttribute("FoodDaoImpl1", FoodDaoImpl1); //跳转到展示食物界面 request.getRequestDispatcher("/showFoodList.jsp").forward(request, response); //response.sendRedirect(request.getContextPath()+"/showFoodList.jsp"); } catch (FileUploadException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } package com.imooc.servlet; import java.io.IOException; import java.util.List; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import com.imooc.food.Food; import com.imooc.food.FoodDaoImpl; /** * Servlet implementation class FoodDeleteServlet */ @WebServlet("/FoodDeleteServlet") public class FoodDeleteServlet extends HttpServlet { private static final long serialVersionUID = 1L; /** * @see HttpServlet#HttpServlet() */ public FoodDeleteServlet() { super(); // TODO Auto-generated constructor stub } /** * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) */ protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { FoodDaoImpl FoodDaoImpl1=(FoodDaoImpl)this.getServletContext().getAttribute("FoodDaoImpl1"); List<Food> foodList=FoodDaoImpl1.getDb(); String deleteFoodId = request.getParameter("id"); String msg=FoodDaoImpl1.getMsgString(); boolean flag=false; for(Food food:foodList) { if(food.getId().equals(deleteFoodId)) flag=true; } if(flag==false) { msg="输入的id无效,请重新输入"; request.setAttribute("msg",msg); } if(flag==true) { FoodDaoImpl1.deleteFoodById(deleteFoodId); this.getServletContext().setAttribute("FoodDaoImpl1", FoodDaoImpl1); msg="根据id删除菜品已完成"; request.setAttribute("msg",msg); request.getRequestDispatcher("/showFoodList.jsp").forward(request, response); } } } package com.imooc.servlet; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.commons.fileupload.FileItem; import org.apache.commons.fileupload.FileUploadException; import org.apache.commons.fileupload.disk.DiskFileItemFactory; import org.apache.commons.fileupload.servlet.ServletFileUpload; import com.imooc.food.Food; import com.imooc.food.FoodDaoImpl; import com.imooc.utils.UploadUtils; /** * Servlet implementation class FoodUpdateServlet */ @WebServlet("/FoodUpdateServlet") public class FoodUpdateServlet extends HttpServlet { private static final long serialVersionUID = 1L; /** * @see HttpServlet#HttpServlet() */ public FoodUpdateServlet() { super(); // TODO Auto-generated constructor stub } /** * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) */ protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { request.setCharacterEncoding("UTF-8"); FoodDaoImpl FoodDaoImpl1=(FoodDaoImpl) this.getServletContext().getAttribute("FoodDaoImpl1"); List<Food> foodList=FoodDaoImpl1.getDb(); if(foodList.isEmpty()) { System.out.println("从ServletContext中获取的list是空的"); } Map<String, String> map = new HashMap<String, String>(); try { //1.创建磁盘工厂项文件 DiskFileItemFactory diskFileItemFactory=new DiskFileItemFactory(); //2.创建一个核心解析类 ServletFileUpload servletFileUpload=new ServletFileUpload(diskFileItemFactory); //3.解析requst请求,返回的是List集合,List集合中存放的是FileItem对象 List<FileItem> list = servletFileUpload.parseRequest(request); //4.遍历List集合,判断FileItem类型 String url = null; for(FileItem fileItem:list) { if(fileItem.isFormField()) { String name=fileItem.getName(); String value=fileItem.getString("UTF-8"); map.put(name,value); }else { String fileName = fileItem.getName(); if(fileName!=null&&!"".equals(fileName)) { //通过工具类获取获取唯一文件名 String uuidFileName=UploadUtils.getUUIDFileName(fileName); //获得文件上传的数据 InputStream is=fileItem.getInputStream(); //获得文件上传的路径 String path = this.getServletContext().getRealPath("/foodImage"); url=path+"\\"+uuidFileName; OutputStream os=new FileOutputStream(url); int len=0; byte[] b=new byte[1024]; while((len=is.read(b))!=-1) { os.write(b, 0, len); } is.close(); os.close(); } } } // 检验菜名 Iterator<Food> iterator = foodList.iterator(); boolean flag = false; Food testFood = null; while(iterator.hasNext()) { testFood = iterator.next(); if(testFood.getId().equals(map.get("id"))) { flag=true; break; } } if(flag==false) { String msg = "您要修改的id:"+ map.get("id") + "菜单里没有"; request.setAttribute("msg", msg); request.getRequestDispatcher("/updateFood.jsp").forward(request, response); }else { Food food = new Food(); food.setId(map.get("id")); food.setFoodName(map.get("foodName")); food.setTaste(map.get("taste")); food.setPath(url); food.setPrice((map.get("price"))); food.setDescribe(map.get("description")); FoodDaoImpl1.updateFood(food); System.out.println("更新后的food为"+food); this.getServletContext().setAttribute(" FoodDaoImpl1", FoodDaoImpl1); request.getRequestDispatcher("/showFoodList.jsp").forward(request, response); // response.sendRedirect(request.getContextPath()+"/showFoodList.jsp"); } } catch (FileUploadException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } package com.imooc.servlet; import java.util.ArrayList; import java.util.List; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import com.imooc.food.Food; import com.imooc.food.FoodDaoImpl; /** * Servlet implementation class InitServlet */ public class InitServlet extends HttpServlet { @Override public void init() throws ServletException { //创建FoodDaoImpl对象 FoodDaoImpl FoodDaoImpl1=new FoodDaoImpl(); // 创建一个List集合用于保存用户注册的信息 List<Food> foodList=FoodDaoImpl1.getDb(); //将List保存到ServletContext作用域中 this.getServletContext().setAttribute("list", foodList); this.getServletContext().setAttribute("foodList", foodList); } } package com.imooc.servlet; import java.io.IOException; import java.util.List; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import com.imooc.food.Food; import com.imooc.food.FoodDaoImpl; /** * Servlet implementation class SelectServlet */ @WebServlet("/SelectServlet") public class SelectServlet extends HttpServlet { private static final long serialVersionUID = 1L; /** * @see HttpServlet#HttpServlet() */ public SelectServlet() { super(); // TODO Auto-generated constructor stub } /** * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) */ protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { request.setCharacterEncoding("UTF-8"); FoodDaoImpl FoodDaoImpl1=(FoodDaoImpl) this.getServletContext().getAttribute("FoodDaoImpl1"); List<Food> list=FoodDaoImpl1.getDb(); String foodName = request.getParameter("foodName"); Food foodSearch=FoodDaoImpl1.getFoodByName(foodName); boolean flag=false; if(foodSearch!=null) { flag=true; } if(flag==false) { String msg = "对不起,您要查找的"+foodName+"我们家餐馆没有"; request.setAttribute("msg", msg); request.getRequestDispatcher("/selectFoodByName.jsp").forward(request, response); }else { request.getSession().setAttribute("foodSearch", foodSearch); request.getRequestDispatcher("/showFoodList.jsp").forward(request, response); } } }
package com.imooc.utils; import java.util.UUID; public class UploadUtils { /** * 生成唯一的文件名 */ public static String getUUIDFileName(String fileName) { //将文件名的前面部分进行截取:xx.jpg --> .jpg int idx=fileName.lastIndexOf("."); String extention=fileName.substring(idx); String uuidFileName=UUID.randomUUID().toString().replace("-", "")+extention; return uuidFileName; } }
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <% String path = request.getContextPath(); //path是project的名字 String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; %> <!DOCTYPE html> <html> <head> <base href="<%=basePath%>"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>添加菜品</title> <style type="text/css"> </style> </head> <body> <center> <h1>菜品添加</h1> <% String msg=""; if(request.getAttribute("msg")!=null){ msg=(String)request.getAttribute("msg"); } %> <h2 style="color: red;font-weight: bolder;">${requestScope.msg }</h2> <form action="<%=basePath%>/FoodAddServlet" method="post" enctype="multipart/form-data"> <table border="1px" width="400px" cellspacing="0px" cellpadding="0px"> <tr> <td>菜品 ID</td> <td><input type="text" name="id"></td> </tr> <tr> <td>菜 名</td> <td><input type="text" name="foodName"></td> </tr> <tr> <td>口 味</td> <td> <input type="radio" name="taste" value="香辣">香辣 <input type="radio" name="taste" value="微辣">微辣 <input type="radio" name="taste" value="麻辣">麻辣 <input type="radio" name="taste" value="不辣">不辣 </td> </tr> <tr> <td>菜品图片</td> <td><input type="file" name="foodImage"></td> </tr> <tr> <td>价 格</td> <td><input type="text" name="price"></td> </tr> <tr> <td>菜品描述</td> <td> <textarea name="description"></textarea> </td> </tr> <tr style="text-align:center;width:20px"> <td colspan="2"> <input type="submit" value="添加"> <input type="reset" value="重置"> </td> </tr> </table> </form> </center> </body> </html> <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <% String path = request.getContextPath(); //path是project的名字 String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; %> <!DOCTYPE html> <html> <head> <base href="<%=basePath%>"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>菜品删除(根据ID删)</title> <style type="text/css"> </style> </head> <body> <center> <h1>菜品删除(根据ID删除)</h1> <h2 style="color: red;font-weight: bolder;">${requestScope.msg }</h2> <form action="<%=basePath%>/FoodDeleteServlet" method="post"> <table width="400px" border="1px" cellspacing="0px" cellpadding="0px"> <tr> <td>菜品ID</td> <td><input type="text" name="id"></td> </tr> <tr> <td colspan="2" style="text-align:center"><input type="submit" value="删除"></td> </tr> </table> </form> </center> </body> </html> <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Document</title> </head> <body> <p><a href="addFood.jsp" target="main">菜品添加</a></p> <p><a href="selectFood.jsp" target="main">菜品查询</a></p> <p><a href="updateFood.jsp" target="main">菜品修改</a></p> <p><a href="deleteById.jsp" target="main">菜品删除</a></p> </body> </html> <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <% String path = request.getContextPath(); //path是project的名字 String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; %> <!DOCTYPE html> <html> <head> <base href="<%=basePath%>"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>菜品查询选项页面</title> <style type="text/css"> </style> </head> <body> <center> <p><a href="/showFoodList.jsp">查询所有菜品信息</a></p> <p><a href="/selectFoodByName.jsp">菜名查询</a></p> </center> </body> </html> <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <% String path = request.getContextPath(); //path是project的名字 String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; %> <!DOCTYPE html> <html> <head> <base href="<%=basePath%>"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>菜名查询</title> <style type="text/css"> </style> </head> <body> <center> <h1>菜名查询</h1> <% String msg = ""; if(request.getAttribute("msg")!=null){ msg = (String) request.getAttribute("msg"); } %> <h2 style="color: red;font-weight: bolder;"><%=msg %></h2> <form action="<%=basePath%>/SelectServlet" method="post"> <input type="hidden" name="type" value="2"> <table width="400px" border="1px" cellspacing="0px" cellpadding="0px"> <tr> <td>菜名</td> <td><input type="text" name="foodName"></td> </tr> <tr> <td colspan="2" style="text-align:center"><input type="submit" value="查询"></td> </tr> </table> </form> </center> </body> </html> <%@page import="com.imooc.food.Food"%> <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> <!DOCTYPE html> <html> <head> <% String basePath=request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+request.getContextPath()+"/"; %> <base href="<%=basePath%>"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>菜品管理系统</title> </head> <frameset rows="20%,*"> <frame src="./top.jsp"></frame> <frameset cols="10%,*"> <frame src="./left.jsp"></frame> <frame name="main"></frame> </frameset> </frameset> </html> <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%@page import="com.imooc.food.Food"%> <%@page import="com.imooc.food.FoodDaoImpl"%> <%@page import="java.util.List" %> <!DOCTYPE html> <html> <head> <% String basePath=request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+request.getContextPath()+"/"; %> <base href="<%=basePath%>"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>菜品信息展示</title> <style type="text/css"> </style> </head> <body> <center> <h1>菜品查询</h1> <table border="1px" cellspacing="0px" cellpadding="0px" width="800px"> <thead> <tr> <th>菜品ID</th> <th>菜名</th> <th>口味</th> <th>菜品图片</th> <th>价格</th> <th>菜品描述</th> </tr> </thead> <tbody> <% FoodDaoImpl impl=new FoodDaoImpl(); List<Food> list=impl.getAllFood(); for(Food food:list){ String name=food.getPath(); System.out.print(name); int idx=food.getPath().lastIndexOf("\\"); String img=food.getPath().substring(idx+1); %> <tr> <td><%=food.getId() %></td> <td><%=food.getFoodName() %></td> <td><%=food.getTaste() %></td> <td><img src="/menu_food/foodImage/<%=img %>"></td> <td><%=food.getPrice() %></td> <td><%=food.getDescribe() %></td> </tr> <% } %> </tbody> </table> </center> </body> </html> <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>菜品后台管理系统</title> </head> <body> <center> <h1>菜品后台管理系统</h1> </center> </body> </html> <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <% String path = request.getContextPath(); //path是project的名字 String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; %> <!DOCTYPE html> <html> <head> <base href="<%=basePath%>"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>菜品修改(根据菜品ID进行修改)</title> <style type="text/css"> </style> </head> <body> <center> <h1>根据菜品ID修改</h1> <form action="<%=basePath%>/FoodUpdateServlet" method="post" enctype="multipart/form-data"> <table border="1px" width="400px" cellspacing="0px" cellpadding="0px"> <tr> <td>修改ID</td> <td><input type="text" name="id"></td> </tr> <tr> <td>菜 名</td> <td><input type="text" name="foodName"></td> </tr> <tr> <td>口 味</td> <td> <input type="radio" name="taste" value="香辣">香辣 <input type="radio" name="taste" value="微辣">微辣 <input type="radio" name="taste" value="麻辣">麻辣 <input type="radio" name="taste" value="不辣">不辣 </td> </tr> <tr> <td>菜品图片</td> <td><input type="file" name="foodImage"></td> </tr> <tr> <td>价 格</td> <td><input type="text" name="price"></td> </tr> <tr> <td>菜品描述</td> <td> <textarea name="description"></textarea> </td> </tr> <tr style="text-align:center;width:20px"> <td colspan="2"> <input type="submit" value="修改"> <input type="reset" value="重置"> </td> </tr> </table> </form> </center> </body> </html>
<?xml version="1.0" encoding="UTF-8"?> <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" id="WebApp_ID" version="3.1"> <display-name>menu_food</display-name> <welcome-file-list> <welcome-file>index.html</welcome-file> <welcome-file>index.htm</welcome-file> <welcome-file>index.jsp</welcome-file> <welcome-file>default.html</welcome-file> <welcome-file>default.htm</welcome-file> <welcome-file>default.jsp</welcome-file> </welcome-file-list> <servlet> <description></description> <display-name>InitServlet</display-name> <servlet-name>InitServlet</servlet-name> <servlet-class>com.imooc.servlet.InitServlet</servlet-class> <load-on-startup>2</load-on-startup> </servlet> <servlet-mapping> <servlet-name>InitServlet</servlet-name> <url-pattern>/InitServlet</url-pattern> </servlet-mapping> </web-app>
0
收起
正在回答 回答被采纳积分+1
4回答
从网页搭建入门Java Web2018版
- 参与学习 人
- 提交作业 1088 份
- 解答问题 10205 个
如果你有Java语言基础,又想以后从事Java Web开发,那么本路径是你的不二选择!本路径从网页搭建开始入手,通过大量案例来学习Java Web基础。定能助你完成Java Web小白的蜕变!
了解课程
恭喜解决一个难题,获得1积分~
来为老师/同学的回答评分吧
0 星