Thanks for replying so quickly.

Here is my Trinidad menu.xml.  As you can see, I'm not using any actions
here; instead I'm using the destination attribute, which I believe works
similar to a hyperlink.
<menu xmlns="http://myfaces.apache.org/trinidad/menu";>
  <itemNode id="in1" label="Index Page" destination="/gcm/faces/index.jspx"
focusViewId="/index.jspx" visable="true" />
  <itemNode id="in1in1" label="Page Two"
destination="/gcm/faces/page2.jspx" focusViewId="/page2.jspx"
visable="true" />
  <itemNode id="in1in2" label="Page Three"
destination="/gcm/faces/page3.jspx" focusViewId="/page3.jspx"
visable="true" />
  <itemNode id="in1in3" label="Page Four"
destination="/gcm/faces/page2.jspx" focusViewId="/page2.jspx"
visable="true" />
  <itemNode id="in1in4" label="Page Five"
destination="/gcm/faces/page2.jspx" focusViewId="/page2.jspx"
visable="true" />
</menu>


I think I'm starting to see my problem.  For OnLoad to work, do I need have
navigation in faces-config.xml for each page?  Something like…
<navigation-rule>
    <from-view-id>/index.jspx</from-view-id>
    <navigation-case>
      <from-outcome>notloggedin</from-outcome>
      <to-view-id>/login.jspx</to-view-id>
    </navigation-case>
  </navigation-rule>

If this is true, do I put the navigation-rule in for the page I'm loading
or the one I'm leaving?   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?  

Thanks,
-Nate


>What are your navigation rules in your faces-config for outcomes 1 and 9?

>On Thu, Jul 31, 2008 at 9:35 AM,  <[EMAIL PROTECTED]> wrote:
>> Hello,
>>
>> I have been looking for a solution that will allow me to check if a user
>> has been logged in before I load a page.  If the user is not logged in,
or
>> the session has timed out, I want to send the user to the login page.  
In
>> my searching if found the jsf-comp onload project.  From the outside
this
>> looks exactly like what I want; however, I have been having problems
>> implementing it.
>>
>> I'm running JSF 1.2, Tomcat 6, and Apache Trinidad 1.2.8.  I have
created a
>> onload-config.xml and installed the jsfNet 0.9.0 jar.  I'm using the
>> Trinidad XMLMenu for my menuing, and in the top menu the destination
>> attribute is used instead of the action attribute.
>>
>> I get the following logs from OnLoad when I start my webapp:
>>  18:53:20 INFO  GC   On Load configuration is being loaded from
>> /WEB-INF/onload-config.xml
>>  18:53:20 INFO  GC   2 rule(s) have been found
>>  18:53:20 DEBUG GC   Rule: view-id: /index.jspx, action:
>> #{scoreController.getScore1}, success-result: null
>>  18:53:20 DEBUG GC   Rule: view-id: /faces/page*, action:
>> #{scoreController.score99}, success-result: 9
>>
>> Now when I go to index.jspx, I want to check if the user is logged in. 
For
>> my test I am using the scoreController object returns "1" as a string
from
>> getScore1.  I tried setting success-result to null, "1", and "9", but
not
>> matter what I set it too the navigation always goes to index.jspx.   As
a
>> test I tried extending OnLoadPhaseListener's  beforeHandleNavigation
>> function and returning false, but that didn't work either.
>>
>> Here are the logs I get when I I click "index.jspx" menu.  (In this test
>> run I have success-result set to null).
>>  18:53:20 DEBUG GC   Processing on load of view /index.jspx
>>  18:53:20 DEBUG GC   Looking for rule for view /index.jspx
>>  18:53:20 DEBUG GC   Checking for exact match. Rule view: /index.jspx
>>  18:53:20 INFO  GC   Found rule with exact match
>>  18:53:20 DEBUG GC   Invoking action: #{scoreController.getScore1}
>>  18:53:20 INFO  JSF  Using LifecycleProvider
>> org.apache.myfaces.config.annotation.TomcatAnnotationLifecycleProvider
>>  18:53:20 INFO  JSF  Creating instance of
>> com.stoddardsoftware.golfclap.web.score.ScoreController
>>  18:53:20 INFO  GC   NATE TEST:  processing beforeHandleNavigation
now...
>>  18:53:20 DEBUG GC   Calling navigation handler with result: 1
>>  18:53:23 INFO  JSF  Creating instance of
>> org.apache.myfaces.trinidad.model.XMLMenuModel
>>
>> At this point I'm out of ideas.  Can someone show me an example of how
to
>> check if my user is logged in and then redirect to the login page if
they
>> are not?  Can this be done completely from onload-config.xml or will I
need
>> to extend OnLoadPhaseListener to redirect?
>>
>> Thank you for taking the time to help.
>>
>> -Nate
>>
>>


Reply via email to