Configure static content resources
Configuring static Web resources involves:
- Specifying location of the static Web contents on the server.
After deployment, all the static content resources that implement the user interface should be located below the Web application root directory. By default, IntelliJ IDEA maps the target Web application root directory to the web folder which is created after you enable Web development support. The default application home page is mapped to the index.jsp stub file which is also created automatically.
You can arrange your static content resources in a module in two ways:
Store the required resources and directories below the <project root>\web folder. After deployment, the entire folder hierarchy of these resources will be copied to the server below the application root.
Store the required resources locally wherever you may find suitable and map them to folders on the server.
To configure static Web content resources
Open the Project Structure dialog (e.g. Ctrl+Alt+Shift+S).
Click Modules on the left-hand pane and expand the desired module.
Click the Web facet. The right-hand pane of the dialog box displays all the available settings.
- In the Web Resource Directories area, manage the list of mappings between the local folders with resources you need and the target directories on the server to deploy the resources to. The default mapping between the <project root>\web folder and the application root directory is already on the list:
To configure a mapping, click the New button. In the Web Resource Directory Path dialog box that opens specify the desired local folder and the target location relative to the application root folder. By default, IntelliJ IDEA maps the <project root>\web folder to the root folder of the application after deployment. For example, if you type a forward slash
/, the files from the Web resource directory will be copied into the deployment root directory.
To edit a mapping, select it in the list, click the Edit button, and update the mapping in the Web Resource Directory Path dialog box that opens.
To discard a mapping, select in the list and click the Remove button.