Adding new directories to path variable is really simple under Mac OS X. Just follow the next few steps:
  1. Open the Terminal (press + SPACE and type terminal).
  2. Make sure that you are in your home directory
  3. Type:
    echo 'export PATH=YOURDIRECTORY:$PATH' >> ~/.profil
    • Don't forget to replace "YOURDIRECTORY" with your directory string. In example: /opt/local/bin
  4. Re-open the terminal.
The directory you added should be available in the path variable now.


When you have to access your Managed Bean in a servlet, it depends on the scope you set for the Bean.

Request-Scope:
HttpServletRequest httpRequest = (HttpServletRequest) request;

YourBean bean = (YourBean) request.getAttribute("yourBean");
Session-Scope:
HttpServletRequest httpRequest = (HttpServletRequest) request;
HttpSession httpSession = httpRequest.getSession();

YourBean bean = (YourBean) httpSession.getAttribute("yourBean");
Application-Scope:
HttpServletRequest httpRequest = (HttpServletRequest) request;
HttpSession httpSession = httpRequest.getSession();
ServletContext ctx = httpSession.getServletContext();

YourBean bean = (YourBean) ctx.getAttribute("yourBean");