简体   繁体   中英

JSF 1.2: Navigation rules in a different config file

I am using JSF 1.2 for my application. I am trying to create a separate config file (named: navigation-config.xml ) for all the navigation rules throughout my application. Below are the steps I followed for the same:

Made an entry in the web.xml file and placed it same directory where the faces-config.xml is present:

<context-param>
    <param-name>javax.faces.application.CONFIG_FILES</param-name>
    <param-value>/WEB-INF/faces-config.xml,/WEB-INF/navigation-config.xml</param-value>
</context-param>

Below is the content of navigation-config.xml :

<?xml version='1.0' encoding='UTF-8'?>

<!DOCTYPE faces-config PUBLIC
    "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN"
    "http://java.sun.com/dtd/web-facesconfig_1_1.dtd">

<faces-config>

<navigation-rule>
    <description>Welcome Screen Navigation</description>
    <from-view-id>/login.jspx</from-view-id>
    <navigation-case>
        <from-outcome>success</from-outcome>
        <to-view-id>/welcome.jspx</to-view-id>
    </navigation-case>      
</navigation-rule>

</faces-config>

When success , the navigation is not happening. If I remove the <navigation-rule> from the navigation-config.xml and add it to my faces-config.xml file then the navigation is working perfectly which means there are problems with the navigation-config.xml file navigation is having problems.

Please let me know how to resolve this, I need a separate file indicating all the navigation rules.

Try following...

make changes in web.xml file

> <context-param>
>     <param-name>javax.faces.application.CONFIG_FILES</param-name>
>     <param-value>/WEB-INF/faces-config.xml</param-value>
>     <param-value>/WEB-INF/navigation-config.xml</param-value> </context-param>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM