1.如何得到servletContext

a.HttpServlet
this.getServletConfig().getServletContext();
b.Jsp
pageContext.getServletConfig();

c.Action
覆盖setServlet
public void setServlet(ActionServlet actionServlet) {
       super.setServlet(actionServlet);
       ServletContext servletContext = actionServlet.getServletContext();
       //WebApplicationContext wac = WebApplicationContextUtils.
                  getRequiredWebApplicationContext(servletContext);
       //this.orderService = (IOrderService) wac.getBean("orderService");
 }



2.RequestDispatcher 出现的问题

hello.jsp 中
   <form name="theForm" action="/myWebApp/hello.jsp" method="get">
      <input type="text" name="userName" value="test"> <br />
      <input type="test" nam="password" value="123"> <br />
      <input type="submit" value="SUBMIT">
   </form>
   <jsp:include page="/handleHttpServlet"/>


handleHttpServlet中
  request.setAttribute("carriers", carriers);
  RequestDispatcher rd = request.getRequestDispatcher("/info.jsp");
  rd.forward(request, response);
  //rd.include(request, response);

上例中hello.jsp的内容,变成了info.jsp,本来应该include,因为servlet中采用了forward,
改正应该变成rd.include(request, response);