java Programming Glossary: getservletcontext
Howto load a resource from WEB-INF directory of a web archive http://stackoverflow.com/questions/1108434/howto-load-a-resource-from-web-inf-directory-of-a-web-archive  a JSP EDITED If you're inside a Servlet object then call getServletContext . If you're in JSP use the predefined variable application ... 
 Servlet for serving static content http://stackoverflow.com/questions/132052/servlet-for-serving-static-content  throws ServletException IOException RequestDispatcher rd getServletContext .getNamedDispatcher default HttpServletRequest wrapped new HttpServletRequestWrapper.. 
 How can I manually load a Java session using a JSESSIONID? http://stackoverflow.com/questions/1499581/how-can-i-manually-load-a-java-session-using-a-jsessionid  session se.getSession final ServletContext context session.getServletContext context.setAttribute session.getId session @Override public.. session se.getSession final ServletContext context session.getServletContext context.removeAttribute session.getId  Which adds all sessions.. final String sessionId final ServletContext context getServletContext final HttpSession session HttpSession context.getAttribute sessionId.. 
 JSP programmatically render http://stackoverflow.com/questions/1719254/jsp-programmatically-render  throws ServletException IOException  File root new File getServletContext .getRealPath  String main jsp include page page1 jsp include.. 
 Simplest way to serve static data from outside the application server in a Java web application http://stackoverflow.com/questions/1812244/simplest-way-to-serve-static-data-from-outside-the-application-server-in-a-java  new File path to images filename response.setContentType getServletContext .getMimeType file.getName response.setContentLength file.length.. 
 Where to place configuration properties files in a JSP/Servlet web application? http://stackoverflow.com/questions/2161054/where-to-place-configuration-properties-files-in-a-jsp-servlet-web-application  path Properties properties new Properties properties.load getServletContext .getResourceAsStream WEB INF filename.properties Note that I.. class just accessible by the inherited GenericServlet#getServletContext . Put it somewhere in local disk file system so that you can.. 
 How do I pass information from a servlet to a JSP page http://stackoverflow.com/questions/2261420/how-do-i-pass-information-from-a-servlet-to-a-jsp-page  result yourArrayList then forward to the jsp getServletContext .getRequestDispatcher your.jsp .forward request response using.. 
 getResourceAsStream() vs FileInputStream http://stackoverflow.com/questions/2308188/getresourceasstream-vs-fileinputstream 
 Servlets: doGet and doPost http://stackoverflow.com/questions/2349633/servlets-doget-and-dopost  userDAO public void init this.userDAO Config.getInstance getServletContext .getDAOFactory .getUserDAO protected void doPost HttpServletRequest.. 
 JSF - get managed bean by name http://stackoverflow.com/questions/2633112/jsf-get-managed-bean-by-name  beanName and application scoped beans by Bean bean Bean getServletContext .getAttribute beanName If you're running in a dependency injection.. 
 Java JSP/Servlet: controller servlet throwing the famous stack overflow http://stackoverflow.com/questions/2946995/java-jsp-servlet-controller-servlet-throwing-the-famous-stack-overflow  the attributes correctly a RequestDispatcher dispatcher getServletContext .getRequestDispatcher WEB INF jsp index.jsp dispatcher.forward.. 
 Writing image to servlet response with best performance http://stackoverflow.com/questions/2979758/writing-image-to-servlet-response-with-best-performance  InputStream content response.setHeader Content Type getServletContext .getMimeType image.getFilename response.setHeader Content Length.. 
 Find number of active sessions created from a given client IP http://stackoverflow.com/questions/3679465/find-number-of-active-sessions-created-from-a-given-client-ip  void contextInitialized ServletContextEvent event event.getServletContext .setAttribute ATTRIBUTE_NAME this @Override public void requestInitialized.. follows SessionCounter counter SessionCounter.getInstance getServletContext int count counter.getCount 127.0.0.1   share improve this answer.. 
 How to check a uploaded file whether it is a image or other file? http://stackoverflow.com/questions/4169713/how-to-check-a-uploaded-file-whether-it-is-a-image-or-other-file  . String fileName uploadedFile.getFileName String mimeType getServletContext .getMimeType fileName if mimeType.startsWith image It's an image... 
 How to load resource from jar file packaged in a war file? http://stackoverflow.com/questions/4585553/how-to-load-resource-from-jar-file-packaged-in-a-war-file  code in one of my servlet as follows InputStream stream getServletContext .getResourceAsStream WEB INF test.properties Properties prop.. 
 Running a background Java program in Tomcat http://stackoverflow.com/questions/4907502/running-a-background-java-program-in-tomcat  ServletContextEvent arg0 ServletContext context arg0.getServletContext int nr_executors 1 ThreadFactory daemonFactory new DaemonThreadFactory.. ServletContextEvent arg0 ServletContext context arg0.getServletContext executor.shutdownNow or process wait until all pending jobs.. submit jobs to it ExecutorService executor ExecutorService getServletContext .getAttribute MY_EXECUTOR ... executor.submit myJob If you're.. 
 How to provide relative path in File class to upload any file? http://stackoverflow.com/questions/6059453/how-to-provide-relative-path-in-file-class-to-upload-any-file  windows env. This is what i am using to upload realPath getServletContext .getRealPath files destinationDir new File realPath if item.isFormField.. filename ... This is what i am using to upload realPath getServletContext .getRealPath files destinationDir new File realPath You should.. 
 Sharing session data between contexts in Tomcat http://stackoverflow.com/questions/9436736/sharing-session-data-between-contexts-in-tomcat  is available by ServletContext#getSessionCookieConfig . getServletContext .getSessionCookieConfig .setPath You could do this in ServletContextListener#contextInitialized.. 
 
 
     
      |