JavaEE out.println cannot resolve method

Started learning JavaEE. The project is built in IntelliJ IDEA on Maven, TomCat 9.

Ideshka notes that it does not find the println method in out. After it is packed, the code is processed. But I don't know how correct it is - it doesn't wrap the string, i.e. judging by the syntax, it should output each entry(digit) on a new line - but it outputs it separated by a space.

How do I make sure that Ide knows about out's methods and that everything works out correctly?

Pom:

<?xml version="1.0" encoding="UTF-8"?>
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>servlet</groupId>
<artifactId>HelloWorld</artifactId>
<version>0.1</version>
<packaging>war</packaging>


<dependencies>
    <dependency>
        <groupId>org.apache.tomcat</groupId>
        <artifactId>servlet-api</artifactId>
        <version>6.0.53</version>
    </dependency>
</dependencies>

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.8.1</version>
            <configuration>
                <source>11</source>
                <target>11</target>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-war-plugin</artifactId>
            <version>3.2.3</version>

        </plugin>
    </plugins>
</build>

Index.jsp:

<%@ page import="java.util.Date" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
   <head>
     <title>Hello JSP</title>
   </head>
<body>
  <h1.>Testing JSP</h1>
<p>
  <%
    Date now = new Date();
    String dateNow = "Time is: " + now;
  %>
  <%= "Hello World!" %>
  <%= dateNow %>


</p>
<p>
  <%
    for (int i =0; i < 10; i++) {
      out.println(i);
    }
  %>
</p>

Author: Deimont, 2020-04-09

1 answers

Thank you for the numerous answers and cons. After a break in the search, I came up with the idea to climb in the libraries of the installed tomcat and found what I needed. In order for the Ideshka not to complain about the method, you need to connect the dependency:

    <dependency>
        <groupId>org.apache.tomcat</groupId>
        <artifactId>tomcat-jsp-api</artifactId>
        <version>9.0.31</version>
    </dependency>

It's strange that out has the print and println methods, but println doesn't output on a new line. I found a recommendation to wrap each output in a paragraph:

  <%
    for (int i =0; i < 10; i++) {
      out.println("<p>" + i + "</p>");
    }
  %>
 0
Author: Deimont, 2020-04-09 12:41:25