简体   繁体   English

web.xml和pom.xml文档

[英]web.xml and pom.xml documentation

I need documentation about web.xml and pom.xml files. 我需要有关web.xml和pom.xml文件的文档。 i would like learn web develop, so i start some tutorials about that. 我想学习网络开发,所以我开始一些有关此的教程。 I use IDE eclipse and i choose the option maven project for develop the tutorials. 我使用IDE eclipse,并且选择选项maven项目来开发教程。 i dont have errors but i cant deploy the projects in web. 我没有错误,但是我不能在Web上部署项目。 May be my problems are that i not understand in totality the concept of this files. 可能是我的问题是我完全不了解此文件的概念。 Some documentation about this i sure that help me. 有关此的一些文档,我肯定会对我有所帮助。 I searched in Satck, in foros but i dont found documentation. 我在fort的Satck中搜索,但没有找到文档。 I wonder how web developers know the code they need these files 我想知道Web开发人员如何知道他们需要这些文件的代码

web.xml is web application configuration file defines the servlet container used in the application. web.xml是Web应用程序配置文件,定义了应用程序中使用的servlet容器。 You can typically add start-up code, url-pattern as this will be called on application start. 通常,您可以添加启动代码url-pattern,因为它将在应用程序启动时被调用。 Example below extracted from Jersey RestFull service. 以下示例摘自Jersey RestFull服务。

<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" 
id="WebApp_ID" version="3.0">
    <servlet>
        <servlet-name>Jersey Web Application</servlet-name>
        <servlet-class>org.glassfish.jersey.servlet.ServletContainer</servlet-class>
        <init-param>
            <param-name>jersey.config.server.provider.packages</param-name>
            <param-value>com.xxxx.shopper</param-value>
        </init-param>
        <load-on-startup>1</load-on-startup>
         <async-supported>true</async-supported>
    </servlet>
    <servlet-mapping>
        <servlet-name>Jersey Web Application</servlet-name>
        <url-pattern>/webapi/*</url-pattern>
    </servlet-mapping>
      <listener>
        <listener-class>com.xxxx.shopper.service.Startup</listener-class>
    </listener>
</web-app>

pom.xml is maven configuration file defines build process and loads any dependencies. pom.xml是maven配置文件,用于定义构建过程并加载所有依赖项。

Good Reads: 好读物:
1. https://www.mkyong.com/maven/how-to-create-a-web-application-project-with-maven/ 1. https://www.mkyong.com/maven/how-to-create-a-web-application-project-with-maven/
2. Difference between web projects with pom.xml and web.xml 2. 使用pom.xml和web.xml的Web项目之间的区别
3. Why do we use web.xml? 3. 为什么要使用web.xml?

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

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