2016-07-03 8 views
0

私はいくつかのUdemyチュートリアルからJSFを取得しています。その人の下に次のコードがありますfaces-config.xmlに追加します。このコードで、私は次のエラーを取得しています:要素 'from-outcome'で始まる無効なコンテンツが見つかりました。 '{"http:// xmlns.jcp.org/xml/ns/javaee":to-view-id}'が期待されています

cvc-complex-type.2.4.a: Invalid content was found starting with element 'from-outcome'. One of '{"http:// xmlns.jcp.org/xml/ns/javaee":to-view-id}' is expected.

男はコードのよう<from-outcome>前に、ナビゲーション・ケースで<if>タグを持っています。このエラーはどのように乗ることができますか?

顔-config.xhtml

<?xml version="1.0" encoding="UTF-8"?> 
<faces-config xmlns="http://xmlns.jcp.org/xml/ns/javaee" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-facesconfig_2_2.xsd" 
    version="2.2"> 

    <navigation-rule> 
     <from-view-id>/pages/welcome.xhtml</from-view-id> 

     <navigation-case> 
      <if>#{clasifBean.age le 11}</if> 
      <from-outcome>go</from-outcome> 
      <to-view-id>/pages/age/kid</to-view-id> 
      <redirect /> 
     </navigation-case> 

     <navigation-case> 
      <if>#{clasifBean.age gt 11 and clasifBean.age lt 40}</if> 
      <from-outcome>go</from-outcome> 
      <to-view-id>/pages/age/teen</to-view-id> 
      <redirect /> 
     </navigation-case> 

     <navigation-case> 
      <if>#{clasifBean.age ge 40}</if> 
      <from-outcome>go</from-outcome> 
      <to-view-id>/pages/age/old</to-view-id> 
      <redirect /> 
     </navigation-case> 

    </navigation-rule> 



</faces-config> 

答えて

0

私はこのようなfrom-outcomeif条件を入れた後、問題を解決しました:

<navigation-case> 
     <from-outcome>go</from-outcome> 
     <if>#{clasifBean.age le 11}</if> 
     <to-view-id>/pages/age/kid</to-view-id> 
     <redirect /> 
    </navigation-case> 
関連する問題