Excellent! It is working now. I added the following navigation rule to
onload-config.xml:
<navigation-rule>
<view-id>/index.jspx</view-id>
<action>#{scoreController.getScore1}</action>
<success-result>userokay</success-result>
</navigation-rule>
and to faces-config.xml:
<navigation-rule>
<from-view-id>*</from-view-id>
<navigation-case>
<from-outcome>userrequireslogin</from-outcome>
<to-view-id>/login.jspx</to-view-id>
</navigation-case>
</navigation-rule>
I have a couple of followup questions.
1. Andrew: Back in 2007 there was a posting between you and mraible about
getting the OnLoad components built with maven so they would be available
on the maven repo. Did this occur? I looked in the repo but only found
http://repo1.maven.org/maven2/net/sourceforge/jsf-comp/acegi-jsf/.
1a. If it was built, are the components stored in another repo?
2. I ran a test where I extended the beforeHandleNavigation function and
returned false; however, the navigation continued to the index.jspx page.
What is the purpose of the boolean returned from beforeHandleNavigation? I
expected it to stay on the same page with false.
3. Is there an advantage of setting the "success-result" setting in
onload-config.xml?
3a. Does it bypass the face-config.xml navigation rule on the view-id check
when success-result matches the outcome of action?
4. Is the "action" variable in onload-config.xml EL?
4a. If I set the action to the following: #{scoreController.score1} I get a
javax.faces.el.MethodNotFoundException because it is trying to access:
[EMAIL PROTECTED](). If I use the full function name
getScore1(), this it works correctly. Do I have something setup
incorrectly?
Thank you again for helping me get this going.
-Nate
On Thu, 31 Jul 2008 13:56:27 -0600, "Andrew Robinson"
<[EMAIL PROTECTED]> wrote:
>> If this is true, do I put the navigation-rule in for the page I'm
loading
>> or the one I'm leaving?
>
> Yes. It uses the current view ID. Since the phase listener is hooked
> to before render, the requested view's viewId has already be
> established. So you use the navigation rules just as if someone is
> executing an action from the requested view.
>
>> Is there a generic handling of this in
>> faces-config.xml. Such as any page that returns with an action of
>> "notloggedin" would go to the login.jspx page?
>
> You can use * as the view ID in your faces-config to trap actions or
> outcomes globally.
>
> There is an example WAR in the test code of the onload component that
> you can have a look at too.
>
> -Andrew