2016-07-03 6 views
0

Ich lerne JSF von einem Udemy-Tutorial und der Typ dort hat den folgenden Code darunter in der Datei faces-config.xml. Mit diesem Code bekomme ich folgende Fehlermeldung:Ungültiger Inhalt wurde gefunden, beginnend mit dem Element 'from-outcome'. Eine von '{"http: // xmlns.jcp.org/xml/ns/javaee":to-view-id}' wird erwartet

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.

Der Mann hat den <if>-Tag in dem Navigation-Fall vor den <from-outcome> wie im Code. Wie kann ich von diesem Fehler profitieren?

faces-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> 

Antwort

0

Ich löste das Problem nach dem if Zustand nach from-outcome wie folgt setzen:

<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>