A simple servlet generates doGet html content using freemarket. Problems arose when the template added a link to the css-file and images - Tomkat does not find them, although they are in the application folder - see the organization of the project in the idea - respectively, images are not displayed in the browser and styles are ignored. Do not tell me how to organize everything?

enter image description here

UPD: as requested pom-file:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>org.local.app</groupId> <artifactId>jira-scr</artifactId> <packaging>war</packaging> <version>1.0-SNAPSHOT</version> <name>jira-scr Maven Webapp</name> <url>http://maven.apache.org</url> <properties> <java.version>1.8</java.version> <log4j.version>1.2.17</log4j.version> </properties> <dependencies> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.12</version> </dependency> <dependency> <groupId>com.sun.jersey</groupId> <artifactId>jersey-server</artifactId> <version>1.8</version> </dependency> <dependency> <groupId>com.sun.jersey</groupId> <artifactId>jersey-json</artifactId> <version>1.8</version> </dependency> <dependency> <groupId>com.sun.jersey</groupId> <artifactId>jersey-client</artifactId> <version>1.8</version> </dependency> <!-- https://mvnrepository.com/artifact/javax.servlet/javax.servlet-api --> <dependency> <groupId>javax.servlet</groupId> <artifactId>javax.servlet-api</artifactId> <version>3.0.1</version> </dependency> <dependency> <groupId>org.apache.commons</groupId> <artifactId>commons-csv</artifactId> <version>1.4</version> </dependency> <dependency> <groupId>commons-io</groupId> <artifactId>commons-io</artifactId> <version>2.5</version> </dependency> <dependency> <groupId>commons-lang</groupId> <artifactId>commons-lang</artifactId> <version>2.6</version> </dependency> <!--Testing --> <dependency> <groupId>org.seleniumhq.selenium</groupId> <artifactId>selenium-server</artifactId> <version>3.0.1</version> </dependency> <dependency> <groupId>org.seleniumhq.selenium</groupId> <artifactId>selenium-remote-driver</artifactId> <version>3.0.1</version> </dependency> <dependency> <groupId>com.codeborne</groupId> <artifactId>phantomjsdriver</artifactId> <version>1.3.0</version> </dependency> <dependency> <groupId>org.freemarker</groupId> <artifactId>freemarker</artifactId> <version>2.3.23</version> </dependency> </dependencies> <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <configuration> <source>${java.version}</source> <target>${java.version}</target> <compilerArgument>-parameters</compilerArgument> </configuration> </plugin> </plugins> </build> 

facets: enter image description here

artefacts: enter image description here

settings: enter image description here

  • show how you deploy to the server, show pom, show facets and artefacts - Senior Pomidor
  • The deployment goes through the very idea - "facets and artefacts" - I don't seem to have a JSP / JSF application. Just all this is new because I am only teaching servlets under java. - dreadangel
  • In any case, you must deploy the artifact. Show configuration configuration deploy - Senior Pomidor
  • understood everything ... added ... - dreadangel
  • Check the include the project build checkbox. Also show the deployment configuration settings (top right when you click run) - Senior Pomidor

1 answer 1

The problems were in the web.xml and in the deployment settings.
In the web.xml it was necessary to add all the necessary components.

 <servlet-mapping> <servlet-name>default</servlet-name> <url-pattern>*.css</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>default</servlet-name> <url-pattern>*.js</url-pattern> </servlet-mapping>