You can use default mappings of outcomes to results pages. In the absence of explicit navigation rules, the return values of the action controller method correspond to the file names that should be used. Suppose that your form (file form.xhtml, URL form.jsf) says <h:commandButton ... action="#{someBean.someMethod}"/>. When the button is pressed, the bean named someBean is instantiated (assuming request scope), setter methods corresponding to the h:inputBlah elements are run, validation occurs, and then someMethod is executed. This is the same as in JSF 1.x, except that the managed bean name (someBean) can be derived from the bean class name (SomeBean). But now, if someMethod returns "foo" and "bar", and there are no explicit navigation rules in faces-config.xml for those outcomes, then JSF will assume that they correspond to foo.xhtml and bar.xhtml (from the same folder as form.xhtml), respectively. For example, in the this sample bean, the outcomes correspond toaccepted.xhtml and rejected.xhtml.
组件的action的绑定函数返回值(outcome)决定页面导航,例如返回"foo"和"bar",先查找faces-config.xml里是否有对应的navigation-rule,有则使用之,否则导航到返回值对应的页面,即foo.xhtml/bar.xhtml.
Normally the return value of an action controller method determines the page navigation. But there is no navigation with
f:ajax: the original page is still displayed. So, the return value is irrelevant.
一般情况下action控制函数的返回字符串决定页面导航,但是使用f:ajax时只会回显原页面,返回什么值 没多大关系。