Hey Dani,

that is really a greenhorn's question ;-)

check this 
http://wiki.apache.org/myfaces/AccessFacesContextFromServlet
http://mail-archives.apache.org/mod_mbox/myfaces-users/200606.mbox/[EMAIL 
PROTECTED]

The servled would look like this, the managed bean has the name "appModel" and 
class AppModel in this example

public class CompressImages extends AbstractFacesServlet {
         protected void processRequest(HttpServletRequest request,
                         HttpServletResponse response) throws ServletException, 
IOException {
                // Get faces context
            FacesContext facesContext = getFacesContext(request, response);
            AppModel appModelBean = (AppModel) 
getManagedBean("appModel",facesContext);                

            // We only serve request with valid session !!!
            if (appModelBean==null) {
                java.util.logging.Logger.global.info("Bean is null.");
                return;
                } 
            else {
                        java.util.logging.Logger.global.info("Got bean.");
                }               

regards

Dani

Reply via email to