简体   繁体   English

Java EE中的web.xml和faces-config.xml的目的是什么?

[英]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. 我目前正在学习JavaEE,并没有遇到web.xml文件和face-config.xml文件背后的含义。 I know from my textbook "Core Java Server Faces" 3rd edition that the face-config file can have additional configuration parameters placed in it. 我从我的教科书“Core Java Server Faces”第3版中了解到,face-config文件可以在其中放置其他配置参数。 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... 例如,我已经看到了我认为在face-config文件中对我的一些bean参数的声明以及对其他页面的一些导航,例如...

    <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? 什么hoot是web.xml的? The textbook says my web.xml and beans.xml are needed to keep the application server happy. 教科书说我需要使用web.xml和beans.xml来保持应用服务器的满意度。 Okay cool but how does web.xml and face-config.xml interact? 好的很酷但是web.xml和face-config.xml如何交互? 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. web.xml是部署描述符文件,它是Web应用程序的servlet标准的一部分。 It is used to determine how URLs map to servlets, which URLs require authentication, and other information. 它用于确定URL如何映射到servlet,哪些URL需要身份验证以及其他信息。 This file resides in the app's WAR under the WEB-INF/ directory. 该文件位于WEB-INF /目录下的应用程序WAR中。

    Citation: Google Cloud Platform documentation : 引文: Google Cloud Platform文档

  • 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. faces-config.xml通常是JavaServer Faces技术中应用程序配置资源文件的名称,并提供用于配置资源的可移植配置格式(作为XML文档)。应用程序架构师创建一个或多个文件,称为应用程序配置资源文件,使用此格式来注册和配置对象以及定义导航规则。

    Citation: Java EE 5 tutorial . 引用: Java EE 5教程

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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