如下,请问怎样从delete方法 跳转 到最上方的queryAll方法
我发现刚开始
request.getRequestDispatcher("dishServlet?method=queryAll").forward(request, response);能生效
queryAll(request, response);不行
但莫名奇妙的是,第二天打开项目就只有queryAll(request, response);生效了。
package com.system.restaurant.servlet;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.apache.commons.beanutils.BeanUtils;
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 org.apache.commons.io.FilenameUtils;
import com.system.restaurant.dbutils.UUIDUtiil;
import com.system.restaurant.entity.Dish;
import com.system.restaurant.service.DishService;
public class DishServlet extends BaseServlet {
public void queryAll(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
/*HttpSession session = request.getSession();
String merchantid2 = (String) session.getAttribute("merchantid");
int merchantid = Integer.parseInt(merchantid2);*/
int merchantid = 1;
DishService ds = new DishService();
try {
List list = ds.queryAll(merchantid);
request.setAttribute("list", list);
System.out.println(list);
request.getRequestDispatcher("/dangan-list.jsp").forward(request, response);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
//删除菜品
public void delete(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
//String id = request.getParameter("id");
int dishid = Integer.parseInt(request.getParameter("dishid"));
/*HttpSession session = request.getSession();
String merchantid2 = (String) session.getAttribute("merchantid");
int merchantid = Integer.parseInt(merchantid2);*/
int merchantid = 1;
DishService ds = new DishService();
ds.delete(dishid,merchantid);
queryAll(request, response);
}
}