JSF 1.2中的查询重排导航规则 [英] Query regrading navigation rule in JSF 1.2

查看:85
本文介绍了JSF 1.2中的查询重排导航规则的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我具有以下导航规则:

If I have below navigation rule :

<navigation-rule>
    <from-view-id>Mainview</from-view-id>
    <navigation-case>
        <from-outcome>outcome1</from-outcome>
        <to-view-id>view1</to-view-id>  
    </navigation-case>
    <navigation-case>
        <from-outcome>outcome2</from-outcome>
        <to-view-id>view2</to-view-id>  
        <redirect/>         
    </navigation-case>
    <navigation-case>
        <from-outcome>outcome3</from-outcome>
        <to-view-id>view3</to-view-id>  
        <redirect/>         
    </navigation-case>
</navigation-rule>

如果整个流程没有任何验证错误,那么一切都会正常进行.那是:

If there is no any validation error for this entire flow , everything will work fine. That is :

步骤1)MainForm中的方法返回result1渲染view1 步骤2)视图1中的方法返回渲染视图2的结果 步骤3)view2中的方法返回结果3渲染view3

Step 1)Method from MainForm returns outcome1 rendering view1 Step 2)Method from view1 returns outcome2 rendering view2 Step 3)Method from view2 returns outcome3 rendering view3

请注意,以上规则中没有重定向,这意味着浏览器将在浏览器窗口中显示Mainview.

Please note that there is no redirect in above rule , meaning browser will have Mainview displayed in browser window.

如果在上面的步骤2中,验证失败,则浏览器将在地址栏中显示view1,而不是显示view2.

If at step 2 above , validation fails , then instead of showing view2 , browser will have view1 shown in the address bar.

现在,对于下一个流程(一旦验证成功),起点将不是Mainview,但是view1意味着必须编写导航用例 带有view1

Now , for the next flow (once validation succeeds), starting point won't be Mainview but view1 meaning navigation cases will have to be written with view1

如何处理?我们是否需要编写另一套导航规则?还是像上面那样设计导航规则是错误的?

How can this be handled ? Do we need to write another set of navigation-rules ? Or designing navigation-rule like above is plain wrong ?

推荐答案

查看

Looking at the specification, we must conclude there can only be one <from-view-id> tag into each <navigation-rule>.

from-view-id::一个可选元素,包含完整的页面标识符(页面的上下文相关相对路径)或以星号(*)通配符结尾的页面标识符前缀.如果您使用通配符,则该规则将应用于与通配符模式匹配的所有页面.要制定适用于所有页面的全局规则,请将此元素留空.

from-view-id: An optional element that contains either a complete page identifier (the context sensitive relative path to the page) or a page identifier prefix ending with the asterisk (*) wildcard character. If you use the wildcard character, the rule applies to all pages that match the wildcard pattern. To make a global rule that applies to all pages, leave this element blank.

此标签为可选标签,您可以指定是否指定-请注意,您还可以指定通配符视图ID,因此导航案例涵盖与模式相关的每个视图ID-但每个规则只能有一个. 因此,对于您的情况,您有以下选择:

Being this tag optional, you can specify it or not -note that you can also specify a wildcard view id, so the navigation case covers every view id's that are related with the pattern- but you only can have one for each rule. So for your case you have the following options:

  • 创建一个新的导航规则以管理从view1开始的导航案例.
  • 使用某种模式覆盖您的视图ID,并使用通配符对其进行分组(将您的第一页命名为 view0 ):

  • Create a new navigation rule to manage navigation cases starting from view1.
  • Cover your view id's with a pattern and use a wildcard to group them (naming your first page view0):

<navigation-rule>
     <from-view-id>view*</from-view-id>
     <navigation-case>
     <from-outcome>outcome1</from-outcome>
     <to-view-id>view1</to-view-id>  
</navigation-case>
<navigation-case>
    <from-outcome>outcome2</from-outcome>
    <to-view-id>view2</to-view-id>  
    <redirect/>         
</navigation-case>
<navigation-case>
    <from-outcome>outcome3</from-outcome>
    <to-view-id>view3</to-view-id>  
    <redirect/>         
</navigation-case>

这篇关于JSF 1.2中的查询重排导航规则的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆