The Java EE 6 Tutorial

ProcedureTo Set the Context Root

A context root identifies a web application in a Java EE server. A context root must start with a forward slash (/) and end with a string.

In a packaged web module for deployment on the GlassFish Server, the context root is stored in sun-web.xml.

To view or edit the context root, follow these steps.

  1. Expand the Web Pages and WEB-INF nodes of the hello1 project.

  2. Double-click sun-web.xml.

  3. In the General tab, observe that the Context Root field is set to /hello1.

    If you needed to edit this value, you could do so here. When you create a new application, you type the context root here.

  4. (Optional) Click the XML tab.

    Observe that the context root value /hello1 is enclosed by the context-root element. You could also edit the value here.