2012-12-23 53 views
0

我跟着特立尼达的导航开发指南中的第一个例子,但结果链接总是作为“#”出现。我仔细检查了他们可下载的例子,但没有看到任何区别。简单的特立尼达导航

Main.xhtml

<tr:page> 
    <f:facet name="menuSwitch"> 
     <tr:navigationPane hint="button"> 
      <tr:commandNavigationItem text="Home" action="nav_main" /> 
      <tr:commandNavigationItem text="About" /> 
      <tr:commandNavigationItem text="Login" action="nav_login" rendered="#{!loginBean.loginStatus}" /> 
      <tr:commandNavigationItem text="Logut" 
       rendered="#{loginBean.loginStatus}" /> 
     </tr:navigationPane> 
...snip 
</tr:page> 

脸-config.xml中

<navigation-rule> 
    <navigation-case> 
     <from-outcome>nav_main</from-outcome> 
     <to-view-id>/main.xhtml</to-view-id> 
     <redirect/> 
    </navigation-case> 
    <navigation-case> 
     <from-outcome>nav_login</from-outcome> 
     <to-view-id>/login.xhtml</to-view-id> 
     <redirect/> 
    </navigation-case> 
</navigation-rule> 

无论是main.xhtml和login.xhtml坐在里面的WebContent,而不是埋另一个文件夹内。

我读此链接:http://myfaces.apache.org/trinidad/devguide/navigation.html

回答

0

OK,新手的错误。我没有读完整个Trinidad示例代码,并错过了一个Form标签来包围整个事物。

<tr:page> 
     <f:facet name="menuSwitch"> 
      <tr:form> 
      <tr:navigationPane hint="button"> 
       <tr:commandNavigationItem text="Home" action="navMain" /> 
       <tr:commandNavigationItem text="About" /> 
       <tr:commandNavigationItem text="Login" action="navLogin" rendered="#{!loginBean.loginStatus}" /> 
       <tr:commandNavigationItem text="Logut" 
        rendered="#{loginBean.loginStatus}" /> 
      </tr:navigationPane> 
      </tr:form> 
     </f:facet> 
...snip 
</tr:page>