Nithin Satheesan
Nithin Satheesan

Reputation: 1716

Direct URL to a JSF bean action

Is there any way to get direct URL to a JSF bean action method?

Basically I want to be able to do the following:

<a href="/PA/faces/pageBeanAction">click</a>

And this should invoke a method in a JSF bean. Is it possible?

I'm using JSF 1.2.

Upvotes: 0

Views: 501

Answers (1)

BalusC
BalusC

Reputation: 1108852

Do the job in the constructor of the request scoped bean associated with the view behind the URL.

public class Bean {

    public Bean() {
        // Here.
    }

    // ...
}

As long as you've a #{bean.something} in the view, then the bean's constructor will be invoked.

Upvotes: 0

Related Questions