Hi again,

I've register only one preprocess-class to execute the code once per request. So the execute method in the preprocess chain do something and return the logic right value PROCESSING_COMPLETE(true). The code were execute correctly but the return value (true) avoid the execution of the doFilter(request, response).
         result = command.execute(context);
         if (result) {
             // Clean up the stored request attribute
             request.removeAttribute(CONTEXT_ATTR);
             // Bypass calling the remainder of the application
             return;
         }
         doFilter(...);

Why this is happen? Calling the remainder of what, when the processing are complete?
please help

kind regards
DaWorm



Craig McClanahan wrote:
On 1/27/07, Danny Worm <[EMAIL PROTECTED]> wrote:

Hi,

I've added the application manager to my application. This feature is
very nice to me. But there is an question about a command-class in the
preprocess-chain. Is it possible to get the FacesContext from the
web-application or an similar way to get the managed-beans from the
factory?


As long as you are executing inside a JSF request (i.e. a request mapped to
FacesServlet), you can use a convenient static method to get the
FacesContext for the current instance:

   FacesContext context = FacesContext.getCurrentInstance();

However, the preprocess chain is executed in a Servlet Filter, before the
JSF machinery has had a chance to create the FacesContext.  Therefore,
you'll want to access the underlying servlet API objects directly.  The
simplest way to do that is to cast the Context object passed in to your
command to a ShaleWebContext, which gives you accessors for all the servlet
API objects.


I want to rebind hibernate to the session.


To bind the hibernate session to a session attribute named "foo", you'd do
something like:

   Session hibernate =  ... create a hibernate session ...;
   ShaleWebContext swc = (ShaleWebContext) context;
   HttpSession session = (HttpSession) swc.getSession();
   session.setAttribute("foo", hibernate);

thanks
kind regards
DaWorm



Craig


Reply via email to