Seam导航文件pages.xml的读取

   我们都知道seam的导航文件pages是放在了WEB-INF下面,而且名字固定为pages.xml

   其实我们可以改变它的名字跟 存放路径:

 

 

 只需要在components.xml文件中定义:

 

<component name="org.jboss.seam.navigation.pages"
  class="org.jboss.seam.navigation.Pages">
  <property name="resources">
   <value>/WEB-INF/pages.xml</value>
   <value>/META-INF/jira_pages.xml</value>   
  </property>
 </component>

 

 

就可以定义你自己的导航文件了jira-pages.xml

 

<?xml version="1.0" encoding="UTF-8"?>
<pages xmlns="http://jboss.com/products/seam/pages"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://jboss.com/products/seam/pages http://jboss.com/products/seam/pages-2.1.xsd"

       no-conversation-view-id="/main.xhtml"
                 login-view-id="/home.xhtml">

    <page view-id="/register.xhtml">
   
        <action if="#{validation.failed}"
           execute="#{register.invalid}"/>
   
        <navigation>
            <rule if="#{register.registered}">
                <redirect view-id="/home.xhtml"/>
            </rule>
        </navigation>
       
    </page>

    <page view-id="/home.xhtml" action="#{identity.isLoggedIn}">

        <navigation from-action="#{identity.isLoggedIn}">
            <rule if-outcome="true">
                <redirect view-id="/main.xhtml"/>
            </rule>
        </navigation>
   
        <navigation>
            <rule if="#{identity.loggedIn}">
                <redirect view-id="/main.xhtml"/>
            </rule>
        </navigation>
       
    </page>
   
    <page view-id="/password.xhtml"
          login-required="true">
   
        <navigation>
            <rule if="#{changePassword.changed}">
                <redirect view-id="/main.xhtml"/>
            </rule>
        </navigation>
       
    </page>

    <page view-id="/main.xhtml"
          login-required="true">
       
        <navigation from-action="#{hotelBooking.selectHotel(hot)}">
            <redirect view-id="/hotel.xhtml"/>
        </navigation>
       
    </page>

 <page view-id="/hotel.xhtml"
          conversation-required="true">
         
        <description>View hotel: #{hotel.name}</description>
       
        <navigation from-action="#{hotelBooking.bookHotel}">
            <redirect view-id="/book.xhtml"/>
        </navigation>
       
    </page>

 <page view-id="/book.xhtml"
          conversation-required="true">
         
        <description>Book hotel: #{hotel.name}</description>
       
        <navigation from-action="#{hotelBooking.setBookingDetails}">
            <rule if="#{hotelBooking.bookingValid}">
                <redirect view-id="/confirm.xhtml"/>
            </rule>
        </navigation>
       
    </page>

 <page view-id="/confirm.xhtml"
          conversation-required="true">
         
        <description>Confirm booking: #{booking.description}</description>
       
        <navigation from-action="#{hotelBooking.confirm}">
            <redirect view-id="/main.xhtml"/>
        </navigation>
       
    </page>
   
    <page view-id="*">
   
        <navigation from-action="#{identity.logout}">
            <redirect view-id="/home.xhtml"/>
        </navigation>

        <navigation from-action="#{hotelBooking.cancel}">
            <redirect view-id="/main.xhtml"/>
        </navigation>
       
    </page>
   
    <exception class="org.jboss.seam.security.NotLoggedInException">
        <redirect view-id="/home.xhtml">
            <message severity="warn">You must be logged in to use this feature</message>
        </redirect>
    </exception>

    <exception class="javax.faces.application.ViewExpiredException">
        <redirect view-id="/home.xhtml">
            <message severity="warn">Session expired, please log in again</message>
        </redirect>
    </exception>

</pages>

   

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值