0

I need documentation about web.xml and pom.xml files. 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. i dont have errors but i cant deploy the projects in 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. I wonder how web developers know the code they need these files

  • 1
    One thing at a time. You can do web development without Maven; you can use Maven for desktop apps. Don't bite off too much at once. Your real problem is Eclipse. I'm betting you don't know that well, either. Too much ignorance. Make your problem smaller. – duffymo Aug 31 '17 at 23:53
  • I found this tutorial. if someone like me ignore this field, perhaps, this can help him: https://www.javatpoint.com/maven-pom-xml – Conrado Marzocca Sep 01 '17 at 00:42
  • At this point, you don't need assistance with Q&A, you need to find a (rencet) tutorial or book about Java Web develepment, and then maybe another about Maven if you find you still need it. The web and libraries are crowded with those. – Mickael Sep 01 '17 at 07:52
  • thanks a lot for you advice Mickael! – Conrado Marzocca Sep 02 '17 at 13:26

1 Answers1

0

web.xml is web application configuration file defines the servlet container used in the application. You can typically add start-up code, url-pattern as this will be called on application start. Example below extracted from Jersey RestFull service.

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

Good Reads:
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
3. Why do we use web.xml?

Mad-D
  • 4,479
  • 18
  • 52
  • 93