我正在使用 Eclipse Juno 版本,Tomcat 服务器。我创建了一个动态 Web 项目,在其中创建了 html 页面和相关的 servlet。我使用 requestDispatcher 从 servlet 调用了 html 页面之一。对我来说效果很好,几天后,我在 requestDispatcher 中更改了 html 页面的名称。它不识别新的 html 页面,它只显示旧的 html 页面。
我试图解决这个问题。我重新启动了 tomcat,清理了 tomcat 服务器,重新启动了 eclipse,
刷新了项目,但它仍然只显示旧的 html 页面。
如何解决这个问题?请有人帮助我。
谢谢你。
标题 1
公共类 MeatServlet 扩展 HttpServlet { private static final long serialVersionUID = 1L;
public MeatServlet() {
super();
// TODO Auto-generated constructor stub
}
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
String Chicken=request.getParameter("Chicken - 1lb");
String Goat = request.getParameter("Goat - 1lb");
String ChickenHalal = request.getParameter("Chicken Halal - 1lb");
String GoatHalal = request.getParameter("Goat Halal - 1lb");
HttpSession session = request.getSession();
session.setAttribute("Chicken - 1lb", Chicken);
session.setAttribute("Goat - 1lb", Goat);
session.setAttribute("Chicken Halal - 1lb", ChickenHalal);
session.setAttribute("Goat Halal - 1lb", GoatHalal);
ServletContext c = getServletContext();
RequestDispatcher rs = c.getRequestDispatcher("/TotalList.html");
rs.forward(request, response);
}
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
}
}
标题 2
公共类 MeatServlet 扩展 HttpServlet { private static final long serialVersionUID = 1L;
public MeatServlet() {
super();
// TODO Auto-generated constructor stub
}
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
String Chicken=request.getParameter("Chicken - 1lb");
String Goat = request.getParameter("Goat - 1lb");
String ChickenHalal = request.getParameter("Chicken Halal - 1lb");
String GoatHalal = request.getParameter("Goat Halal - 1lb");
HttpSession session = request.getSession();
session.setAttribute("Chicken - 1lb", Chicken);
session.setAttribute("Goat - 1lb", Goat);
session.setAttribute("Chicken Halal - 1lb", ChickenHalal);
session.setAttribute("Goat Halal - 1lb", GoatHalal);
ServletContext c = getServletContext();
RequestDispatcher rs = c.getRequestDispatcher("/Online.html");
rs.forward(request, response);
}
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
}
}