简体   繁体   中英

The purpose of web.xml and faces-config.xml in Java EE?

I'm currently learning about JavaEE in school and haven't come across the meaning behind the web.xml file and the face-config.xml file. I know from my textbook "Core Java Server Faces" 3rd edition that the face-config file can have additional configuration parameters placed in it. For example I have seen what I believe to be declarations to some of my bean parameters in a face-config file and some navigation to other pages such as...

    <navigation-rule>
        <navigation-case>
            <from-outcome>startOver</from-outcome>
            <to-view-id>/index.xhtml</to-view-id>
        <navigation-case>
    </navigation-case>

And what the hoot is web.xml for? The textbook says my web.xml and beans.xml are needed to keep the application server happy. Okay cool but how does web.xml and face-config.xml interact? Do they? Are these two files like the frame for my painting and the canvas for me to paint on?

In a nutshell:

  • web.xml is the deployment descriptor file and it is part of the servlet standard for web applications. It is used to determine how URLs map to servlets, which URLs require authentication, and other information. This file resides in the app's WAR under the WEB-INF/ directory.

    Citation: Google Cloud Platform documentation :

  • faces-config.xml is usually the name for the application configuration resource file in JavaServer Faces technology and provides a portable configuration format (as an XML document) for configuring resources.An application architect creates one or more files, called application configuration resource files, that use this format to register and configure objects and to define navigation rules.

    Citation: Java EE 5 tutorial .

你选择哪种编程语言,你必须告诉语言一些初始查找细节,然后该语言将处理剩余的进程。所以在java web.xml中是这样一个文件,用于通知基于java的Web应用程序关于在哪里查找以及在初始启动时需要注意什么。这个web.xml是基于Java的Web应用程序的核心。

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