dev@jsftemplating.java.net

Re: JSFTemplating: Call one Handler from Other handler

From: Ken Paulsen <Ken.Paulsen_at_Sun.COM>
Date: Mon, 30 Apr 2007 18:01:13 -0700

Hi Priti,

By "chainable" I meant that you are not limited to a single handler, but
can invoke a series (or chain) of handlers:

<!command
    handler1();
    handler2();
    handler3();
/>

FYI, you can also do "if()" in there for conditional execution of handlers:

<!command
    if (#{foo}=#{bar}) {
       handler1();
    }
    handler2();
/>

Anyway, the answer to your question about invoking a handler from Java
code (such as from a Handler) is:

    com.sun.jsftemplating.util.HandlerUtil.dispatchHandler(...);

Although, as I suggested on IRC, you can often avoid needing a handler
in Java code by simply invoking the Java code that you need directly
(i.e. refactor you "shared" handler to contain its work in a Java
utility method and invoke the utility directly).

Good luck!

Ken

Priti Tiwary wrote:
> Hi,
> Has anyone tried calling one handler from other handler? Is that
> possible? I saw in Jsftemplating pdf on java net site saying that
> handlers are "Chainable" , what does that mean?
> Priti