0

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.

Nithin Satheesan
  • 1,546
  • 3
  • 17
  • 30

1 Answers1

0

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.

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555