javajakarta-eeservletsweb.xmldeployment-descriptor

Unable to find web.xml in netbeans 7.0.1


I want to upload a file to a server, for which I am writing a servlet program.The location of the directory where the document would be uploaded should be fetched from a parameter in web.xml. I have not use web.xml before and only know that it makes entries for each servlet. I am not able to see this file in my web application project that i am making in netbeans. Please help me with this. Thank you.


Solution

  • It should be located in YOURPROJECT\web\WEB-INF folder, so the full path will be: YOURPROJECT\web\WEB-INF\web.xml


    EDIT (Aug 21, 2015)

    Got a downvote with a comment from duffymo, that my answer is not correct.

    comment

    And I decided to illustrate my answer with step-by-step pictures to avoid any misunderstanding.

    I am going to illustrate Netbeans behaviour in Linux (Ubuntu) and Windows (Windows 7) operating systems.

    Linux:

    1. Let's create a simple Java Web project with default settings.

    simple web project on linux system

    1. We're going to the project folder to inspect the contents of this folder:

    web project folder on linux system

    note, that web folder is there.

    1. Navigating further:

    contents of web folder on linux system

    web.xml file location on linux system, file is not created yet

    You can create a web.xml file in this folder manually or do it using Netbeans via project context menu "New -> Create -> Other":

    creating web.xml on linux system in netbeans #1

    creating web.xml on linux system in netbeans #2

    Now, we're navigating YOURPROJECT\web\WEB-INF\ folder to see, that web.xml is there:

    created web.xml file

    The same rules are correct for windows operating system, check the pictures below:

    web-application project folder on windows

    contents of web-application folder on windows

    You can create web.xml here:

    web.xml file location on windows

    or use Netbeans, as I described above.