在jsp中使用application
- <%
- applicaiton.setAttribute(”userId”, “testUser”);
- %>
在servlet中使用application
- ServletContext application = getServletConfig().getServletContext();
- //或者
- ServletContext application=httpServletRequest.getSession().getServletContext();
在Struts1.X Action 类中中使用application
- ServletContext application = getServlet().getServletConfig().getServletContext();